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)

File diff suppressed because it is too large Load Diff

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];