Commit 1c809955 by John Kessenich

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
parent 59ddbafb
#version 120 #version 120
lowp vec3 a; float lowp;
mediump float b; float mediump;
highp int c; float highp;
precision highp float; float precision;
in vec4 i; in vec4 i;
out vec4 o; out vec4 o;
......
...@@ -6,11 +6,11 @@ int a = 0xffffffff; // 32 bits, a gets the value -1 ...@@ -6,11 +6,11 @@ int a = 0xffffffff; // 32 bits, a gets the value -1
//int b = 0xffffffffU; // ERROR: can't convert uint to int //int b = 0xffffffffU; // ERROR: can't convert uint to int
uint c = 0xffffffff; // 32 bits, c gets the value 0xFFFFFFFF uint c = 0xffffffff; // 32 bits, c gets the value 0xFFFFFFFF
//uint d = 0xffffffffU; // 32 bits, d gets the value 0xFFFFFFFF //uint d = 0xffffffffU; // 32 bits, d gets the value 0xFFFFFFFF
int e = -1; // the literal is “1”, then negation is performed, int e = -1; // the literal is "1", then negation is performed,
// and the resulting non-literal 32-bit signed // and the resulting non-literal 32-bit signed
// bit pattern of 0xFFFFFFFF is assigned, giving e // bit pattern of 0xFFFFFFFF is assigned, giving e
// the value of -1. // the value of -1.
//uint f = -1u; // the literal is “1u”, then negation is performed, //uint f = -1u; // the literal is "1u", then negation is performed,
// and the resulting non-literal 32-bit unsigned // and the resulting non-literal 32-bit unsigned
// bit pattern of 0xFFFFFFFF is assigned, giving f // bit pattern of 0xFFFFFFFF is assigned, giving f
// the value of 0xFFFFFFFF. // the value of 0xFFFFFFFF.
...@@ -58,20 +58,20 @@ light lights[]; ...@@ -58,20 +58,20 @@ light lights[];
const int numLights = 2; const int numLights = 2;
light lights[numLights]; light lights[numLights];
in vec3 normal; in vec3 normal;
centroid in vec2 TexCoord; centroid in vec2 TexCoord;
invariant centroid in vec4 Color; invariant centroid in vec4 Color;
noperspective in float temperature; noperspective in float temperature;
flat in vec3 myColor; flat in vec3 myColor;
noperspective centroid in vec2 myTexCoord; 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 uniform vec3 color = vec3(0.7, 0.7, 0.2); // value assigned at link time
in Material { in Material {
smooth in vec4 Color1; // legal, input inside in block smooth in vec4 Color1; // legal, input inside in block
smooth vec4 Color2; // legal, 'in' inherited from 'in Material' smooth vec4 Color2; // legal, 'in' inherited from 'in Material'
vec2 TexCoord; // legal, TexCoord is an input vec2 TexCoord; // legal, TexCoord is an input
uniform float Atten; // illegal, mismatched storage qualifier uniform float Atten; // illegal, mismatched storage qualifier
}; };
...@@ -80,8 +80,8 @@ in Light { ...@@ -80,8 +80,8 @@ in Light {
vec4 LightPos; vec4 LightPos;
vec3 LightColor; vec3 LightColor;
}; };
in ColoredTexture { in ColoredTexture {
vec4 Color; vec4 Color;
vec2 TexCoord; vec2 TexCoord;
} Material; // instance name } Material; // instance name
vec3 Color; // different Color than Material.Color vec3 Color; // different Color than Material.Color
...@@ -104,8 +104,8 @@ layout(location = 3, index = 1) out vec4 factor; ...@@ -104,8 +104,8 @@ layout(location = 3, index = 1) out vec4 factor;
layout(location = 2) out vec4 colors[3]; layout(location = 2) out vec4 colors[3];
layout (depth_greater) out float gl_FragDepth; layout (depth_greater) out float gl_FragDepth;
// redeclaration that changes nothing is allowed // redeclaration that changes nothing is allowed
out float gl_FragDepth; out float gl_FragDepth;
// assume it may be modified in any way // assume it may be modified in any way
...@@ -120,7 +120,7 @@ layout (depth_less) out float gl_FragDepth; ...@@ -120,7 +120,7 @@ layout (depth_less) out float gl_FragDepth;
// assume it will not be modified // assume it will not be modified
layout (depth_unchanged) out float gl_FragDepth; 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 flat in vec4 gl_Color; // redeclared by user to be flat
......
...@@ -73,6 +73,7 @@ Jutta Degener, 1995 ...@@ -73,6 +73,7 @@ Jutta Degener, 1995
#endif #endif
%} %}
%union { %union {
struct { struct {
TSourceLoc line; TSourceLoc line;
...@@ -1664,6 +1665,7 @@ storage_qualifier ...@@ -1664,6 +1665,7 @@ storage_qualifier
parseContext.checkDeprecated($1.line, ENoProfile, 140, "attribute"); parseContext.checkDeprecated($1.line, ENoProfile, 140, "attribute");
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "attribute"); parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "attribute");
parseContext.requireNotRemoved($1.line, EEsProfile, 300, "attribute");
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "attribute")) if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "attribute"))
parseContext.recover(); parseContext.recover();
...@@ -1674,6 +1676,7 @@ storage_qualifier ...@@ -1674,6 +1676,7 @@ storage_qualifier
| VARYING { | VARYING {
parseContext.checkDeprecated($1.line, ENoProfile, 140, "varying"); parseContext.checkDeprecated($1.line, ENoProfile, 140, "varying");
parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "varying"); parseContext.requireNotRemoved($1.line, ECoreProfile, 420, "varying");
parseContext.requireNotRemoved($1.line, EEsProfile, 300, "varying");
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "varying")) if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "varying"))
parseContext.recover(); parseContext.recover();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment