Commit c2ff7702 by John Kessenich

For all keywords already present, get correct when they could be identifiers,…

For all keywords already present, get correct when they could be identifiers, are reserved words, or are keywords, for all versions of ESSL and GLSL. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21282 e7fa87d3-cd2b-0410-9028-fcbf551c1848
parent 09da79e1
...@@ -63,4 +63,15 @@ void main() ...@@ -63,4 +63,15 @@ void main()
f |= b; // ERROR f |= b; // ERROR
gl_FragColor = texture2D(s2D, centTexCoord); gl_FragColor = texture2D(s2D, centTexCoord);
float flat;
float smooth;
float noperspective;
float uvec2;
float uvec3;
float uvec4;
//packed; // ERROR, reserved word
} }
float imageBuffer;
float uimage2DRect;
...@@ -9,6 +9,10 @@ precision highp float; ...@@ -9,6 +9,10 @@ precision highp float;
in vec4 i; in vec4 i;
out vec4 o; out vec4 o;
in flat float fflat;
in smooth float fsmooth;
in noperspective float fnop;
void main() void main()
{ {
} }
...@@ -21,14 +21,15 @@ uniform usampler2DArray us2DArray; ...@@ -21,14 +21,15 @@ uniform usampler2DArray us2DArray;
in float c1D; in float c1D;
in vec2 c2D; in vec2 c2D;
in vec3 c3D; in vec3 c3D;
in vec4 c4D; smooth vec4 c4D;
flat in int ic1D; flat in int ic1D;
flat in ivec2 ic2D; flat in ivec2 ic2D;
flat in ivec3 ic3D; flat in ivec3 ic3D;
flat in ivec4 ic4D; flat in ivec4 ic4D;
noperspective in vec4 badv; // ERROR
in sampler2D bads; // ERROR in sampler2D bads; // ERROR
precision lowp uint; // ERROR
struct s { struct s {
int i; int i;
...@@ -64,4 +65,13 @@ void main() ...@@ -64,4 +65,13 @@ void main()
iv = texelFetch(is2DArray, ic3D, ic1D); iv = texelFetch(is2DArray, ic3D, ic1D);
iv.xy = textureSize(sCubeShadow, 2); iv.xy = textureSize(sCubeShadow, 2);
float precise;
double boo; // ERROR
dvec2 boo2; // ERROR
dvec3 boo3; // ERROR
dvec4 boo4; // ERROR
} }
float imageBuffer; // ERROR, reserved
float uimage2DRect; // ERROR, reserved
...@@ -5,7 +5,7 @@ uniform mat3x3 m33; ...@@ -5,7 +5,7 @@ uniform mat3x3 m33;
uniform mat4x4 m44; uniform mat4x4 m44;
in vec3 v3; in vec3 v3;
in vec2 v2; varying vec2 v2; // ERROR
in vec4 bad[10]; // ERROR in vec4 bad[10]; // ERROR
......
...@@ -43,3 +43,7 @@ void main() ...@@ -43,3 +43,7 @@ void main()
pos = p * (tblock.M1 + tblock.M2 + M4 + M3 + t2m); pos = p * (tblock.M1 + tblock.M2 + M4 + M3 + t2m);
color = c * tblock.N1; color = c * tblock.N1;
} }
shared vec4 compute_only; // ERROR
layout(packed) uniform;
...@@ -9,4 +9,5 @@ void main() ...@@ -9,4 +9,5 @@ void main()
{ {
gl_FragColor = varyingVar; gl_FragColor = varyingVar;
gl_FragData[1] = inVar; gl_FragData[1] = inVar;
int buffer = 4;
} }
...@@ -13,7 +13,7 @@ int global_medium; ...@@ -13,7 +13,7 @@ int global_medium;
precision highp int; precision highp int;
precision highp ivec2; // ERROR precision highp ivec2; // ERROR
precision mediump int[2]; // ERROR precision mediump int[2]; // ERROR
precision lowp uint; // ERROR vec4 uint; // okay
precision mediump vec4; // ERROR precision mediump vec4; // ERROR
int global_high; int global_high;
......
...@@ -23,7 +23,7 @@ int k = 0x80000000; // k gets -2147483648 == 0x80000000 ...@@ -23,7 +23,7 @@ int k = 0x80000000; // k gets -2147483648 == 0x80000000
int l = 2147483648; // l gets -2147483648 (the literal set the sign bit) int l = 2147483648; // l gets -2147483648 (the literal set the sign bit)
float fa, fb = 1.5; // single-precision floating-point float fa, fb = 1.5; // single-precision floating-point
//double fc, fd = 2.0LF; // double-precision floating-point double fc, fd = 2.0LF; // double-precision floating-point
vec2 texcoord1, texcoord2; vec2 texcoord1, texcoord2;
vec3 position; vec3 position;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
in vec3 color; in vec3 color;
out vec4 foo; out vec4 foo;
uniform sampler2DRect bar; uniform sampler2DArrayShadow bar;
void main() void main()
{ {
......
...@@ -562,7 +562,8 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -562,7 +562,8 @@ void TBuiltIns::initialize(int version, EProfile profile)
// Original-style texture Functions existing in both stages. // Original-style texture Functions existing in both stages.
// (Per-stage functions below.) // (Per-stage functions below.)
// //
if (profile != EEsProfile || version == 100) { if (profile == EEsProfile && version == 100 ||
profile == ECompatibilityProfile || version < FirstProfileVersion) {
s.append(TString("vec4 texture2D(sampler2D, vec2);")); s.append(TString("vec4 texture2D(sampler2D, vec2);"));
s.append(TString("vec4 texture2DProj(sampler2D, vec3);")); s.append(TString("vec4 texture2DProj(sampler2D, vec3);"));
...@@ -571,7 +572,8 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -571,7 +572,8 @@ void TBuiltIns::initialize(int version, EProfile profile)
s.append(TString("vec4 textureCube(samplerCube, vec3);")); s.append(TString("vec4 textureCube(samplerCube, vec3);"));
} }
if (profile != EEsProfile && version > 100) { if (profile != EEsProfile &&
(profile == ECompatibilityProfile || version < FirstProfileVersion)) {
s.append(TString("vec4 texture1D(sampler1D, float);")); s.append(TString("vec4 texture1D(sampler1D, float);"));
s.append(TString("vec4 texture1DProj(sampler1D, vec2);")); s.append(TString("vec4 texture1DProj(sampler1D, vec2);"));
...@@ -585,12 +587,7 @@ void TBuiltIns::initialize(int version, EProfile profile) ...@@ -585,12 +587,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
s.append(TString("vec4 shadow1DProj(sampler1DShadow, vec4);")); s.append(TString("vec4 shadow1DProj(sampler1DShadow, vec4);"));
s.append(TString("vec4 shadow2DProj(sampler2DShadow, vec4);")); s.append(TString("vec4 shadow2DProj(sampler2DShadow, vec4);"));
// ARB_texture_rectangle // TODO: functionality: non-ES legacy texuring for Lod, others?
s.append(TString("vec4 texture2DRect(sampler2DRect, vec2);"));
s.append(TString("vec4 texture2DRectProj(sampler2DRect, vec3);"));
s.append(TString("vec4 texture2DRectProj(sampler2DRect, vec4);"));
s.append(TString("vec4 shadow2DRect(sampler2DRectShadow, vec3);"));
s.append(TString("vec4 shadow2DRectProj(sampler2DRectShadow, vec4);"));
} }
s.append(TString("\n")); s.append(TString("\n"));
...@@ -988,6 +985,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile) ...@@ -988,6 +985,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile) if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)
continue; continue;
if (dim == EsdRect && version < 140)
continue;
if (dim != Esd2D && ms) if (dim != Esd2D && ms)
continue; continue;
if ((dim == Esd3D || dim == EsdRect) && arrayed) if ((dim == Esd3D || dim == EsdRect) && arrayed)
......
...@@ -66,13 +66,17 @@ LF [lL][fF] ...@@ -66,13 +66,17 @@ LF [lL][fF]
#include "ParseHelper.h" #include "ParseHelper.h"
#include "glslang_tab.cpp.h" #include "glslang_tab.cpp.h"
int PaReservedWord(); void PaReservedWord();
int PaIdentOrType(TString& id, TParseContext&, TSymbol*&); void PaCompatibilityWord(TParseContext&);
int PaIdentOrType(const char* yytext, TParseContext&, YYSTYPE* pyylval);
int PaIdentOrReserved(bool reserved, TParseContext&, int line, const char* text, YYSTYPE* pyylval); int PaIdentOrReserved(bool reserved, TParseContext&, int line, const char* text, YYSTYPE* pyylval);
int PaES30ReservedFromGLSL(int version, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword); int PaES30ReservedFromGLSL(int version, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword);
int PaNonreservedKeyword(int esVersion, int nonEsVersion, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword);
int PaPrecisionKeyword(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword); int PaPrecisionKeyword(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword);
int PaMatNxM(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword); int PaMatNxM(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword);
int PaDMat(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword); int PaDMat(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword);
int Pa1stGenerationImage(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword);
int Pa2ndGenerationImage(TParseContext&, int line, const char* text, YYSTYPE* pyylval, int keyword);
/* windows only pragma */ /* windows only pragma */
#ifdef _MSC_VER #ifdef _MSC_VER
...@@ -100,326 +104,504 @@ int yy_input(char* buf, int max_size); ...@@ -100,326 +104,504 @@ int yy_input(char* buf, int max_size);
%option outfile="gen_glslang.cpp" %option outfile="gen_glslang.cpp"
%x FIELDS %x FIELDS
%% %%
<*>"//"[^\n]*"\n" { /* CPP should have taken care of this */ }; <*>"//"[^\n]*"\n" { /* CPP should have taken care of this */ };
"attribute" { pyylval->lex.line = yylineno; return(ATTRIBUTE); } // TODO: semantics: ES 30 reserved "attribute" { pyylval->lex.line = yylineno;
"const" { pyylval->lex.line = yylineno; return(CONST); } if (parseContext.profile == EEsProfile && parseContext.version >= 300)
"uniform" { pyylval->lex.line = yylineno; return(UNIFORM); } PaReservedWord();
"varying" { pyylval->lex.line = yylineno; return(VARYING); } // TODO: semantics: ES 30 reserved PaCompatibilityWord(parseContext);
"buffer" { pyylval->lex.line = yylineno; return(BUFFER); } return ATTRIBUTE;
"shared" { pyylval->lex.line = yylineno; return(SHARED); } }
"const" { pyylval->lex.line = yylineno;
"coherent" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, COHERENT); } return CONST;
"volatile" { if (parseContext.profile == EEsProfile || parseContext.version < 420) }
return PaReservedWord(); "uniform" { pyylval->lex.line = yylineno;
else return UNIFORM;
pyylval->lex.line = yylineno; return(VOLATILE); }
} "varying" { pyylval->lex.line = yylineno;
"restrict" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, RESTRICT); } if (parseContext.profile == EEsProfile && parseContext.version >= 300)
"readonly" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, READONLY); } PaReservedWord();
"writeonly" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, WRITEONLY); } PaCompatibilityWord(parseContext);
return VARYING;
"layout" { pyylval->lex.line = yylineno; return(LAYOUT); } }
"buffer" { pyylval->lex.line = yylineno;
"centroid" { pyylval->lex.line = yylineno; return(CENTROID); } if (parseContext.version < 430)
"flat" { pyylval->lex.line = yylineno; return(FLAT); } return PaIdentOrType(yytext, parseContext, pyylval);
"smooth" { pyylval->lex.line = yylineno; return(SMOOTH); } return BUFFER;
"noperspective" { pyylval->lex.line = yylineno; return(NOPERSPECTIVE); } }
"shared" { pyylval->lex.line = yylineno;
"patch" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, PATCH); } if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
"sample" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, SAMPLE); } parseContext.profile != EEsProfile && parseContext.version < 140)
return PaIdentOrType(yytext, parseContext, pyylval);
"break" { pyylval->lex.line = yylineno; return(BREAK); } return SHARED;
"continue" { pyylval->lex.line = yylineno; return(CONTINUE); } }
"do" { pyylval->lex.line = yylineno; return(DO); } "coherent" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, COHERENT); }
"for" { pyylval->lex.line = yylineno; return(FOR); } "volatile" { pyylval->lex.line = yylineno;
"while" { pyylval->lex.line = yylineno; return(WHILE); } if (parseContext.profile == EEsProfile || parseContext.version < 420)
"switch" { pyylval->lex.line = yylineno; return(SWITCH); } PaReservedWord();
"case" { pyylval->lex.line = yylineno; return(CASE); } return VOLATILE;
"default" { pyylval->lex.line = yylineno; return(DEFAULT); } }
"restrict" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, RESTRICT); }
"if" { pyylval->lex.line = yylineno; return(IF); } "readonly" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, READONLY); }
"else" { pyylval->lex.line = yylineno; return(ELSE); } "writeonly" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, WRITEONLY); }
"subroutine" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, SUBROUTINE); } "layout" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
"in" { pyylval->lex.line = yylineno; return(IN); } parseContext.profile != EEsProfile && parseContext.version < 140)
"out" { pyylval->lex.line = yylineno; return(OUT); } return PaIdentOrType(yytext, parseContext, pyylval);
"inout" { pyylval->lex.line = yylineno; return(INOUT); } return LAYOUT;
}
"precise" { pyylval->lex.line = yylineno; return(PRECISE); } "centroid" { pyylval->lex.line = yylineno;
"invariant" { pyylval->lex.line = yylineno; return(INVARIANT); } if (parseContext.version < 120)
return PaIdentOrType(yytext, parseContext, pyylval);
"highp" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, HIGH_PRECISION); } return CENTROID;
"mediump" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, MEDIUM_PRECISION); } }
"lowp" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, LOW_PRECISION); } "flat" { pyylval->lex.line = yylineno;
"precision" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, PRECISION); } if (parseContext.profile == EEsProfile && parseContext.version < 300)
PaReservedWord();
"float" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(FLOAT); } else if (parseContext.profile != EEsProfile && parseContext.version < 130)
"double" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DOUBLE); } return PaIdentOrType(yytext, parseContext, pyylval);
"int" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(INT); } return FLAT;
"uint" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UINT); } }
"void" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(VOID); } "smooth" { pyylval->lex.line = yylineno;
"bool" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(BOOL); } if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
"true" { pyylval->lex.line = yylineno; pyylval->lex.b = true; return(BOOLCONSTANT); } parseContext.profile != EEsProfile && parseContext.version < 130)
"false" { pyylval->lex.line = yylineno; pyylval->lex.b = false; return(BOOLCONSTANT); } return PaIdentOrType(yytext, parseContext, pyylval);
return SMOOTH;
"discard" { pyylval->lex.line = yylineno; return(DISCARD); } }
"return" { pyylval->lex.line = yylineno; return(RETURN); } "noperspective" { return PaES30ReservedFromGLSL(130, parseContext, yylineno, yytext, pyylval, NOPERSPECTIVE); }
"patch" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, PATCH); }
"atomic_uint" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, ATOMIC_UINT); } "sample" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, SAMPLE); }
"mat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT2); } "break" { pyylval->lex.line = yylineno; return BREAK; }
"mat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT3); } "continue" { pyylval->lex.line = yylineno; return CONTINUE; }
"mat4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT4); } "do" { pyylval->lex.line = yylineno; return DO; }
"for" { pyylval->lex.line = yylineno; return FOR; }
"mat2x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X2); } "while" { pyylval->lex.line = yylineno; return WHILE; }
"mat2x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X3); } "switch" { pyylval->lex.line = yylineno; return SWITCH; }
"mat2x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X4); } "case" { pyylval->lex.line = yylineno; return CASE; }
"mat3x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X2); } "default" { pyylval->lex.line = yylineno; return DEFAULT; }
"mat3x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X3); }
"mat3x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X4); } "if" { pyylval->lex.line = yylineno; return IF; }
"mat4x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X2); } "else" { pyylval->lex.line = yylineno; return ELSE; }
"mat4x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X3); }
"mat4x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X4); } "subroutine" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, SUBROUTINE); }
"dmat2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2); }
"dmat3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3); } "in" { pyylval->lex.line = yylineno; return IN; }
"dmat4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4); } "out" { pyylval->lex.line = yylineno; return OUT; }
"dmat2x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X2); } "inout" { pyylval->lex.line = yylineno; return INOUT; }
"dmat2x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X3); }
"dmat2x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X4); } "precise" { pyylval->lex.line = yylineno;
"dmat3x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X2); } if (parseContext.profile == EEsProfile ||
"dmat3x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X3); } parseContext.profile != EEsProfile && parseContext.version < 400)
"dmat3x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X4); } return PaIdentOrType(yytext, parseContext, pyylval);
"dmat4x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X2); } return PRECISE;
"dmat4x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X3); } }
"dmat4x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X4); } "invariant" { pyylval->lex.line = yylineno;;
if (parseContext.profile != EEsProfile && parseContext.version < 120)
"vec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC2); } return PaIdentOrType(yytext, parseContext, pyylval);
"vec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC3); } return INVARIANT;
"vec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC4); } }
"dvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC2); }
"dvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC3); } "highp" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, HIGH_PRECISION); }
"dvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC4); } "mediump" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, MEDIUM_PRECISION); }
"ivec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC2); } "lowp" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, LOW_PRECISION); }
"ivec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC3); } "precision" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, PRECISION); }
"ivec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC4); }
"uvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC2); } "float" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return FLOAT; }
"uvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC3); } "double" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"uvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC4); } if (parseContext.profile == EEsProfile || parseContext.version < 400)
"bvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC2); } PaReservedWord();
"bvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC3); } return DOUBLE;
"bvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC4); } }
"int" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return INT; }
"sampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1D; } "uint" { parseContext.lexAfterType = true;
"sampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2D; } return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, UINT);
"sampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER3D; } }
"samplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBE; } "void" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return VOID; }
"sampler1DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DSHADOW; } "bool" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return BOOL; }
"sampler2DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DSHADOW; } "true" { pyylval->lex.line = yylineno; pyylval->lex.b = true; return BOOLCONSTANT; }
"false" { pyylval->lex.line = yylineno; pyylval->lex.b = false; return BOOLCONSTANT; }
"sampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DRECT; }
"isampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2DRECT; } "discard" { pyylval->lex.line = yylineno; return DISCARD; }
"usampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2DRECT; } "return" { pyylval->lex.line = yylineno; return RETURN; }
"sampler2DRectShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DRECTSHADOW; }
"atomic_uint" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, ATOMIC_UINT); }
"samplerCubeShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBESHADOW; }
"sampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DARRAY; } "mat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return MAT2; }
"sampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DARRAY; } "mat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return MAT3; }
"samplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBEARRAY; } "mat4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return MAT4; }
"sampler1DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DARRAYSHADOW; }
"sampler2DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DARRAYSHADOW; } "mat2x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X2); }
"samplerCubeArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBEARRAYSHADOW; } "mat2x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X3); }
"isampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER1D; } "mat2x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X4); }
"isampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2D; } "mat3x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X2); }
"isampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER3D; } "mat3x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X3); }
"isamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLERCUBE; } "mat3x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT3X4); }
"isamplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLERCUBEARRAY; } "mat4x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X2); }
"isampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER1DARRAY; } "mat4x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X3); }
"isampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2DARRAY; } "mat4x4" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT4X4); }
"usampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER1D; } "dmat2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2); }
"usampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2D; } "dmat3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3); }
"usampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER3D; } "dmat4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4); }
"usamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLERCUBE; } "dmat2x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X2); }
"usamplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLERCUBEARRAY; } "dmat2x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X3); }
"usampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER1DARRAY; } "dmat2x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT2X4); }
"usampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2DARRAY; } "dmat3x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X2); }
"dmat3x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X3); }
"samplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLERBUFFER); } "dmat3x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT3X4); }
"isamplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLERBUFFER); } "dmat4x2" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X2); }
"usamplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLERBUFFER); } "dmat4x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X3); }
"sampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLER2DMS); } "dmat4x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X4); }
"isampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLER2DMS); }
"usampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLER2DMS); } "vec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return VEC2; }
"sampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLER2DMSARRAY); } "vec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return VEC3; }
"isampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLER2DMSARRAY); } "vec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return VEC4; }
"usampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLER2DMSARRAY); } "dvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"image1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE1D); } if (parseContext.profile == EEsProfile || parseContext.version < 400)
"iimage1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE1D); } PaReservedWord();
"uimage1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE1D); } return DVEC2;
"image2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2D); } }
"iimage2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2D); } "dvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"uimage2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2D); } if (parseContext.profile == EEsProfile || parseContext.version < 400)
"image3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE3D); } PaReservedWord();
"iimage3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE3D); } return DVEC3;
"uimage3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE3D); } }
"image2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2DRECT); } "dvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"iimage2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2DRECT); } if (parseContext.profile == EEsProfile || parseContext.version < 400)
"uimage2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2DRECT); } PaReservedWord();
"imageCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGECUBE); } return DVEC4;
"iimageCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGECUBE); } }
"uimageCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGECUBE); } "ivec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return IVEC2; }
"imageBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGEBUFFER); } "ivec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return IVEC3; }
"iimageBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGEBUFFER); } "ivec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return IVEC4; }
"uimageBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGEBUFFER); } "uvec2" { parseContext.lexAfterType = true;
"image1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE1DARRAY); } return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, UVEC2);
"iimage1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE1DARRAY); } }
"uimage1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE1DARRAY); } "uvec3" { parseContext.lexAfterType = true;
"image2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2DARRAY); } return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, UVEC3);
"iimage2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2DARRAY); } }
"uimage2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2DARRAY); } "uvec4" { parseContext.lexAfterType = true;
"imageCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGECUBEARRAY); } return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, UVEC4);
"iimageCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGECUBEARRAY); } }
"uimageCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGECUBEARRAY); } "bvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return BVEC2; }
"image2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2DMS); } "bvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return BVEC3; }
"iimage2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2DMS); } "bvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return BVEC4; }
"uimage2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2DMS); }
"image2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2DMSARRAY); } "sampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2D; }
"iimage2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2DMSARRAY); } "samplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBE; }
"uimage2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2DMSARRAY); }
"sampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"struct" { pyylval->lex.line = yylineno; return(STRUCT); } if (parseContext.profile == EEsProfile)
PaReservedWord();
"asm" { PaReservedWord(); return 0; } return SAMPLER1D;
}
"class" { PaReservedWord(); return 0; } "sampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"union" { PaReservedWord(); return 0; } if (parseContext.profile == EEsProfile && parseContext.version < 300)
"enum" { PaReservedWord(); return 0; } PaReservedWord();
"typedef" { PaReservedWord(); return 0; } return SAMPLER3D;
"template" { PaReservedWord(); return 0; } }
"this" { PaReservedWord(); return 0; } "sampler1DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"packed" { PaReservedWord(); return 0; } if (parseContext.profile == EEsProfile)
PaReservedWord();
"resource" { if (parseContext.profile == EEsProfile && parseContext.version >= 300 || return SAMPLER1DSHADOW;
parseContext.profile != EEsProfile && parseContext.version >= 420) }
return PaReservedWord(); "sampler2DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
} if (parseContext.profile == EEsProfile && parseContext.version < 300)
PaReservedWord();
"goto" { PaReservedWord(); return 0; } return SAMPLER2DSHADOW;
}
"inline" { PaReservedWord(); return 0; } "sampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"noinline" { PaReservedWord(); return 0; } if (parseContext.profile == EEsProfile ||
"public" { PaReservedWord(); return 0; } parseContext.profile != EEsProfile && parseContext.version < 140)
"static" { PaReservedWord(); return 0; } PaReservedWord();
"extern" { PaReservedWord(); return 0; } return SAMPLER2DRECT;
"external" { PaReservedWord(); return 0; } }
"interface" { PaReservedWord(); return 0; } "sampler2DRectShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile ||
"long" { PaReservedWord(); return 0; } parseContext.profile != EEsProfile && parseContext.version < 140)
"short" { PaReservedWord(); return 0; } PaReservedWord();
"half" { PaReservedWord(); return 0; } return SAMPLER2DRECTSHADOW;
"fixed" { PaReservedWord(); return 0; } }
"unsigned" { PaReservedWord(); return 0; } "samplerCubeShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, SAMPLERCUBESHADOW);
"superp" { bool reserved = (parseContext.profile == EEsProfile || parseContext.version >= 130); }
return PaIdentOrReserved(reserved, parseContext, yylineno, yytext, pyylval); } "sampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile && parseContext.version == 300)
"input" { PaReservedWord(); return 0; } PaReservedWord();
"output" { PaReservedWord(); return 0; } else if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
parseContext.profile != EEsProfile && parseContext.version < 130)
"hvec2" { PaReservedWord(); return 0; } return PaIdentOrType(yytext, parseContext, pyylval);
"hvec3" { PaReservedWord(); return 0; } return SAMPLER1DARRAY;
"hvec4" { PaReservedWord(); return 0; } }
"fvec2" { PaReservedWord(); return 0; } "sampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"fvec3" { PaReservedWord(); return 0; } return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, SAMPLER2DARRAY);
"fvec4" { PaReservedWord(); return 0; } }
"sampler2DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"sampler3DRect" { PaReservedWord(); return 0; } return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, SAMPLER2DARRAYSHADOW);
}
"filter" { PaReservedWord(); return 0; } "samplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
"sizeof" { PaReservedWord(); return 0; } return PaIdentOrType(yytext, parseContext, pyylval);
"cast" { PaReservedWord(); return 0; } return SAMPLERCUBEARRAY;
}
"namespace" { PaReservedWord(); return 0; } "sampler1DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
"using" { PaReservedWord(); return 0; } return PaES30ReservedFromGLSL(130, parseContext, yylineno, yytext, pyylval, SAMPLER1DARRAYSHADOW);
}
"samplerCubeArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
return PaIdentOrType(yytext, parseContext, pyylval);
return SAMPLERCUBEARRAYSHADOW;
}
"isampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(130, parseContext, yylineno, yytext, pyylval, ISAMPLER1D);
}
"isampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, ISAMPLER2D);
}
"isampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, ISAMPLER3D);
}
"isamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, ISAMPLERCUBE);
}
"isampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(130, parseContext, yylineno, yytext, pyylval, ISAMPLER1DARRAY);
}
"isampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, ISAMPLER2DARRAY);
}
"usampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(130, parseContext, yylineno, yytext, pyylval, USAMPLER1D);
}
"usampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, USAMPLER2D);
}
"usampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, USAMPLER3D);
}
"usamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, USAMPLERCUBE);
}
"usampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(130, parseContext, yylineno, yytext, pyylval, USAMPLER1DARRAY);
}
"usampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, USAMPLER2DARRAY);
}
"isampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(140, parseContext, yylineno, yytext, pyylval, ISAMPLER2DRECT);
}
"usampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(140, parseContext, yylineno, yytext, pyylval, USAMPLER2DRECT);
}
"isamplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
return PaIdentOrType(yytext, parseContext, pyylval);
return ISAMPLERCUBEARRAY;
}
"usamplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
return PaIdentOrType(yytext, parseContext, pyylval);
return USAMPLERCUBEARRAY;
}
"samplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(130, parseContext, yylineno, yytext, pyylval, SAMPLERBUFFER);
}
"isamplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(140, parseContext, yylineno, yytext, pyylval, ISAMPLERBUFFER);
}
"usamplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(140, parseContext, yylineno, yytext, pyylval, USAMPLERBUFFER);
}
"sampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(150, parseContext, yylineno, yytext, pyylval, SAMPLER2DMS);
}
"isampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(150, parseContext, yylineno, yytext, pyylval, ISAMPLER2DMS);
}
"usampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(150, parseContext, yylineno, yytext, pyylval, USAMPLER2DMS);
}
"sampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(150, parseContext, yylineno, yytext, pyylval, SAMPLER2DMSARRAY);
}
"isampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(150, parseContext, yylineno, yytext, pyylval, ISAMPLER2DMSARRAY);
}
"usampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaES30ReservedFromGLSL(150, parseContext, yylineno, yytext, pyylval, USAMPLER2DMSARRAY);
}
"image1D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGE1D); }
"iimage1D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGE1D); }
"uimage1D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGE1D); }
"image2D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGE2D); }
"iimage2D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGE2D); }
"uimage2D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGE2D); }
"image3D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGE3D); }
"iimage3D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGE3D); }
"uimage3D" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGE3D); }
"image2DRect" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGE2DRECT); }
"iimage2DRect" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGE2DRECT); }
"uimage2DRect" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGE2DRECT); }
"imageCube" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGECUBE); }
"iimageCube" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGECUBE); }
"uimageCube" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGECUBE); }
"imageBuffer" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGEBUFFER); }
"iimageBuffer" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGEBUFFER); }
"uimageBuffer" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGEBUFFER); }
"image1DArray" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGE1DARRAY); }
"iimage1DArray" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGE1DARRAY); }
"uimage1DArray" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGE1DARRAY); }
"image2DArray" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGE2DARRAY); }
"iimage2DArray" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGE2DARRAY); }
"uimage2DArray" { return Pa1stGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGE2DARRAY); }
"imageCubeArray" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGECUBEARRAY); }
"iimageCubeArray" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGECUBEARRAY); }
"uimageCubeArray" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGECUBEARRAY); }
"image2DMS" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGE2DMS); }
"iimage2DMS" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGE2DMS); }
"uimage2DMS" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGE2DMS); }
"image2DMSArray" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, IMAGE2DMSARRAY); }
"iimage2DMSArray" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, IIMAGE2DMSARRAY); }
"uimage2DMSArray" { return Pa2ndGenerationImage(parseContext, yylineno, yytext, pyylval, UIMAGE2DMSARRAY); }
"struct" { pyylval->lex.line = yylineno; return STRUCT; }
"asm" { PaReservedWord(); return 0; }
"class" { PaReservedWord(); return 0; }
"union" { PaReservedWord(); return 0; }
"enum" { PaReservedWord(); return 0; }
"typedef" { PaReservedWord(); return 0; }
"template" { PaReservedWord(); return 0; }
"this" { PaReservedWord(); return 0; }
"packed" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
parseContext.profile != EEsProfile && parseContext.version < 330) {
PaReservedWord();
return 0;
} else
return PaIdentOrType(yytext, parseContext, pyylval);
}
"resource" { bool reserved = parseContext.profile == EEsProfile && parseContext.version >= 300 ||
parseContext.profile != EEsProfile && parseContext.version >= 420;
return PaIdentOrReserved(reserved, parseContext, yylineno, yytext, pyylval);
}
"goto" { PaReservedWord(); return 0; }
"inline" { PaReservedWord(); return 0; }
"noinline" { PaReservedWord(); return 0; }
"public" { PaReservedWord(); return 0; }
"static" { PaReservedWord(); return 0; }
"extern" { PaReservedWord(); return 0; }
"external" { PaReservedWord(); return 0; }
"interface" { PaReservedWord(); return 0; }
"long" { PaReservedWord(); return 0; }
"short" { PaReservedWord(); return 0; }
"half" { PaReservedWord(); return 0; }
"fixed" { PaReservedWord(); return 0; }
"unsigned" { PaReservedWord(); return 0; }
"superp" { bool reserved = parseContext.profile == EEsProfile || parseContext.version >= 130;
return PaIdentOrReserved(reserved, parseContext, yylineno, yytext, pyylval);
}
"input" { PaReservedWord(); return 0; }
"output" { PaReservedWord(); return 0; }
"hvec2" { PaReservedWord(); return 0; }
"hvec3" { PaReservedWord(); return 0; }
"hvec4" { PaReservedWord(); return 0; }
"fvec2" { PaReservedWord(); return 0; }
"fvec3" { PaReservedWord(); return 0; }
"fvec4" { PaReservedWord(); return 0; }
"sampler3DRect" { PaReservedWord(); return 0; }
"filter" { PaReservedWord(); return 0; }
"sizeof" { PaReservedWord(); return 0; }
"cast" { PaReservedWord(); return 0; }
"namespace" { PaReservedWord(); return 0; }
"using" { PaReservedWord(); return 0; }
{L}({L}|{D})* { {L}({L}|{D})* {
pyylval->lex.line = yylineno; pyylval->lex.line = yylineno;
pyylval->lex.string = NewPoolTString(yytext); return PaIdentOrType(yytext, parseContext, pyylval);
return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol);
} }
0[xX]{H}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtoul(yytext, 0, 0); return(INTCONSTANT); } 0[xX]{H}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtoul(yytext, 0, 0); return INTCONSTANT; }
0{O}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtoul(yytext, 0, 0); return(INTCONSTANT); } 0{O}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtoul(yytext, 0, 0); return INTCONSTANT; }
0{D}+ { pyylval->lex.line = yylineno; parseContext.error(yylineno, "Invalid Octal number.", yytext, "", ""); parseContext.recover(); return 0;} 0{D}+ { pyylval->lex.line = yylineno; parseContext.error(yylineno, "Invalid Octal number.", yytext, "", ""); parseContext.recover(); return 0;}
{D}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtoul(yytext, 0, 0); return(INTCONSTANT); } {D}+ { pyylval->lex.line = yylineno; pyylval->lex.i = strtoul(yytext, 0, 0); return INTCONSTANT; }
0[xX]{H}+{U} { pyylval->lex.line = yylineno; pyylval->lex.u = strtoul(yytext, 0, 0); return(UINTCONSTANT); } 0[xX]{H}+{U} { pyylval->lex.line = yylineno; pyylval->lex.u = strtoul(yytext, 0, 0); return UINTCONSTANT; }
0{O}+{U} { pyylval->lex.line = yylineno; pyylval->lex.u = strtoul(yytext, 0, 0); return(UINTCONSTANT); } 0{O}+{U} { pyylval->lex.line = yylineno; pyylval->lex.u = strtoul(yytext, 0, 0); return UINTCONSTANT; }
0{D}+{U} { pyylval->lex.line = yylineno; parseContext.error(yylineno, "Invalid Octal number.", yytext, "", ""); parseContext.recover(); return 0;} 0{D}+{U} { pyylval->lex.line = yylineno; parseContext.error(yylineno, "Invalid Octal number.", yytext, "", ""); parseContext.recover(); return 0;}
{D}+{U} { pyylval->lex.line = yylineno; pyylval->lex.u = strtoul(yytext, 0, 0); return(UINTCONSTANT); } {D}+{U} { pyylval->lex.line = yylineno; pyylval->lex.u = strtoul(yytext, 0, 0); return UINTCONSTANT; }
{D}+{F} { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); } {D}+{F} { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return FLOATCONSTANT; }
{D}+{E}{F}? { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); } {D}+{E}{F}? { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return FLOATCONSTANT; }
{D}+"."{D}*({E})?{F}? { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); } {D}+"."{D}*({E})?{F}? { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return FLOATCONSTANT; }
"."{D}+({E})?{F}? { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return(FLOATCONSTANT); } "."{D}+({E})?{F}? { pyylval->lex.line = yylineno; pyylval->lex.f = static_cast<float>(atof(yytext)); return FLOATCONSTANT; }
{D}+{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return(DOUBLECONSTANT); } {D}+{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return DOUBLECONSTANT; }
{D}+{E}{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return(DOUBLECONSTANT); } {D}+{E}{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return DOUBLECONSTANT; }
{D}+"."{D}*({E})?{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return(DOUBLECONSTANT); } {D}+"."{D}*({E})?{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return DOUBLECONSTANT; }
"."{D}+({E})?{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return(DOUBLECONSTANT); } "."{D}+({E})?{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return DOUBLECONSTANT; }
"/*" { int ret = PaParseComment(pyylval->lex.line, parseContext); if (!ret) return ret; } "/*" { int ret = PaParseComment(pyylval->lex.line, parseContext); if (!ret) return ret; }
"+=" { pyylval->lex.line = yylineno; return(ADD_ASSIGN); } "+=" { pyylval->lex.line = yylineno; return ADD_ASSIGN; }
"-=" { pyylval->lex.line = yylineno; return(SUB_ASSIGN); } "-=" { pyylval->lex.line = yylineno; return SUB_ASSIGN; }
"*=" { pyylval->lex.line = yylineno; return(MUL_ASSIGN); } "*=" { pyylval->lex.line = yylineno; return MUL_ASSIGN; }
"/=" { pyylval->lex.line = yylineno; return(DIV_ASSIGN); } "/=" { pyylval->lex.line = yylineno; return DIV_ASSIGN; }
"%=" { pyylval->lex.line = yylineno; return(MOD_ASSIGN); } "%=" { pyylval->lex.line = yylineno; return MOD_ASSIGN; }
"<<=" { pyylval->lex.line = yylineno; return(LEFT_ASSIGN); } "<<=" { pyylval->lex.line = yylineno; return LEFT_ASSIGN; }
">>=" { pyylval->lex.line = yylineno; return(RIGHT_ASSIGN); } ">>=" { pyylval->lex.line = yylineno; return RIGHT_ASSIGN; }
"&=" { pyylval->lex.line = yylineno; return(AND_ASSIGN); } "&=" { pyylval->lex.line = yylineno; return AND_ASSIGN; }
"^=" { pyylval->lex.line = yylineno; return(XOR_ASSIGN); } "^=" { pyylval->lex.line = yylineno; return XOR_ASSIGN; }
"|=" { pyylval->lex.line = yylineno; return(OR_ASSIGN); } "|=" { pyylval->lex.line = yylineno; return OR_ASSIGN; }
"++" { pyylval->lex.line = yylineno; return(INC_OP); } "++" { pyylval->lex.line = yylineno; return INC_OP; }
"--" { pyylval->lex.line = yylineno; return(DEC_OP); } "--" { pyylval->lex.line = yylineno; return DEC_OP; }
"&&" { pyylval->lex.line = yylineno; return(AND_OP); } "&&" { pyylval->lex.line = yylineno; return AND_OP; }
"||" { pyylval->lex.line = yylineno; return(OR_OP); } "||" { pyylval->lex.line = yylineno; return OR_OP; }
"^^" { pyylval->lex.line = yylineno; return(XOR_OP); } "^^" { pyylval->lex.line = yylineno; return XOR_OP; }
"<=" { pyylval->lex.line = yylineno; return(LE_OP); } "<=" { pyylval->lex.line = yylineno; return LE_OP; }
">=" { pyylval->lex.line = yylineno; return(GE_OP); } ">=" { pyylval->lex.line = yylineno; return GE_OP; }
"==" { pyylval->lex.line = yylineno; return(EQ_OP); } "==" { pyylval->lex.line = yylineno; return EQ_OP; }
"!=" { pyylval->lex.line = yylineno; return(NE_OP); } "!=" { pyylval->lex.line = yylineno; return NE_OP; }
"<<" { pyylval->lex.line = yylineno; return(LEFT_OP); } "<<" { pyylval->lex.line = yylineno; return LEFT_OP; }
">>" { pyylval->lex.line = yylineno; return(RIGHT_OP); } ">>" { pyylval->lex.line = yylineno; return RIGHT_OP; }
";" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(SEMICOLON); } ";" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return SEMICOLON; }
("{"|"<%") { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(LEFT_BRACE); } ("{"|"<%") { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return LEFT_BRACE; }
("}"|"%>") { pyylval->lex.line = yylineno; return(RIGHT_BRACE); } ("}"|"%>") { pyylval->lex.line = yylineno; return RIGHT_BRACE; }
"," { pyylval->lex.line = yylineno; if (parseContext.inTypeParen) parseContext.lexAfterType = false; return(COMMA); } "," { pyylval->lex.line = yylineno; if (parseContext.inTypeParen) parseContext.lexAfterType = false; return COMMA; }
":" { pyylval->lex.line = yylineno; return(COLON); } ":" { pyylval->lex.line = yylineno; return COLON; }
"=" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return(EQUAL); } "=" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; return EQUAL; }
"(" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; parseContext.inTypeParen = true; return(LEFT_PAREN); } "(" { pyylval->lex.line = yylineno; parseContext.lexAfterType = false; parseContext.inTypeParen = true; return LEFT_PAREN; }
")" { pyylval->lex.line = yylineno; parseContext.inTypeParen = false; return(RIGHT_PAREN); } ")" { pyylval->lex.line = yylineno; parseContext.inTypeParen = false; return RIGHT_PAREN; }
("["|"<:") { pyylval->lex.line = yylineno; return(LEFT_BRACKET); } ("["|"<:") { pyylval->lex.line = yylineno; return LEFT_BRACKET; }
("]"|":>") { pyylval->lex.line = yylineno; return(RIGHT_BRACKET); } ("]"|":>") { pyylval->lex.line = yylineno; return RIGHT_BRACKET; }
"." { BEGIN(FIELDS); return(DOT); } "." { BEGIN(FIELDS); return DOT; }
"!" { pyylval->lex.line = yylineno; return(BANG); } "!" { pyylval->lex.line = yylineno; return BANG; }
"-" { pyylval->lex.line = yylineno; return(DASH); } "-" { pyylval->lex.line = yylineno; return DASH; }
"~" { pyylval->lex.line = yylineno; return(TILDE); } "~" { pyylval->lex.line = yylineno; return TILDE; }
"+" { pyylval->lex.line = yylineno; return(PLUS); } "+" { pyylval->lex.line = yylineno; return PLUS; }
"*" { pyylval->lex.line = yylineno; return(STAR); } "*" { pyylval->lex.line = yylineno; return STAR; }
"/" { pyylval->lex.line = yylineno; return(SLASH); } "/" { pyylval->lex.line = yylineno; return SLASH; }
"%" { pyylval->lex.line = yylineno; return(PERCENT); } "%" { pyylval->lex.line = yylineno; return PERCENT; }
"<" { pyylval->lex.line = yylineno; return(LEFT_ANGLE); } "<" { pyylval->lex.line = yylineno; return LEFT_ANGLE; }
">" { pyylval->lex.line = yylineno; return(RIGHT_ANGLE); } ">" { pyylval->lex.line = yylineno; return RIGHT_ANGLE; }
"|" { pyylval->lex.line = yylineno; return(VERTICAL_BAR); } "|" { pyylval->lex.line = yylineno; return VERTICAL_BAR; }
"^" { pyylval->lex.line = yylineno; return(CARET); } "^" { pyylval->lex.line = yylineno; return CARET; }
"&" { pyylval->lex.line = yylineno; return(AMPERSAND); } "&" { pyylval->lex.line = yylineno; return AMPERSAND; }
"?" { pyylval->lex.line = yylineno; return(QUESTION); } "?" { pyylval->lex.line = yylineno; return QUESTION; }
<FIELDS>{L}({L}|{D})* { <FIELDS>{L}({L}|{D})* {
BEGIN(INITIAL); BEGIN(INITIAL);
...@@ -457,7 +639,7 @@ int yy_input(char* buf, int max_size) ...@@ -457,7 +639,7 @@ int yy_input(char* buf, int max_size)
YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
buf[len] = ' '; buf[len] = ' ';
return len+1; return len+1;
} }
...@@ -469,7 +651,7 @@ int yy_input(char* buf, int max_size) ...@@ -469,7 +651,7 @@ int yy_input(char* buf, int max_size)
// //
int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseContextLocal, const char* preamble) int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseContextLocal, const char* preamble)
{ {
if (!argv || argc == 0) if (!argv || argc == 0)
return 1; return 1;
for (int i = 0; i < argc; ++i) { for (int i = 0; i < argc; ++i) {
...@@ -481,7 +663,7 @@ int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseCon ...@@ -481,7 +663,7 @@ int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseCon
} }
// set up all the cpp fields... // set up all the cpp fields...
cpp->pC = (void*)&parseContextLocal; cpp->pC = (void*)&parseContextLocal;
char *writeablePreamble = 0; char *writeablePreamble = 0;
if (preamble) { if (preamble) {
// preAmble could be a hard-coded string; make writable copy // preAmble could be a hard-coded string; make writable copy
...@@ -531,7 +713,7 @@ int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseCon ...@@ -531,7 +713,7 @@ int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseCon
return 1; return 1;
else else
return 0; return 0;
} }
delete writeablePreamble; delete writeablePreamble;
...@@ -553,21 +735,30 @@ void yyerror(const char *s) ...@@ -553,21 +735,30 @@ void yyerror(const char *s)
} }
} }
int PaReservedWord() void PaReservedWord()
{ {
GlobalParseContext->error(yylineno, "Reserved word.", yytext, "", ""); GlobalParseContext->error(yylineno, "Reserved word.", yytext, "", "");
GlobalParseContext->recover(); GlobalParseContext->recover();
}
return 0; void PaCompatibilityWord(TParseContext& parseContextlocal)
{
if (parseContextlocal.profile != EEsProfile && parseContextlocal.profile != ECompatibilityProfile &&
parseContextlocal.version > 150) {
GlobalParseContext->error(yylineno, "Keyword requires compatibility profile.", yytext, "", "");
GlobalParseContext->recover();
}
} }
int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbol) int PaIdentOrType(const char* yytext, TParseContext& parseContextLocal, YYSTYPE* pyylval)
{ {
symbol = parseContextLocal.symbolTable.find(id); pyylval->lex.string = NewPoolTString(yytext);
if (parseContextLocal.lexAfterType == false && symbol) { pyylval->lex.symbol = parseContextLocal.symbolTable.find(*pyylval->lex.string);
if (TVariable* variable = symbol->getAsVariable()) { if (parseContextLocal.lexAfterType == false && pyylval->lex.symbol) {
if (TVariable* variable = pyylval->lex.symbol->getAsVariable()) {
if (variable->isUserType()) { if (variable->isUserType()) {
parseContextLocal.lexAfterType = true; parseContextLocal.lexAfterType = true;
return TYPE_NAME; return TYPE_NAME;
} }
} }
...@@ -578,89 +769,151 @@ int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbo ...@@ -578,89 +769,151 @@ int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbo
int PaIdentOrReserved(bool reserved, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval) int PaIdentOrReserved(bool reserved, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval)
{ {
if (reserved) pyylval->lex.line = line;
if (reserved) {
PaReservedWord(); PaReservedWord();
pyylval->lex.line = line; return 0;
pyylval->lex.string = NewPoolTString(text); }
if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, yytext, yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future reserved keyword", yylineno); pc.infoSink.info.message(EPrefixWarning, "using future reserved keyword", yylineno);
} }
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol); return PaIdentOrType(text, pc, pyylval);
} }
// For keywords that suddenly showed up on non-ES (not previously reserved)
// but then got reserved by ES 3.0.
int PaES30ReservedFromGLSL(int version, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword) int PaES30ReservedFromGLSL(int version, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)
{ {
pyylval->lex.line = line;
if (pc.profile == EEsProfile && pc.version < 300 || if (pc.profile == EEsProfile && pc.version < 300 ||
pc.profile != EEsProfile && pc.version < version) { pc.profile != EEsProfile && pc.version < version) {
pyylval->lex.line = yylineno;
pyylval->lex.string = NewPoolTString(yytext);
if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, text, yylineno);
pc.infoSink.info.message(EPrefixWarning, "future reserved word in ES 300 and keyword in GLSL", yylineno); pc.infoSink.info.message(EPrefixWarning, "future reserved word in ES 300 and keyword in GLSL", yylineno);
} }
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol); return PaIdentOrType(text, pc, pyylval);
} else if (pc.profile == EEsProfile && pc.version >= 300) } else if (pc.profile == EEsProfile && pc.version >= 300)
PaReservedWord();
return PaReservedWord(); return keyword;
else { }
pyylval->lex.line = yylineno;
return keyword; // For a keyword that was never reserved, until it suddenly
// showed up, both in an es version and a non-ES version.
int PaNonreservedKeyword(int esVersion, int nonEsVersion, TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)
{
pyylval->lex.line = line;
if (pc.profile == EEsProfile && pc.version < esVersion ||
pc.profile != EEsProfile && pc.version < nonEsVersion) {
if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {
pc.infoSink.info.message(EPrefixWarning, text, yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future keyword", yylineno);
}
return PaIdentOrType(text, pc, pyylval);
} }
return keyword;
} }
int PaPrecisionKeyword(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword) int PaPrecisionKeyword(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)
{ {
pyylval->lex.line = line;
if (pc.profile == EEsProfile || pc.version >= 130) if (pc.profile == EEsProfile || pc.version >= 130)
return keyword; return keyword;
pyylval->lex.line = line;
pyylval->lex.string = NewPoolTString(text);
if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, text, yylineno);
pc.infoSink.info.message(EPrefixWarning, "using ES precision qualifier keyword", yylineno); pc.infoSink.info.message(EPrefixWarning, "using ES precision qualifier keyword", yylineno);
} }
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol); return PaIdentOrType(text, pc, pyylval);
} }
int PaMatNxM(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword) int PaMatNxM(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)
{ {
pyylval->lex.line = line;
pc.lexAfterType = true;
if (pc.version > 110) if (pc.version > 110)
return keyword; return keyword;
pyylval->lex.line = line;
pyylval->lex.string = NewPoolTString(text);
if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, text, yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future non-square matrix type keyword", yylineno); pc.infoSink.info.message(EPrefixWarning, "using future non-square matrix type keyword", yylineno);
} }
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol); return PaIdentOrType(text, pc, pyylval);
} }
int PaDMat(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword) int PaDMat(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)
{ {
pyylval->lex.line = line;
pc.lexAfterType = true;
if (pc.profile == EEsProfile && pc.version >= 300) { if (pc.profile == EEsProfile && pc.version >= 300) {
PaReservedWord(); PaReservedWord();
return 0;
return keyword;
} }
if (pc.profile != EEsProfile && pc.version >= 400) if (pc.profile != EEsProfile && pc.version >= 400)
return keyword; return keyword;
if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {
pc.infoSink.info.message(EPrefixWarning, text, yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno);
}
return PaIdentOrType(text, pc, pyylval);
}
int Pa1stGenerationImage(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)
{
pyylval->lex.line = line;
pc.lexAfterType = true;
if (pc.profile != EEsProfile && pc.version >= 420)
return keyword;
if (pc.profile == EEsProfile && pc.version >= 300 ||
pc.profile != EEsProfile && pc.version >= 130) {
PaReservedWord();
return keyword;
}
if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {
pc.infoSink.info.message(EPrefixWarning, text, yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno);
}
return PaIdentOrType(text, pc, pyylval);
}
int Pa2ndGenerationImage(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int keyword)
{
pyylval->lex.line = line; pyylval->lex.line = line;
pyylval->lex.string = NewPoolTString(text); pc.lexAfterType = true;
if (pc.profile != EEsProfile && pc.version >= 420)
return keyword;
if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, text, yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno); pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno);
} }
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol); return PaIdentOrType(text, pc, pyylval);
} }
int PaParseComment(int& lineno, TParseContext& parseContextLocal) int PaParseComment(int& lineno, TParseContext& parseContextLocal)
......
...@@ -1619,24 +1619,24 @@ interpolation_qualifier ...@@ -1619,24 +1619,24 @@ interpolation_qualifier
: SMOOTH { : SMOOTH {
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "smooth")) if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "smooth"))
parseContext.recover(); parseContext.recover();
parseContext.profileRequires($$.line, ENoProfile, 130, 0, "smooth"); parseContext.profileRequires($1.line, ENoProfile, 130, 0, "smooth");
parseContext.profileRequires($$.line, EEsProfile, 300, 0, "smooth"); parseContext.profileRequires($1.line, EEsProfile, 300, 0, "smooth");
$$.init($1.line); $$.init($1.line);
$$.qualifier.smooth = true; $$.qualifier.smooth = true;
} }
| FLAT { | FLAT {
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "flat")) if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "flat"))
parseContext.recover(); parseContext.recover();
parseContext.profileRequires($$.line, ENoProfile, 130, 0, "flat"); parseContext.profileRequires($1.line, ENoProfile, 130, 0, "flat");
parseContext.profileRequires($$.line, EEsProfile, 300, 0, "flat"); parseContext.profileRequires($1.line, EEsProfile, 300, 0, "flat");
$$.init($1.line); $$.init($1.line);
$$.qualifier.flat = true; $$.qualifier.flat = true;
} }
| NOPERSPECTIVE { | NOPERSPECTIVE {
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "noperspective")) if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "noperspective"))
parseContext.recover(); parseContext.recover();
parseContext.requireProfile($$.line, static_cast<EProfileMask>(~EEsProfileMask), "noperspective"); parseContext.requireProfile($1.line, static_cast<EProfileMask>(~EEsProfileMask), "noperspective");
parseContext.profileRequires($$.line, ENoProfile, 130, 0, "noperspective"); parseContext.profileRequires($1.line, ENoProfile, 130, 0, "noperspective");
$$.init($1.line); $$.init($1.line);
$$.qualifier.nopersp = true; $$.qualifier.nopersp = true;
} }
...@@ -1769,8 +1769,8 @@ storage_qualifier ...@@ -1769,8 +1769,8 @@ storage_qualifier
$$.qualifier.storage = EvqOut; $$.qualifier.storage = EvqOut;
} }
| CENTROID { | CENTROID {
parseContext.profileRequires($$.line, ENoProfile, 120, 0, "centroid"); parseContext.profileRequires($1.line, ENoProfile, 120, 0, "centroid");
parseContext.profileRequires($$.line, EEsProfile, 300, 0, "centroid"); parseContext.profileRequires($1.line, EEsProfile, 300, 0, "centroid");
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "centroid")) if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "centroid"))
parseContext.recover(); parseContext.recover();
$$.init($1.line); $$.init($1.line);
...@@ -1801,6 +1801,9 @@ storage_qualifier ...@@ -1801,6 +1801,9 @@ storage_qualifier
$$.qualifier.storage = EvqUniform; // TODO: 4.0 functionality: implement BUFFER $$.qualifier.storage = EvqUniform; // TODO: 4.0 functionality: implement BUFFER
} }
| SHARED { | SHARED {
parseContext.requireProfile($1.line, static_cast<EProfileMask>(~EEsProfileMask), "shared");
parseContext.profileRequires($1.line, ECoreProfile, 430, 0, "shared");
parseContext.requireStage($1.line, EShLangComputeMask, "shared");
$$.init($1.line); $$.init($1.line);
$$.qualifier.shared = true; $$.qualifier.shared = true;
} }
......
...@@ -77,6 +77,7 @@ typedef enum { ...@@ -77,6 +77,7 @@ typedef enum {
EShLangTessEvaluation, EShLangTessEvaluation,
EShLangGeometry, EShLangGeometry,
EShLangFragment, EShLangFragment,
EShLangCompute,
EShLangCount, EShLangCount,
} EShLanguage; } EShLanguage;
...@@ -86,6 +87,7 @@ typedef enum { ...@@ -86,6 +87,7 @@ typedef enum {
EShLangTessEvaluationMask = (1 << EShLangTessEvaluation), EShLangTessEvaluationMask = (1 << EShLangTessEvaluation),
EShLangGeometryMask = (1 << EShLangGeometry), EShLangGeometryMask = (1 << EShLangGeometry),
EShLangFragmentMask = (1 << EShLangFragment), EShLangFragmentMask = (1 << EShLangFragment),
EShLangComputeMask = (1 << EShLangCompute),
} EShLanguageMask; } EShLanguageMask;
extern const char* StageName[EShLangCount]; extern const char* StageName[EShLangCount];
......
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