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
This commit is contained in:
John Kessenich 2013-04-25 16:44:03 +00:00
parent 09da79e190
commit c2ff7702be
13 changed files with 624 additions and 337 deletions

View File

@ -63,4 +63,15 @@ void main()
f |= b; // ERROR
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;

View File

@ -9,6 +9,10 @@ precision highp float;
in vec4 i;
out vec4 o;
in flat float fflat;
in smooth float fsmooth;
in noperspective float fnop;
void main()
{
}

View File

@ -21,14 +21,15 @@ uniform usampler2DArray us2DArray;
in float c1D;
in vec2 c2D;
in vec3 c3D;
in vec4 c4D;
smooth vec4 c4D;
flat in int ic1D;
flat in ivec2 ic2D;
flat in ivec3 ic3D;
flat in ivec4 ic4D;
noperspective in vec4 badv; // ERROR
in sampler2D bads; // ERROR
precision lowp uint; // ERROR
struct s {
int i;
@ -64,4 +65,13 @@ void main()
iv = texelFetch(is2DArray, ic3D, ic1D);
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

View File

@ -5,7 +5,7 @@ uniform mat3x3 m33;
uniform mat4x4 m44;
in vec3 v3;
in vec2 v2;
varying vec2 v2; // ERROR
in vec4 bad[10]; // ERROR

View File

@ -43,3 +43,7 @@ void main()
pos = p * (tblock.M1 + tblock.M2 + M4 + M3 + t2m);
color = c * tblock.N1;
}
shared vec4 compute_only; // ERROR
layout(packed) uniform;

View File

@ -9,4 +9,5 @@ void main()
{
gl_FragColor = varyingVar;
gl_FragData[1] = inVar;
int buffer = 4;
}

View File

@ -13,7 +13,7 @@ int global_medium;
precision highp int;
precision highp ivec2; // ERROR
precision mediump int[2]; // ERROR
precision lowp uint; // ERROR
vec4 uint; // okay
precision mediump vec4; // ERROR
int global_high;

View File

@ -23,7 +23,7 @@ int k = 0x80000000; // k gets -2147483648 == 0x80000000
int l = 2147483648; // l gets -2147483648 (the literal set the sign bit)
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;
vec3 position;

View File

@ -36,7 +36,7 @@
in vec3 color;
out vec4 foo;
uniform sampler2DRect bar;
uniform sampler2DArrayShadow bar;
void main()
{

View File

@ -562,7 +562,8 @@ void TBuiltIns::initialize(int version, EProfile profile)
// Original-style texture Functions existing in both stages.
// (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 texture2DProj(sampler2D, vec3);"));
@ -571,7 +572,8 @@ void TBuiltIns::initialize(int version, EProfile profile)
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 texture1DProj(sampler1D, vec2);"));
@ -585,12 +587,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
s.append(TString("vec4 shadow1DProj(sampler1DShadow, vec4);"));
s.append(TString("vec4 shadow2DProj(sampler2DShadow, vec4);"));
// ARB_texture_rectangle
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);"));
// TODO: functionality: non-ES legacy texuring for Lod, others?
}
s.append(TString("\n"));
@ -988,6 +985,8 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)
continue;
if (dim == EsdRect && version < 140)
continue;
if (dim != Esd2D && ms)
continue;
if ((dim == Esd3D || dim == EsdRect) && arrayed)

View File

@ -66,13 +66,17 @@ LF [lL][fF]
#include "ParseHelper.h"
#include "glslang_tab.cpp.h"
int PaReservedWord();
int PaIdentOrType(TString& id, TParseContext&, TSymbol*&);
void PaReservedWord();
void PaCompatibilityWord(TParseContext&);
int PaIdentOrType(const char* yytext, TParseContext&, 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 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 PaMatNxM(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 */
#ifdef _MSC_VER
@ -100,80 +104,134 @@ int yy_input(char* buf, int max_size);
%option outfile="gen_glslang.cpp"
%x FIELDS
%%
<*>"//"[^\n]*"\n" { /* CPP should have taken care of this */ };
"attribute" { pyylval->lex.line = yylineno; return(ATTRIBUTE); } // TODO: semantics: ES 30 reserved
"const" { pyylval->lex.line = yylineno; return(CONST); }
"uniform" { pyylval->lex.line = yylineno; return(UNIFORM); }
"varying" { pyylval->lex.line = yylineno; return(VARYING); } // TODO: semantics: ES 30 reserved
"buffer" { pyylval->lex.line = yylineno; return(BUFFER); }
"shared" { pyylval->lex.line = yylineno; return(SHARED); }
"attribute" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile && parseContext.version >= 300)
PaReservedWord();
PaCompatibilityWord(parseContext);
return ATTRIBUTE;
}
"const" { pyylval->lex.line = yylineno;
return CONST;
}
"uniform" { pyylval->lex.line = yylineno;
return UNIFORM;
}
"varying" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile && parseContext.version >= 300)
PaReservedWord();
PaCompatibilityWord(parseContext);
return VARYING;
}
"buffer" { pyylval->lex.line = yylineno;
if (parseContext.version < 430)
return PaIdentOrType(yytext, parseContext, pyylval);
return BUFFER;
}
"shared" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
parseContext.profile != EEsProfile && parseContext.version < 140)
return PaIdentOrType(yytext, parseContext, pyylval);
return SHARED;
}
"coherent" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, COHERENT); }
"volatile" { if (parseContext.profile == EEsProfile || parseContext.version < 420)
return PaReservedWord();
else
pyylval->lex.line = yylineno; return(VOLATILE);
"volatile" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile || parseContext.version < 420)
PaReservedWord();
return VOLATILE;
}
"restrict" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, RESTRICT); }
"readonly" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, READONLY); }
"writeonly" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, WRITEONLY); }
"layout" { pyylval->lex.line = yylineno; return(LAYOUT); }
"centroid" { pyylval->lex.line = yylineno; return(CENTROID); }
"flat" { pyylval->lex.line = yylineno; return(FLAT); }
"smooth" { pyylval->lex.line = yylineno; return(SMOOTH); }
"noperspective" { pyylval->lex.line = yylineno; return(NOPERSPECTIVE); }
"layout" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
parseContext.profile != EEsProfile && parseContext.version < 140)
return PaIdentOrType(yytext, parseContext, pyylval);
return LAYOUT;
}
"centroid" { pyylval->lex.line = yylineno;
if (parseContext.version < 120)
return PaIdentOrType(yytext, parseContext, pyylval);
return CENTROID;
}
"flat" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile && parseContext.version < 300)
PaReservedWord();
else if (parseContext.profile != EEsProfile && parseContext.version < 130)
return PaIdentOrType(yytext, parseContext, pyylval);
return FLAT;
}
"smooth" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
parseContext.profile != EEsProfile && parseContext.version < 130)
return PaIdentOrType(yytext, parseContext, pyylval);
return SMOOTH;
}
"noperspective" { return PaES30ReservedFromGLSL(130, parseContext, yylineno, yytext, pyylval, NOPERSPECTIVE); }
"patch" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, PATCH); }
"sample" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, SAMPLE); }
"break" { pyylval->lex.line = yylineno; return(BREAK); }
"continue" { pyylval->lex.line = yylineno; return(CONTINUE); }
"do" { pyylval->lex.line = yylineno; return(DO); }
"for" { pyylval->lex.line = yylineno; return(FOR); }
"while" { pyylval->lex.line = yylineno; return(WHILE); }
"switch" { pyylval->lex.line = yylineno; return(SWITCH); }
"case" { pyylval->lex.line = yylineno; return(CASE); }
"default" { pyylval->lex.line = yylineno; return(DEFAULT); }
"break" { pyylval->lex.line = yylineno; return BREAK; }
"continue" { pyylval->lex.line = yylineno; return CONTINUE; }
"do" { pyylval->lex.line = yylineno; return DO; }
"for" { pyylval->lex.line = yylineno; return FOR; }
"while" { pyylval->lex.line = yylineno; return WHILE; }
"switch" { pyylval->lex.line = yylineno; return SWITCH; }
"case" { pyylval->lex.line = yylineno; return CASE; }
"default" { pyylval->lex.line = yylineno; return DEFAULT; }
"if" { pyylval->lex.line = yylineno; return(IF); }
"else" { pyylval->lex.line = yylineno; return(ELSE); }
"if" { pyylval->lex.line = yylineno; return IF; }
"else" { pyylval->lex.line = yylineno; return ELSE; }
"subroutine" { return PaES30ReservedFromGLSL(400, parseContext, yylineno, yytext, pyylval, SUBROUTINE); }
"in" { pyylval->lex.line = yylineno; return(IN); }
"out" { pyylval->lex.line = yylineno; return(OUT); }
"inout" { pyylval->lex.line = yylineno; return(INOUT); }
"in" { pyylval->lex.line = yylineno; return IN; }
"out" { pyylval->lex.line = yylineno; return OUT; }
"inout" { pyylval->lex.line = yylineno; return INOUT; }
"precise" { pyylval->lex.line = yylineno; return(PRECISE); }
"invariant" { pyylval->lex.line = yylineno; return(INVARIANT); }
"precise" { pyylval->lex.line = yylineno;
if (parseContext.profile == EEsProfile ||
parseContext.profile != EEsProfile && parseContext.version < 400)
return PaIdentOrType(yytext, parseContext, pyylval);
return PRECISE;
}
"invariant" { pyylval->lex.line = yylineno;;
if (parseContext.profile != EEsProfile && parseContext.version < 120)
return PaIdentOrType(yytext, parseContext, pyylval);
return INVARIANT;
}
"highp" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, HIGH_PRECISION); }
"mediump" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, MEDIUM_PRECISION); }
"lowp" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, LOW_PRECISION); }
"precision" { return PaPrecisionKeyword(parseContext, yylineno, yytext, pyylval, PRECISION); }
"float" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(FLOAT); }
"double" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(DOUBLE); }
"int" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(INT); }
"uint" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UINT); }
"void" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(VOID); }
"bool" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(BOOL); }
"true" { pyylval->lex.line = yylineno; pyylval->lex.b = true; return(BOOLCONSTANT); }
"false" { pyylval->lex.line = yylineno; pyylval->lex.b = false; return(BOOLCONSTANT); }
"float" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return FLOAT; }
"double" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
PaReservedWord();
return DOUBLE;
}
"int" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return INT; }
"uint" { parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, UINT);
}
"void" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return VOID; }
"bool" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return BOOL; }
"true" { pyylval->lex.line = yylineno; pyylval->lex.b = true; return BOOLCONSTANT; }
"false" { pyylval->lex.line = yylineno; pyylval->lex.b = false; return BOOLCONSTANT; }
"discard" { pyylval->lex.line = yylineno; return(DISCARD); }
"return" { pyylval->lex.line = yylineno; return(RETURN); }
"discard" { pyylval->lex.line = yylineno; return DISCARD; }
"return" { pyylval->lex.line = yylineno; return RETURN; }
"atomic_uint" { return PaES30ReservedFromGLSL(420, parseContext, yylineno, yytext, pyylval, ATOMIC_UINT); }
"mat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT2); }
"mat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT3); }
"mat4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(MAT4); }
"mat2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return MAT2; }
"mat3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return MAT3; }
"mat4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return MAT4; }
"mat2x2" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X2); }
"mat2x3" { return PaMatNxM(parseContext, yylineno, yytext, pyylval, MAT2X3); }
@ -197,116 +255,241 @@ int yy_input(char* buf, int max_size);
"dmat4x3" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X3); }
"dmat4x4" { return PaDMat(parseContext, yylineno, yytext, pyylval, DMAT4X4); }
"vec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC2); }
"vec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (VEC3); }
"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); }
"dvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (DVEC4); }
"ivec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC2); }
"ivec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC3); }
"ivec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (IVEC4); }
"uvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC2); }
"uvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC3); }
"uvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (UVEC4); }
"bvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC2); }
"bvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC3); }
"bvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return (BVEC4); }
"vec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return VEC2; }
"vec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return VEC3; }
"vec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return VEC4; }
"dvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
PaReservedWord();
return DVEC2;
}
"dvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
PaReservedWord();
return DVEC3;
}
"dvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
PaReservedWord();
return DVEC4;
}
"ivec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return IVEC2; }
"ivec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return IVEC3; }
"ivec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return IVEC4; }
"uvec2" { parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, UVEC2);
}
"uvec3" { parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, UVEC3);
}
"uvec4" { parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, UVEC4);
}
"bvec2" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return BVEC2; }
"bvec3" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return BVEC3; }
"bvec4" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return BVEC4; }
"sampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1D; }
"sampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2D; }
"sampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER3D; }
"samplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBE; }
"sampler1DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DSHADOW; }
"sampler2DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DSHADOW; }
"sampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DRECT; }
"isampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2DRECT; }
"usampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2DRECT; }
"sampler2DRectShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DRECTSHADOW; }
"sampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile)
PaReservedWord();
return SAMPLER1D;
}
"sampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile && parseContext.version < 300)
PaReservedWord();
return SAMPLER3D;
}
"sampler1DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile)
PaReservedWord();
return SAMPLER1DSHADOW;
}
"sampler2DShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile && parseContext.version < 300)
PaReservedWord();
return SAMPLER2DSHADOW;
}
"sampler2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile ||
parseContext.profile != EEsProfile && parseContext.version < 140)
PaReservedWord();
return SAMPLER2DRECT;
}
"sampler2DRectShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile ||
parseContext.profile != EEsProfile && parseContext.version < 140)
PaReservedWord();
return SAMPLER2DRECTSHADOW;
}
"samplerCubeShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, SAMPLERCUBESHADOW);
}
"sampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile && parseContext.version == 300)
PaReservedWord();
else if (parseContext.profile == EEsProfile && parseContext.version < 300 ||
parseContext.profile != EEsProfile && parseContext.version < 130)
return PaIdentOrType(yytext, parseContext, pyylval);
return SAMPLER1DARRAY;
}
"sampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, SAMPLER2DARRAY);
}
"sampler2DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
return PaNonreservedKeyword(300, 130, parseContext, yylineno, yytext, pyylval, SAMPLER2DARRAYSHADOW);
}
"samplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
if (parseContext.profile == EEsProfile || parseContext.version < 400)
return PaIdentOrType(yytext, parseContext, pyylval);
return SAMPLERCUBEARRAY;
}
"sampler1DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true;
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); }
"samplerCubeShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBESHADOW; }
"sampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DARRAY; }
"sampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DARRAY; }
"samplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBEARRAY; }
"sampler1DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER1DARRAYSHADOW; }
"sampler2DArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLER2DARRAYSHADOW; }
"samplerCubeArrayShadow" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return SAMPLERCUBEARRAYSHADOW; }
"isampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER1D; }
"isampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2D; }
"isampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER3D; }
"isamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLERCUBE; }
"isamplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLERCUBEARRAY; }
"isampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER1DARRAY; }
"isampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return ISAMPLER2DARRAY; }
"usampler1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER1D; }
"usampler2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2D; }
"usampler3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER3D; }
"usamplerCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLERCUBE; }
"usamplerCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLERCUBEARRAY; }
"usampler1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER1DARRAY; }
"usampler2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return USAMPLER2DARRAY; }
"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); }
"samplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLERBUFFER); }
"isamplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLERBUFFER); }
"usamplerBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLERBUFFER); }
"sampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLER2DMS); }
"isampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLER2DMS); }
"usampler2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLER2DMS); }
"sampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(SAMPLER2DMSARRAY); }
"isampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(ISAMPLER2DMSARRAY); }
"usampler2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(USAMPLER2DMSARRAY); }
"image1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE1D); }
"iimage1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE1D); }
"uimage1D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE1D); }
"image2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2D); }
"iimage2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2D); }
"uimage2D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2D); }
"image3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE3D); }
"iimage3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE3D); }
"uimage3D" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE3D); }
"image2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2DRECT); }
"iimage2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2DRECT); }
"uimage2DRect" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2DRECT); }
"imageCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGECUBE); }
"iimageCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGECUBE); }
"uimageCube" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGECUBE); }
"imageBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGEBUFFER); }
"iimageBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGEBUFFER); }
"uimageBuffer" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGEBUFFER); }
"image1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE1DARRAY); }
"iimage1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE1DARRAY); }
"uimage1DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE1DARRAY); }
"image2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2DARRAY); }
"iimage2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2DARRAY); }
"uimage2DArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2DARRAY); }
"imageCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGECUBEARRAY); }
"iimageCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGECUBEARRAY); }
"uimageCubeArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGECUBEARRAY); }
"image2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2DMS); }
"iimage2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2DMS); }
"uimage2DMS" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2DMS); }
"image2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IMAGE2DMSARRAY); }
"iimage2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(IIMAGE2DMSARRAY); }
"uimage2DMSArray" { pyylval->lex.line = yylineno; parseContext.lexAfterType = true; return(UIMAGE2DMSARRAY); }
"struct" { pyylval->lex.line = yylineno; return(STRUCT); }
"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" { PaReservedWord(); return 0; }
"resource" { if (parseContext.profile == EEsProfile && parseContext.version >= 300 ||
parseContext.profile != EEsProfile && parseContext.version >= 420)
return PaReservedWord();
"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; }
@ -323,9 +506,9 @@ int yy_input(char* buf, int max_size);
"fixed" { PaReservedWord(); return 0; }
"unsigned" { PaReservedWord(); return 0; }
"superp" { bool reserved = (parseContext.profile == EEsProfile || parseContext.version >= 130);
return PaIdentOrReserved(reserved, parseContext, yylineno, yytext, pyylval); }
"superp" { bool reserved = parseContext.profile == EEsProfile || parseContext.version >= 130;
return PaIdentOrReserved(reserved, parseContext, yylineno, yytext, pyylval);
}
"input" { PaReservedWord(); return 0; }
"output" { PaReservedWord(); return 0; }
@ -348,78 +531,77 @@ int yy_input(char* buf, int max_size);
{L}({L}|{D})* {
pyylval->lex.line = yylineno;
pyylval->lex.string = NewPoolTString(yytext);
return PaIdentOrType(*pyylval->lex.string, parseContext, pyylval->lex.symbol);
return PaIdentOrType(yytext, parseContext, pyylval);
}
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[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{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{O}+{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{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}+{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}+{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}+({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}+{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}+{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}+({E})?{LF} { pyylval->lex.line = yylineno; pyylval->lex.d = atof(yytext); return DOUBLECONSTANT; }
"/*" { int ret = PaParseComment(pyylval->lex.line, parseContext); if (!ret) return ret; }
"+=" { pyylval->lex.line = yylineno; return(ADD_ASSIGN); }
"-=" { pyylval->lex.line = yylineno; return(SUB_ASSIGN); }
"*=" { pyylval->lex.line = yylineno; return(MUL_ASSIGN); }
"/=" { pyylval->lex.line = yylineno; return(DIV_ASSIGN); }
"%=" { pyylval->lex.line = yylineno; return(MOD_ASSIGN); }
"<<=" { pyylval->lex.line = yylineno; return(LEFT_ASSIGN); }
">>=" { pyylval->lex.line = yylineno; return(RIGHT_ASSIGN); }
"&=" { pyylval->lex.line = yylineno; return(AND_ASSIGN); }
"^=" { pyylval->lex.line = yylineno; return(XOR_ASSIGN); }
"|=" { pyylval->lex.line = yylineno; return(OR_ASSIGN); }
"+=" { pyylval->lex.line = yylineno; return ADD_ASSIGN; }
"-=" { pyylval->lex.line = yylineno; return SUB_ASSIGN; }
"*=" { pyylval->lex.line = yylineno; return MUL_ASSIGN; }
"/=" { pyylval->lex.line = yylineno; return DIV_ASSIGN; }
"%=" { pyylval->lex.line = yylineno; return MOD_ASSIGN; }
"<<=" { pyylval->lex.line = yylineno; return LEFT_ASSIGN; }
">>=" { pyylval->lex.line = yylineno; return RIGHT_ASSIGN; }
"&=" { pyylval->lex.line = yylineno; return AND_ASSIGN; }
"^=" { pyylval->lex.line = yylineno; return XOR_ASSIGN; }
"|=" { pyylval->lex.line = yylineno; return OR_ASSIGN; }
"++" { pyylval->lex.line = yylineno; return(INC_OP); }
"--" { pyylval->lex.line = yylineno; return(DEC_OP); }
"&&" { pyylval->lex.line = yylineno; return(AND_OP); }
"||" { pyylval->lex.line = yylineno; return(OR_OP); }
"^^" { pyylval->lex.line = yylineno; return(XOR_OP); }
"<=" { pyylval->lex.line = yylineno; return(LE_OP); }
">=" { pyylval->lex.line = yylineno; return(GE_OP); }
"==" { pyylval->lex.line = yylineno; return(EQ_OP); }
"!=" { pyylval->lex.line = yylineno; return(NE_OP); }
"<<" { pyylval->lex.line = yylineno; return(LEFT_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(LEFT_BRACE); }
("}"|"%>") { pyylval->lex.line = yylineno; return(RIGHT_BRACE); }
"," { pyylval->lex.line = yylineno; if (parseContext.inTypeParen) parseContext.lexAfterType = false; return(COMMA); }
":" { pyylval->lex.line = yylineno; return(COLON); }
"=" { 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.inTypeParen = false; return(RIGHT_PAREN); }
("["|"<:") { pyylval->lex.line = yylineno; return(LEFT_BRACKET); }
("]"|":>") { pyylval->lex.line = yylineno; return(RIGHT_BRACKET); }
"." { BEGIN(FIELDS); return(DOT); }
"!" { pyylval->lex.line = yylineno; return(BANG); }
"-" { pyylval->lex.line = yylineno; return(DASH); }
"~" { pyylval->lex.line = yylineno; return(TILDE); }
"+" { pyylval->lex.line = yylineno; return(PLUS); }
"*" { pyylval->lex.line = yylineno; return(STAR); }
"/" { pyylval->lex.line = yylineno; return(SLASH); }
"%" { pyylval->lex.line = yylineno; return(PERCENT); }
"<" { pyylval->lex.line = yylineno; return(LEFT_ANGLE); }
">" { pyylval->lex.line = yylineno; return(RIGHT_ANGLE); }
"|" { pyylval->lex.line = yylineno; return(VERTICAL_BAR); }
"^" { pyylval->lex.line = yylineno; return(CARET); }
"&" { pyylval->lex.line = yylineno; return(AMPERSAND); }
"?" { pyylval->lex.line = yylineno; return(QUESTION); }
"++" { pyylval->lex.line = yylineno; return INC_OP; }
"--" { pyylval->lex.line = yylineno; return DEC_OP; }
"&&" { pyylval->lex.line = yylineno; return AND_OP; }
"||" { pyylval->lex.line = yylineno; return OR_OP; }
"^^" { pyylval->lex.line = yylineno; return XOR_OP; }
"<=" { pyylval->lex.line = yylineno; return LE_OP; }
">=" { pyylval->lex.line = yylineno; return GE_OP; }
"==" { pyylval->lex.line = yylineno; return EQ_OP; }
"!=" { pyylval->lex.line = yylineno; return NE_OP; }
"<<" { pyylval->lex.line = yylineno; return LEFT_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 LEFT_BRACE; }
("}"|"%>") { pyylval->lex.line = yylineno; return RIGHT_BRACE; }
"," { pyylval->lex.line = yylineno; if (parseContext.inTypeParen) parseContext.lexAfterType = false; return COMMA; }
":" { pyylval->lex.line = yylineno; return COLON; }
"=" { 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.inTypeParen = false; return RIGHT_PAREN; }
("["|"<:") { pyylval->lex.line = yylineno; return LEFT_BRACKET; }
("]"|":>") { pyylval->lex.line = yylineno; return RIGHT_BRACKET; }
"." { BEGIN(FIELDS); return DOT; }
"!" { pyylval->lex.line = yylineno; return BANG; }
"-" { pyylval->lex.line = yylineno; return DASH; }
"~" { pyylval->lex.line = yylineno; return TILDE; }
"+" { pyylval->lex.line = yylineno; return PLUS; }
"*" { pyylval->lex.line = yylineno; return STAR; }
"/" { pyylval->lex.line = yylineno; return SLASH; }
"%" { pyylval->lex.line = yylineno; return PERCENT; }
"<" { pyylval->lex.line = yylineno; return LEFT_ANGLE; }
">" { pyylval->lex.line = yylineno; return RIGHT_ANGLE; }
"|" { pyylval->lex.line = yylineno; return VERTICAL_BAR; }
"^" { pyylval->lex.line = yylineno; return CARET; }
"&" { pyylval->lex.line = yylineno; return AMPERSAND; }
"?" { pyylval->lex.line = yylineno; return QUESTION; }
<FIELDS>{L}({L}|{D})* {
BEGIN(INITIAL);
@ -553,21 +735,30 @@ void yyerror(const char *s)
}
}
int PaReservedWord()
void PaReservedWord()
{
GlobalParseContext->error(yylineno, "Reserved word.", yytext, "", "");
GlobalParseContext->recover();
return 0;
}
int PaIdentOrType(TString& id, TParseContext& parseContextLocal, TSymbol*& symbol)
void PaCompatibilityWord(TParseContext& parseContextlocal)
{
symbol = parseContextLocal.symbolTable.find(id);
if (parseContextLocal.lexAfterType == false && symbol) {
if (TVariable* variable = symbol->getAsVariable()) {
if (parseContextlocal.profile != EEsProfile && parseContextlocal.profile != ECompatibilityProfile &&
parseContextlocal.version > 150) {
GlobalParseContext->error(yylineno, "Keyword requires compatibility profile.", yytext, "", "");
GlobalParseContext->recover();
}
}
int PaIdentOrType(const char* yytext, TParseContext& parseContextLocal, YYSTYPE* pyylval)
{
pyylval->lex.string = NewPoolTString(yytext);
pyylval->lex.symbol = parseContextLocal.symbolTable.find(*pyylval->lex.string);
if (parseContextLocal.lexAfterType == false && pyylval->lex.symbol) {
if (TVariable* variable = pyylval->lex.symbol->getAsVariable()) {
if (variable->isUserType()) {
parseContextLocal.lexAfterType = true;
return TYPE_NAME;
}
}
@ -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)
{
if (reserved)
pyylval->lex.line = line;
if (reserved) {
PaReservedWord();
pyylval->lex.line = line;
pyylval->lex.string = NewPoolTString(text);
return 0;
}
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);
}
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)
{
pyylval->lex.line = line;
if (pc.profile == EEsProfile && pc.version < 300 ||
pc.profile != EEsProfile && pc.version < version) {
pyylval->lex.line = yylineno;
pyylval->lex.string = NewPoolTString(yytext);
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);
}
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol);
return PaIdentOrType(text, pc, pyylval);
} else if (pc.profile == EEsProfile && pc.version >= 300)
return PaReservedWord();
else {
pyylval->lex.line = yylineno;
PaReservedWord();
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)
{
pyylval->lex.line = line;
if (pc.profile == EEsProfile || pc.version >= 130)
return keyword;
pyylval->lex.line = line;
pyylval->lex.string = NewPoolTString(text);
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);
}
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)
{
pyylval->lex.line = line;
pc.lexAfterType = true;
if (pc.version > 110)
return keyword;
pyylval->lex.line = line;
pyylval->lex.string = NewPoolTString(text);
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);
}
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)
{
pyylval->lex.line = line;
pc.lexAfterType = true;
if (pc.profile == EEsProfile && pc.version >= 300) {
PaReservedWord();
return 0;
return keyword;
}
if (pc.profile != EEsProfile && pc.version >= 400)
return keyword;
pyylval->lex.line = line;
pyylval->lex.string = NewPoolTString(text);
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);
}
return PaIdentOrType(*pyylval->lex.string, pc, pyylval->lex.symbol);
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;
pc.lexAfterType = true;
if (pc.profile != EEsProfile && pc.version >= 420)
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 PaParseComment(int& lineno, TParseContext& parseContextLocal)

View File

@ -1619,24 +1619,24 @@ interpolation_qualifier
: SMOOTH {
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "smooth"))
parseContext.recover();
parseContext.profileRequires($$.line, ENoProfile, 130, 0, "smooth");
parseContext.profileRequires($$.line, EEsProfile, 300, 0, "smooth");
parseContext.profileRequires($1.line, ENoProfile, 130, 0, "smooth");
parseContext.profileRequires($1.line, EEsProfile, 300, 0, "smooth");
$$.init($1.line);
$$.qualifier.smooth = true;
}
| FLAT {
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "flat"))
parseContext.recover();
parseContext.profileRequires($$.line, ENoProfile, 130, 0, "flat");
parseContext.profileRequires($$.line, EEsProfile, 300, 0, "flat");
parseContext.profileRequires($1.line, ENoProfile, 130, 0, "flat");
parseContext.profileRequires($1.line, EEsProfile, 300, 0, "flat");
$$.init($1.line);
$$.qualifier.flat = true;
}
| NOPERSPECTIVE {
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "noperspective"))
parseContext.recover();
parseContext.requireProfile($$.line, static_cast<EProfileMask>(~EEsProfileMask), "noperspective");
parseContext.profileRequires($$.line, ENoProfile, 130, 0, "noperspective");
parseContext.requireProfile($1.line, static_cast<EProfileMask>(~EEsProfileMask), "noperspective");
parseContext.profileRequires($1.line, ENoProfile, 130, 0, "noperspective");
$$.init($1.line);
$$.qualifier.nopersp = true;
}
@ -1769,8 +1769,8 @@ storage_qualifier
$$.qualifier.storage = EvqOut;
}
| CENTROID {
parseContext.profileRequires($$.line, ENoProfile, 120, 0, "centroid");
parseContext.profileRequires($$.line, EEsProfile, 300, 0, "centroid");
parseContext.profileRequires($1.line, ENoProfile, 120, 0, "centroid");
parseContext.profileRequires($1.line, EEsProfile, 300, 0, "centroid");
if (parseContext.globalErrorCheck($1.line, parseContext.symbolTable.atGlobalLevel(), "centroid"))
parseContext.recover();
$$.init($1.line);
@ -1801,6 +1801,9 @@ storage_qualifier
$$.qualifier.storage = EvqUniform; // TODO: 4.0 functionality: implement BUFFER
}
| 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);
$$.qualifier.shared = true;
}

View File

@ -77,6 +77,7 @@ typedef enum {
EShLangTessEvaluation,
EShLangGeometry,
EShLangFragment,
EShLangCompute,
EShLangCount,
} EShLanguage;
@ -86,6 +87,7 @@ typedef enum {
EShLangTessEvaluationMask = (1 << EShLangTessEvaluation),
EShLangGeometryMask = (1 << EShLangGeometry),
EShLangFragmentMask = (1 << EShLangFragment),
EShLangComputeMask = (1 << EShLangCompute),
} EShLanguageMask;
extern const char* StageName[EShLangCount];