Add ability to treat keywords as identifiers in versions that had not yet reserved the keyword.

Used this for precision keywords and double matrix keywords.

Also added a few missing reserved words.

Also removed redundant "syntax error" when there is a parse error.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20423 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-01-31 22:55:53 +00:00
parent 59ddbafb62
commit 1c809955ba
4 changed files with 143 additions and 73 deletions

View File

@@ -1,10 +1,10 @@
#version 120
lowp vec3 a;
mediump float b;
highp int c;
float lowp;
float mediump;
float highp;
precision highp float;
float precision;
in vec4 i;
out vec4 o;

View File

@@ -6,11 +6,11 @@ int a = 0xffffffff; // 32 bits, a gets the value -1
//int b = 0xffffffffU; // ERROR: can't convert uint to int
uint c = 0xffffffff; // 32 bits, c gets the value 0xFFFFFFFF
//uint d = 0xffffffffU; // 32 bits, d gets the value 0xFFFFFFFF
int e = -1; // the literal is <EFBFBD>1<EFBFBD>, then negation is performed,
int e = -1; // the literal is "1", then negation is performed,
// and the resulting non-literal 32-bit signed
// bit pattern of 0xFFFFFFFF is assigned, giving e
// the value of -1.
//uint f = -1u; // the literal is <EFBFBD>1u<EFBFBD>, then negation is performed,
//uint f = -1u; // the literal is "1u", then negation is performed,
// and the resulting non-literal 32-bit unsigned
// bit pattern of 0xFFFFFFFF is assigned, giving f
// the value of 0xFFFFFFFF.
@@ -58,20 +58,20 @@ light lights[];
const int numLights = 2;
light lights[numLights];
in vec3 normal;
in vec3 normal;
centroid in vec2 TexCoord;
invariant centroid in vec4 Color;
noperspective in float temperature;
flat in vec3 myColor;
noperspective centroid in vec2 myTexCoord;
uniform vec4 lightPosition;
uniform vec4 lightPosition;
uniform vec3 color = vec3(0.7, 0.7, 0.2); // value assigned at link time
in Material {
smooth in vec4 Color1; // legal, input inside in block
smooth vec4 Color2; // legal, 'in' inherited from 'in Material'
vec2 TexCoord; // legal, TexCoord is an input
in Material {
smooth in vec4 Color1; // legal, input inside in block
smooth vec4 Color2; // legal, 'in' inherited from 'in Material'
vec2 TexCoord; // legal, TexCoord is an input
uniform float Atten; // illegal, mismatched storage qualifier
};
@@ -80,8 +80,8 @@ in Light {
vec4 LightPos;
vec3 LightColor;
};
in ColoredTexture {
vec4 Color;
in ColoredTexture {
vec4 Color;
vec2 TexCoord;
} Material; // instance name
vec3 Color; // different Color than Material.Color
@@ -104,8 +104,8 @@ layout(location = 3, index = 1) out vec4 factor;
layout(location = 2) out vec4 colors[3];
layout (depth_greater) out float gl_FragDepth;
// redeclaration that changes nothing is allowed
// redeclaration that changes nothing is allowed
out float gl_FragDepth;
// assume it may be modified in any way
@@ -120,7 +120,7 @@ layout (depth_less) out float gl_FragDepth;
// assume it will not be modified
layout (depth_unchanged) out float gl_FragDepth;
in vec4 gl_Color; // predeclared by the fragment language
in vec4 gl_Color; // predeclared by the fragment language
flat in vec4 gl_Color; // redeclared by user to be flat