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)
......
...@@ -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