Implement write-only semantic checking, the non-r32f/i/u readonly/writeonly check, and ES 3.1 support of volatile. Also, fix a typo in MaxComputeGroupY.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27765 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-08-19 20:32:48 +00:00
parent bd2d8fb004
commit da66bc7d29
10 changed files with 595 additions and 154 deletions

View File

@ -142,7 +142,7 @@ const char* DefaultConfig =
"MaxComputeWorkGroupCountY 65535\n" "MaxComputeWorkGroupCountY 65535\n"
"MaxComputeWorkGroupCountZ 65535\n" "MaxComputeWorkGroupCountZ 65535\n"
"MaxComputeWorkGroupSizeX 1024\n" "MaxComputeWorkGroupSizeX 1024\n"
"MaxComputeWorkGroupSizeX 1024\n" "MaxComputeWorkGroupSizeY 1024\n"
"MaxComputeWorkGroupSizeZ 64\n" "MaxComputeWorkGroupSizeZ 64\n"
"MaxComputeUniformComponents 1024\n" "MaxComputeUniformComponents 1024\n"
"MaxComputeTextureImageUnits 16\n" "MaxComputeTextureImageUnits 16\n"

View File

@ -77,8 +77,8 @@ uniform iimage2DArray ii2dabad; // ERROR, not writeonly
uniform writeonly iimage2DArray ii2da; uniform writeonly iimage2DArray ii2da;
layout(r32i) uniform iimage2D iimg2D; layout(r32i) uniform iimage2D iimg2D;
layout(rgba32i) uniform iimage2D iimg2Drgba; layout(rgba32i) uniform readonly iimage2D iimg2Drgba;
layout(rgba32f) uniform image2D img2Drgba; layout(rgba32f) uniform readonly image2D img2Drgba;
layout(r32ui) uniform uimage2D uimg2D; layout(r32ui) uniform uimage2D uimg2D;
void qux() void qux()
@ -111,12 +111,12 @@ void passrc()
passr(iimg2D); passr(iimg2D);
} }
layout(rg8i) uniform uimage2D i1bad; // ERROR, type mismatch layout(rg8i) uniform readonly uimage2D i1bad; // ERROR, type mismatch
layout(rgba32i) uniform image2D i2bad; // ERROR, type mismatch layout(rgba32i) uniform readonly image2D i2bad; // ERROR, type mismatch
layout(rgba32f) uniform uimage2D i3bad; // ERROR, type mismatch layout(rgba32f) uniform readonly uimage2D i3bad; // ERROR, type mismatch
layout(r8_snorm) uniform iimage2D i4bad; // ERROR, type mismatch layout(r8_snorm) uniform readonly iimage2D i4bad; // ERROR, type mismatch
layout(rgba32ui) uniform iimage2D i5bad; // ERROR, type mismatch layout(rgba32ui) uniform readonly iimage2D i5bad; // ERROR, type mismatch
layout(r8ui) uniform iimage2D i6bad; // ERROR, type mismatch layout(r8ui) uniform readonly iimage2D i6bad; // ERROR, type mismatch
layout(binding = 0) uniform atomic_uint counter; layout(binding = 0) uniform atomic_uint counter;
@ -146,7 +146,7 @@ uniform int i;
void opac() void opac()
{ {
int a[3]; int a[3];
a[counter]; // ERROR a[counter]; // ERROR, non-integer
countArr[2]; countArr[2];
countArr[i]; countArr[i];
} }
@ -172,3 +172,54 @@ uniform samplerCubeArray sca; // ERROR
uniform iimage2DRect i2dr; // ERROR uniform iimage2DRect i2dr; // ERROR
uniform image2DMS i2dms; // ERROR uniform image2DMS i2dms; // ERROR
uniform uimage2DMSArray u2dmsa; // ERROR uniform uimage2DMSArray u2dmsa; // ERROR
layout(r32f) coherent volatile restrict readonly writeonly uniform image2D okay1;
layout(r32i) coherent volatile restrict readonly uniform iimage2D okay2;
layout(r32ui) coherent volatile restrict writeonly uniform uimage2D okay3;
layout(r32f) coherent volatile restrict uniform image2D okay4;
layout(rgba32f) coherent volatile restrict uniform image2D badQ1; // ERROR, bad qualifiers
layout(rgba8i) coherent volatile restrict uniform iimage2D badQ2; // ERROR, bad qualifiers
layout(rgba16ui) coherent volatile restrict uniform uimage2D badQ3; // ERROR, bad qualifiers
writeonly buffer woblock
{
int value;
float values[];
} wo;
void foowo()
{
float g;
g = wo.values[2]; // ERROR, writeonly
float f = wo.values[2]; // ERROR, writeonly
++wo.values[2]; // ERROR, writeonly
wo.values[2]--; // ERROR, writeonly
f + wo.values[2]; // ERROR, writeonly
wo.values[2] - f; // ERROR, writeonly
bool b;
b ? f : wo.values[2]; // ERROR, writeonly
b ? wo.values[2] : f; // ERROR, writeonly
if (f == wo.values[2]) // ERROR, writeonly
++f;
if (f >= wo.values[2]) // ERROR, writeonly
++f;
f = vec3(wo.values[2]).x; // ERROR, writeonly
~wo.value; // ERROR, writeonly
wo.values[2] = 3.4;
}
buffer multioblock
{
readonly int value;
writeonly float values[];
} multio;
void foomultio()
{
float g;
g = wo.values[2]; // ERROR, writeonly
~wo.value;
wo.values[2] = 3.4;
wo.value = 2; // ERROR, readonly
}

View File

@ -22,7 +22,6 @@ ERROR: 0:88: 'imageAtomicAdd' : no matching overloaded function found
ERROR: 0:89: 'imageAtomicMin' : no matching overloaded function found ERROR: 0:89: 'imageAtomicMin' : no matching overloaded function found
ERROR: 0:90: 'imageAtomicMax' : no matching overloaded function found ERROR: 0:90: 'imageAtomicMax' : no matching overloaded function found
ERROR: 0:94: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:94: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter
ERROR: 0:97: 'volatile' : Reserved word.
ERROR: 0:97: '' : memory qualifiers cannot be used on this type ERROR: 0:97: '' : memory qualifiers cannot be used on this type
ERROR: 0:98: '' : memory qualifiers cannot be used on this type ERROR: 0:98: '' : memory qualifiers cannot be used on this type
ERROR: 0:110: 'restrict' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:110: 'restrict' : argument cannot drop memory qualifier when passed to formal parameter
@ -57,7 +56,24 @@ ERROR: 0:173: '' : image variables not declared 'writeonly' must have a format l
ERROR: 0:174: 'uimage2DMSArray' : Reserved word. ERROR: 0:174: 'uimage2DMSArray' : Reserved word.
ERROR: 0:174: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:174: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:174: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:174: '' : image variables not declared 'writeonly' must have a format layout qualifier
ERROR: 57 compilation errors. No code generated. ERROR: 0:181: 'rgba32f' : format requires readonly or writeonly memory qualifier
ERROR: 0:182: 'rgba8i' : format requires readonly or writeonly memory qualifier
ERROR: 0:183: 'rgba16ui' : format requires readonly or writeonly memory qualifier
ERROR: 0:194: 'assign' : can't read from writeonly object: wo
ERROR: 0:195: 'initializer' : can't read from writeonly object: wo
ERROR: 0:196: '++' : can't read from writeonly object: wo
ERROR: 0:197: '--' : can't read from writeonly object: wo
ERROR: 0:198: '+' : can't read from writeonly object: wo
ERROR: 0:199: '-' : can't read from writeonly object: wo
ERROR: 0:201: ':' : can't read from writeonly object: wo
ERROR: 0:202: ':' : can't read from writeonly object: wo
ERROR: 0:203: '==' : can't read from writeonly object: wo
ERROR: 0:205: '>=' : can't read from writeonly object: wo
ERROR: 0:207: 'constructor' : can't read from writeonly object: wo
ERROR: 0:208: '~' : can't read from writeonly object: wo
ERROR: 0:221: 'assign' : can't read from writeonly object: wo
ERROR: 0:222: '~' : can't read from writeonly object: wo
ERROR: 73 compilation errors. No code generated.
Shader version: 310 Shader version: 310
@ -141,7 +157,7 @@ ERROR: node is still EOpNull!
0:92 0 (const int) 0:92 0 (const int)
0:92 0 (const int) 0:92 0 (const int)
0:93 Function Call: imageLoad(I21;vi2; (highp 4-component vector of float) 0:93 Function Call: imageLoad(I21;vi2; (highp 4-component vector of float)
0:93 'img2Drgba' (layout(rgba32f ) uniform lowp image2D) 0:93 'img2Drgba' (layout(rgba32f ) readonly uniform lowp image2D)
0:93 Construct ivec2 (2-component vector of int) 0:93 Construct ivec2 (2-component vector of int)
0:93 'i' (highp int) 0:93 'i' (highp int)
0:93 'i' (highp int) 0:93 'i' (highp int)
@ -233,6 +249,178 @@ ERROR: node is still EOpNull!
0:162 10 (const uint) 0:162 10 (const uint)
0:162 Constant: 0:162 Constant:
0:162 8 (const uint) 0:162 8 (const uint)
0:191 Function Definition: foowo( (void)
0:191 Function Parameters:
0:? Sequence
0:194 move second child to first child (highp float)
0:194 'g' (highp float)
0:194 direct index (layout(column_major shared ) highp float)
0:194 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:194 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:194 Constant:
0:194 1 (const int)
0:194 Constant:
0:194 2 (const int)
0:195 Sequence
0:195 move second child to first child (highp float)
0:195 'f' (highp float)
0:195 direct index (layout(column_major shared ) highp float)
0:195 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:195 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:195 Constant:
0:195 1 (const int)
0:195 Constant:
0:195 2 (const int)
0:196 Pre-Increment (highp float)
0:196 direct index (layout(column_major shared ) highp float)
0:196 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:196 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:196 Constant:
0:196 1 (const int)
0:196 Constant:
0:196 2 (const int)
0:197 Post-Decrement (highp float)
0:197 direct index (layout(column_major shared ) highp float)
0:197 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:197 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:197 Constant:
0:197 1 (const int)
0:197 Constant:
0:197 2 (const int)
0:198 add (highp float)
0:198 'f' (highp float)
0:198 direct index (layout(column_major shared ) highp float)
0:198 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:198 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:198 Constant:
0:198 1 (const int)
0:198 Constant:
0:198 2 (const int)
0:199 subtract (highp float)
0:199 direct index (layout(column_major shared ) highp float)
0:199 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:199 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:199 Constant:
0:199 1 (const int)
0:199 Constant:
0:199 2 (const int)
0:199 'f' (highp float)
0:201 Test condition and select (highp float)
0:201 Condition
0:201 'b' (bool)
0:201 true case
0:201 'f' (highp float)
0:201 false case
0:201 direct index (layout(column_major shared ) highp float)
0:201 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:201 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:201 Constant:
0:201 1 (const int)
0:201 Constant:
0:201 2 (const int)
0:202 Test condition and select (layout(column_major shared ) highp float)
0:202 Condition
0:202 'b' (bool)
0:202 true case
0:202 direct index (layout(column_major shared ) highp float)
0:202 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:202 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:202 Constant:
0:202 1 (const int)
0:202 Constant:
0:202 2 (const int)
0:202 false case
0:202 'f' (highp float)
0:203 Test condition and select (void)
0:203 Condition
0:203 Compare Equal (bool)
0:203 'f' (highp float)
0:203 direct index (layout(column_major shared ) highp float)
0:203 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:203 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:203 Constant:
0:203 1 (const int)
0:203 Constant:
0:203 2 (const int)
0:203 true case
0:204 Pre-Increment (highp float)
0:204 'f' (highp float)
0:205 Test condition and select (void)
0:205 Condition
0:205 Compare Greater Than or Equal (bool)
0:205 'f' (highp float)
0:205 direct index (layout(column_major shared ) highp float)
0:205 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:205 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:205 Constant:
0:205 1 (const int)
0:205 Constant:
0:205 2 (const int)
0:205 true case
0:206 Pre-Increment (highp float)
0:206 'f' (highp float)
0:207 move second child to first child (highp float)
0:207 'f' (highp float)
0:207 direct index (highp float)
0:207 Construct vec3 (highp 3-component vector of float)
0:207 direct index (layout(column_major shared ) highp float)
0:207 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:207 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:207 Constant:
0:207 1 (const int)
0:207 Constant:
0:207 2 (const int)
0:207 Constant:
0:207 0 (const int)
0:208 Bitwise not (highp int)
0:208 value: direct index for structure (layout(column_major shared ) buffer highp int)
0:208 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:208 Constant:
0:208 0 (const int)
0:209 move second child to first child (highp float)
0:209 direct index (layout(column_major shared ) highp float)
0:209 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:209 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:209 Constant:
0:209 1 (const int)
0:209 Constant:
0:209 2 (const int)
0:209 Constant:
0:209 3.400000
0:218 Function Definition: foomultio( (void)
0:218 Function Parameters:
0:? Sequence
0:221 move second child to first child (highp float)
0:221 'g' (highp float)
0:221 direct index (layout(column_major shared ) highp float)
0:221 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:221 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:221 Constant:
0:221 1 (const int)
0:221 Constant:
0:221 2 (const int)
0:222 Bitwise not (highp int)
0:222 value: direct index for structure (layout(column_major shared ) buffer highp int)
0:222 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:222 Constant:
0:222 0 (const int)
0:223 move second child to first child (highp float)
0:223 direct index (layout(column_major shared ) highp float)
0:223 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:223 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:223 Constant:
0:223 1 (const int)
0:223 Constant:
0:223 2 (const int)
0:223 Constant:
0:223 3.400000
0:224 move second child to first child (highp int)
0:224 value: direct index for structure (layout(column_major shared ) buffer highp int)
0:224 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:224 Constant:
0:224 0 (const int)
0:224 Constant:
0:224 2 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'gl_WorkGroupSize' (const highp 3-component vector of uint) 0:? 'gl_WorkGroupSize' (const highp 3-component vector of uint)
0:? 2 (const uint) 0:? 2 (const uint)
@ -258,19 +446,19 @@ ERROR: node is still EOpNull!
0:? 'ii2dabad' (uniform highp iimage2DArray) 0:? 'ii2dabad' (uniform highp iimage2DArray)
0:? 'ii2da' (writeonly uniform highp iimage2DArray) 0:? 'ii2da' (writeonly uniform highp iimage2DArray)
0:? 'iimg2D' (layout(r32i ) uniform highp iimage2D) 0:? 'iimg2D' (layout(r32i ) uniform highp iimage2D)
0:? 'iimg2Drgba' (layout(rgba32i ) uniform highp iimage2D) 0:? 'iimg2Drgba' (layout(rgba32i ) readonly uniform highp iimage2D)
0:? 'img2Drgba' (layout(rgba32f ) uniform lowp image2D) 0:? 'img2Drgba' (layout(rgba32f ) readonly uniform lowp image2D)
0:? 'uimg2D' (layout(r32ui ) uniform highp uimage2D) 0:? 'uimg2D' (layout(r32ui ) uniform highp uimage2D)
0:? 'vol' (volatile highp float) 0:? 'vol' (volatile highp float)
0:? 'vol2' (readonly highp int) 0:? 'vol2' (readonly highp int)
0:? 'qualim1' (layout(r32i ) coherent readonly uniform highp iimage2D) 0:? 'qualim1' (layout(r32i ) coherent readonly uniform highp iimage2D)
0:? 'qualim2' (layout(r32i ) coherent restrict readonly uniform highp iimage2D) 0:? 'qualim2' (layout(r32i ) coherent restrict readonly uniform highp iimage2D)
0:? 'i1bad' (layout(rg8i ) uniform highp uimage2D) 0:? 'i1bad' (layout(rg8i ) readonly uniform highp uimage2D)
0:? 'i2bad' (layout(rgba32i ) uniform lowp image2D) 0:? 'i2bad' (layout(rgba32i ) readonly uniform lowp image2D)
0:? 'i3bad' (layout(rgba32f ) uniform highp uimage2D) 0:? 'i3bad' (layout(rgba32f ) readonly uniform highp uimage2D)
0:? 'i4bad' (layout(r8_snorm ) uniform highp iimage2D) 0:? 'i4bad' (layout(r8_snorm ) readonly uniform highp iimage2D)
0:? 'i5bad' (layout(rgba32ui ) uniform highp iimage2D) 0:? 'i5bad' (layout(rgba32ui ) readonly uniform highp iimage2D)
0:? 'i6bad' (layout(r8ui ) uniform highp iimage2D) 0:? 'i6bad' (layout(r8ui ) readonly uniform highp iimage2D)
0:? 'counter' (layout(binding=0 offset=0 ) uniform highp atomic_uint) 0:? 'counter' (layout(binding=0 offset=0 ) uniform highp atomic_uint)
0:? 'counterBad' (layout(binding=1 ) uniform mediump atomic_uint) 0:? 'counterBad' (layout(binding=1 ) uniform mediump atomic_uint)
0:? 'countArr' (layout(binding=2 offset=4 ) uniform 4-element array of highp atomic_uint) 0:? 'countArr' (layout(binding=2 offset=4 ) uniform 4-element array of highp atomic_uint)
@ -283,6 +471,15 @@ ERROR: node is still EOpNull!
0:? 'i2dr' (uniform mediump iimage2DRect) 0:? 'i2dr' (uniform mediump iimage2DRect)
0:? 'i2dms' (uniform lowp image2DMS) 0:? 'i2dms' (uniform lowp image2DMS)
0:? 'u2dmsa' (uniform mediump uimage2DMSArray) 0:? 'u2dmsa' (uniform mediump uimage2DMSArray)
0:? 'okay1' (layout(r32f ) coherent volatile restrict readonly writeonly uniform lowp image2D)
0:? 'okay2' (layout(r32i ) coherent volatile restrict readonly uniform highp iimage2D)
0:? 'okay3' (layout(r32ui ) coherent volatile restrict writeonly uniform highp uimage2D)
0:? 'okay4' (layout(r32f ) coherent volatile restrict uniform lowp image2D)
0:? 'badQ1' (layout(rgba32f ) coherent volatile restrict uniform lowp image2D)
0:? 'badQ2' (layout(rgba8i ) coherent volatile restrict uniform highp iimage2D)
0:? 'badQ3' (layout(rgba16ui ) coherent volatile restrict uniform highp uimage2D)
0:? 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:? 'multio' (layout(column_major shared ) buffer block{layout(column_major shared ) readonly buffer highp int value, layout(column_major shared ) writeonly buffer implicitly-sized array of highp float values})
Linked compute stage: Linked compute stage:
@ -369,7 +566,7 @@ ERROR: node is still EOpNull!
0:92 0 (const int) 0:92 0 (const int)
0:92 0 (const int) 0:92 0 (const int)
0:93 Function Call: imageLoad(I21;vi2; (highp 4-component vector of float) 0:93 Function Call: imageLoad(I21;vi2; (highp 4-component vector of float)
0:93 'img2Drgba' (layout(rgba32f ) uniform lowp image2D) 0:93 'img2Drgba' (layout(rgba32f ) readonly uniform lowp image2D)
0:93 Construct ivec2 (2-component vector of int) 0:93 Construct ivec2 (2-component vector of int)
0:93 'i' (highp int) 0:93 'i' (highp int)
0:93 'i' (highp int) 0:93 'i' (highp int)
@ -461,6 +658,178 @@ ERROR: node is still EOpNull!
0:162 10 (const uint) 0:162 10 (const uint)
0:162 Constant: 0:162 Constant:
0:162 8 (const uint) 0:162 8 (const uint)
0:191 Function Definition: foowo( (void)
0:191 Function Parameters:
0:? Sequence
0:194 move second child to first child (highp float)
0:194 'g' (highp float)
0:194 direct index (layout(column_major shared ) highp float)
0:194 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:194 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:194 Constant:
0:194 1 (const int)
0:194 Constant:
0:194 2 (const int)
0:195 Sequence
0:195 move second child to first child (highp float)
0:195 'f' (highp float)
0:195 direct index (layout(column_major shared ) highp float)
0:195 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:195 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:195 Constant:
0:195 1 (const int)
0:195 Constant:
0:195 2 (const int)
0:196 Pre-Increment (highp float)
0:196 direct index (layout(column_major shared ) highp float)
0:196 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:196 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:196 Constant:
0:196 1 (const int)
0:196 Constant:
0:196 2 (const int)
0:197 Post-Decrement (highp float)
0:197 direct index (layout(column_major shared ) highp float)
0:197 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:197 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:197 Constant:
0:197 1 (const int)
0:197 Constant:
0:197 2 (const int)
0:198 add (highp float)
0:198 'f' (highp float)
0:198 direct index (layout(column_major shared ) highp float)
0:198 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:198 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:198 Constant:
0:198 1 (const int)
0:198 Constant:
0:198 2 (const int)
0:199 subtract (highp float)
0:199 direct index (layout(column_major shared ) highp float)
0:199 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:199 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:199 Constant:
0:199 1 (const int)
0:199 Constant:
0:199 2 (const int)
0:199 'f' (highp float)
0:201 Test condition and select (highp float)
0:201 Condition
0:201 'b' (bool)
0:201 true case
0:201 'f' (highp float)
0:201 false case
0:201 direct index (layout(column_major shared ) highp float)
0:201 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:201 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:201 Constant:
0:201 1 (const int)
0:201 Constant:
0:201 2 (const int)
0:202 Test condition and select (layout(column_major shared ) highp float)
0:202 Condition
0:202 'b' (bool)
0:202 true case
0:202 direct index (layout(column_major shared ) highp float)
0:202 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:202 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:202 Constant:
0:202 1 (const int)
0:202 Constant:
0:202 2 (const int)
0:202 false case
0:202 'f' (highp float)
0:203 Test condition and select (void)
0:203 Condition
0:203 Compare Equal (bool)
0:203 'f' (highp float)
0:203 direct index (layout(column_major shared ) highp float)
0:203 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:203 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:203 Constant:
0:203 1 (const int)
0:203 Constant:
0:203 2 (const int)
0:203 true case
0:204 Pre-Increment (highp float)
0:204 'f' (highp float)
0:205 Test condition and select (void)
0:205 Condition
0:205 Compare Greater Than or Equal (bool)
0:205 'f' (highp float)
0:205 direct index (layout(column_major shared ) highp float)
0:205 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:205 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:205 Constant:
0:205 1 (const int)
0:205 Constant:
0:205 2 (const int)
0:205 true case
0:206 Pre-Increment (highp float)
0:206 'f' (highp float)
0:207 move second child to first child (highp float)
0:207 'f' (highp float)
0:207 direct index (highp float)
0:207 Construct vec3 (highp 3-component vector of float)
0:207 direct index (layout(column_major shared ) highp float)
0:207 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:207 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:207 Constant:
0:207 1 (const int)
0:207 Constant:
0:207 2 (const int)
0:207 Constant:
0:207 0 (const int)
0:208 Bitwise not (highp int)
0:208 value: direct index for structure (layout(column_major shared ) buffer highp int)
0:208 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:208 Constant:
0:208 0 (const int)
0:209 move second child to first child (highp float)
0:209 direct index (layout(column_major shared ) highp float)
0:209 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:209 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:209 Constant:
0:209 1 (const int)
0:209 Constant:
0:209 2 (const int)
0:209 Constant:
0:209 3.400000
0:218 Function Definition: foomultio( (void)
0:218 Function Parameters:
0:? Sequence
0:221 move second child to first child (highp float)
0:221 'g' (highp float)
0:221 direct index (layout(column_major shared ) highp float)
0:221 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:221 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:221 Constant:
0:221 1 (const int)
0:221 Constant:
0:221 2 (const int)
0:222 Bitwise not (highp int)
0:222 value: direct index for structure (layout(column_major shared ) buffer highp int)
0:222 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:222 Constant:
0:222 0 (const int)
0:223 move second child to first child (highp float)
0:223 direct index (layout(column_major shared ) highp float)
0:223 values: direct index for structure (layout(column_major shared ) buffer implicitly-sized array of highp float)
0:223 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:223 Constant:
0:223 1 (const int)
0:223 Constant:
0:223 2 (const int)
0:223 Constant:
0:223 3.400000
0:224 move second child to first child (highp int)
0:224 value: direct index for structure (layout(column_major shared ) buffer highp int)
0:224 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:224 Constant:
0:224 0 (const int)
0:224 Constant:
0:224 2 (const int)
0:? Linker Objects 0:? Linker Objects
0:? 'gl_WorkGroupSize' (const highp 3-component vector of uint) 0:? 'gl_WorkGroupSize' (const highp 3-component vector of uint)
0:? 2 (const uint) 0:? 2 (const uint)
@ -486,19 +855,19 @@ ERROR: node is still EOpNull!
0:? 'ii2dabad' (uniform highp iimage2DArray) 0:? 'ii2dabad' (uniform highp iimage2DArray)
0:? 'ii2da' (writeonly uniform highp iimage2DArray) 0:? 'ii2da' (writeonly uniform highp iimage2DArray)
0:? 'iimg2D' (layout(r32i ) uniform highp iimage2D) 0:? 'iimg2D' (layout(r32i ) uniform highp iimage2D)
0:? 'iimg2Drgba' (layout(rgba32i ) uniform highp iimage2D) 0:? 'iimg2Drgba' (layout(rgba32i ) readonly uniform highp iimage2D)
0:? 'img2Drgba' (layout(rgba32f ) uniform lowp image2D) 0:? 'img2Drgba' (layout(rgba32f ) readonly uniform lowp image2D)
0:? 'uimg2D' (layout(r32ui ) uniform highp uimage2D) 0:? 'uimg2D' (layout(r32ui ) uniform highp uimage2D)
0:? 'vol' (volatile highp float) 0:? 'vol' (volatile highp float)
0:? 'vol2' (readonly highp int) 0:? 'vol2' (readonly highp int)
0:? 'qualim1' (layout(r32i ) coherent readonly uniform highp iimage2D) 0:? 'qualim1' (layout(r32i ) coherent readonly uniform highp iimage2D)
0:? 'qualim2' (layout(r32i ) coherent restrict readonly uniform highp iimage2D) 0:? 'qualim2' (layout(r32i ) coherent restrict readonly uniform highp iimage2D)
0:? 'i1bad' (layout(rg8i ) uniform highp uimage2D) 0:? 'i1bad' (layout(rg8i ) readonly uniform highp uimage2D)
0:? 'i2bad' (layout(rgba32i ) uniform lowp image2D) 0:? 'i2bad' (layout(rgba32i ) readonly uniform lowp image2D)
0:? 'i3bad' (layout(rgba32f ) uniform highp uimage2D) 0:? 'i3bad' (layout(rgba32f ) readonly uniform highp uimage2D)
0:? 'i4bad' (layout(r8_snorm ) uniform highp iimage2D) 0:? 'i4bad' (layout(r8_snorm ) readonly uniform highp iimage2D)
0:? 'i5bad' (layout(rgba32ui ) uniform highp iimage2D) 0:? 'i5bad' (layout(rgba32ui ) readonly uniform highp iimage2D)
0:? 'i6bad' (layout(r8ui ) uniform highp iimage2D) 0:? 'i6bad' (layout(r8ui ) readonly uniform highp iimage2D)
0:? 'counter' (layout(binding=0 offset=0 ) uniform highp atomic_uint) 0:? 'counter' (layout(binding=0 offset=0 ) uniform highp atomic_uint)
0:? 'counterBad' (layout(binding=1 ) uniform mediump atomic_uint) 0:? 'counterBad' (layout(binding=1 ) uniform mediump atomic_uint)
0:? 'countArr' (layout(binding=2 offset=4 ) uniform 4-element array of highp atomic_uint) 0:? 'countArr' (layout(binding=2 offset=4 ) uniform 4-element array of highp atomic_uint)
@ -511,4 +880,13 @@ ERROR: node is still EOpNull!
0:? 'i2dr' (uniform mediump iimage2DRect) 0:? 'i2dr' (uniform mediump iimage2DRect)
0:? 'i2dms' (uniform lowp image2DMS) 0:? 'i2dms' (uniform lowp image2DMS)
0:? 'u2dmsa' (uniform mediump uimage2DMSArray) 0:? 'u2dmsa' (uniform mediump uimage2DMSArray)
0:? 'okay1' (layout(r32f ) coherent volatile restrict readonly writeonly uniform lowp image2D)
0:? 'okay2' (layout(r32i ) coherent volatile restrict readonly uniform highp iimage2D)
0:? 'okay3' (layout(r32ui ) coherent volatile restrict writeonly uniform highp uimage2D)
0:? 'okay4' (layout(r32f ) coherent volatile restrict uniform lowp image2D)
0:? 'badQ1' (layout(rgba32f ) coherent volatile restrict uniform lowp image2D)
0:? 'badQ2' (layout(rgba8i ) coherent volatile restrict uniform highp iimage2D)
0:? 'badQ3' (layout(rgba16ui ) coherent volatile restrict uniform highp uimage2D)
0:? 'wo' (layout(column_major shared ) writeonly buffer block{layout(column_major shared ) buffer highp int value, layout(column_major shared ) buffer implicitly-sized array of highp float values})
0:? 'multio' (layout(column_major shared ) buffer block{layout(column_major shared ) readonly buffer highp int value, layout(column_major shared ) writeonly buffer implicitly-sized array of highp float values})

View File

@ -22,7 +22,7 @@ MaxComputeWorkGroupCountX 65535
MaxComputeWorkGroupCountY 65535 MaxComputeWorkGroupCountY 65535
MaxComputeWorkGroupCountZ 65535 MaxComputeWorkGroupCountZ 65535
MaxComputeWorkGroupSizeX 1024 MaxComputeWorkGroupSizeX 1024
MaxComputeWorkGroupSizeX 1024 MaxComputeWorkGroupSizeY 1024
MaxComputeWorkGroupSizeZ 64 MaxComputeWorkGroupSizeZ 64
MaxComputeUniformComponents 1024 MaxComputeUniformComponents 1024
MaxComputeTextureImageUnits 16 MaxComputeTextureImageUnits 16

View File

@ -187,10 +187,8 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT
// //
// Returns the added node. // Returns the added node.
// //
TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, TSourceLoc loc) TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSourceLoc loc)
{ {
TIntermTyped* child = childNode->getAsTyped();
if (child->getType().getBasicType() == EbtBlock) if (child->getType().getBasicType() == EbtBlock)
return 0; return 0;

View File

@ -678,6 +678,34 @@ void TParseContext::checkIoArrayConsistency(TSourceLoc loc, int requiredSize, co
} }
} }
// Handle seeing a binary node with a math operation.
TIntermTyped* TParseContext::handleBinaryMath(TSourceLoc loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right)
{
rValueErrorCheck(loc, str, left->getAsTyped());
rValueErrorCheck(loc, str, right->getAsTyped());
TIntermTyped* result = intermediate.addBinaryMath(op, left, right, loc);
if (! result)
binaryOpError(loc, str, left->getCompleteString(), right->getCompleteString());
return result;
}
// Handle seeing a unary node with a math operation.
TIntermTyped* TParseContext::handleUnaryMath(TSourceLoc loc, const char* str, TOperator op, TIntermTyped* childNode)
{
rValueErrorCheck(loc, str, childNode);
TIntermTyped* result = intermediate.addUnaryMath(op, childNode, loc);
if (result)
return result;
else
unaryOpError(loc, str, childNode->getCompleteString());
return childNode;
}
// //
// Handle seeing a base.field dereference in the grammar. // Handle seeing a base.field dereference in the grammar.
// //
@ -1540,7 +1568,6 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr)
// //
bool TParseContext::lValueErrorCheck(TSourceLoc loc, const char* op, TIntermTyped* node) bool TParseContext::lValueErrorCheck(TSourceLoc loc, const char* op, TIntermTyped* node)
{ {
TIntermSymbol* symNode = node->getAsSymbolNode();
TIntermBinary* binaryNode = node->getAsBinaryNode(); TIntermBinary* binaryNode = node->getAsBinaryNode();
if (binaryNode) { if (binaryNode) {
@ -1582,6 +1609,7 @@ bool TParseContext::lValueErrorCheck(TSourceLoc loc, const char* op, TIntermType
const char* symbol = 0; const char* symbol = 0;
TIntermSymbol* symNode = node->getAsSymbolNode();
if (symNode != 0) if (symNode != 0)
symbol = symNode->getName().c_str(); symbol = symNode->getName().c_str();
@ -1644,6 +1672,32 @@ bool TParseContext::lValueErrorCheck(TSourceLoc loc, const char* op, TIntermType
return true; return true;
} }
// Test for and give an error if the node can't be read from.
void TParseContext::rValueErrorCheck(TSourceLoc loc, const char* op, TIntermTyped* node)
{
if (! node)
return;
TIntermBinary* binaryNode = node->getAsBinaryNode();
if (binaryNode) {
switch(binaryNode->getOp()) {
case EOpIndexDirect:
case EOpIndexIndirect:
case EOpIndexDirectStruct:
case EOpVectorSwizzle:
rValueErrorCheck(loc, op, binaryNode->getLeft());
default:
break;
}
return;
}
TIntermSymbol* symNode = node->getAsSymbolNode();
if (symNode && symNode->getQualifier().writeonly)
error(loc, "can't read from writeonly object: ", op, symNode->getName().c_str());
}
// //
// Both test, and if necessary spit out an error, to see if the node is really // Both test, and if necessary spit out an error, to see if the node is really
// a constant. // a constant.
@ -3530,6 +3584,15 @@ void TParseContext::layoutTypeCheck(TSourceLoc loc, const TType& type)
error(loc, "does not apply to signed integer images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); error(loc, "does not apply to signed integer images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), "");
if (type.getSampler().type == EbtUint && qualifier.layoutFormat < ElfIntGuard) if (type.getSampler().type == EbtUint && qualifier.layoutFormat < ElfIntGuard)
error(loc, "does not apply to unsigned integer images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), ""); error(loc, "does not apply to unsigned integer images", TQualifier::getLayoutFormatString(qualifier.layoutFormat), "");
if (profile == EEsProfile) {
// "Except for image variables qualified with the format qualifiers r32f, r32i, and r32ui, image variables must
// specify either memory qualifier readonly or the memory qualifier writeonly."
if (! (qualifier.layoutFormat == ElfR32f || qualifier.layoutFormat == ElfR32i || qualifier.layoutFormat == ElfR32ui)) {
if (! qualifier.readonly && ! qualifier.writeonly)
error(loc, "format requires readonly or writeonly memory qualifier", TQualifier::getLayoutFormatString(qualifier.layoutFormat), "");
}
}
} }
} else if (type.isImage() && ! qualifier.writeonly) } else if (type.isImage() && ! qualifier.writeonly)
error(loc, "image variables not declared 'writeonly' must have a format layout qualifier", "", ""); error(loc, "image variables not declared 'writeonly' must have a format layout qualifier", "", "");
@ -3828,7 +3891,9 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier,
if (voidErrorCheck(loc, identifier, type.getBasicType())) if (voidErrorCheck(loc, identifier, type.getBasicType()))
return 0; return 0;
if (! initializer) if (initializer)
rValueErrorCheck(loc, "initializer", initializer);
else
nonInitConstCheck(loc, identifier, type); nonInitConstCheck(loc, identifier, type);
invariantCheck(loc, type, identifier); invariantCheck(loc, type, identifier);
@ -4118,8 +4183,9 @@ TIntermTyped* TParseContext::convertInitializerList(TSourceLoc loc, const TType&
// //
TIntermTyped* TParseContext::addConstructor(TSourceLoc loc, TIntermNode* node, const TType& type, TOperator op) TIntermTyped* TParseContext::addConstructor(TSourceLoc loc, TIntermNode* node, const TType& type, TOperator op)
{ {
if (node == 0) if (node == 0 || node->getAsTyped() == 0)
return 0; return 0;
rValueErrorCheck(loc, "constructor", node->getAsTyped());
TIntermAggregate* aggrNode = node->getAsAggregate(); TIntermAggregate* aggrNode = node->getAsAggregate();
@ -4150,7 +4216,7 @@ TIntermTyped* TParseContext::addConstructor(TSourceLoc loc, TIntermNode* node, c
else if (op == EOpConstructStruct) else if (op == EOpConstructStruct)
newNode = constructStruct(node, *(*memberTypes).type, 1, node->getLoc()); newNode = constructStruct(node, *(*memberTypes).type, 1, node->getLoc());
else else
newNode = constructBuiltIn(type, op, node, node->getLoc(), false); newNode = constructBuiltIn(type, op, node->getAsTyped(), node->getLoc(), false);
if (newNode && (type.isArray() || op == EOpConstructStruct)) if (newNode && (type.isArray() || op == EOpConstructStruct))
newNode = intermediate.setAggregateOperator(newNode, EOpConstructStruct, type, loc); newNode = intermediate.setAggregateOperator(newNode, EOpConstructStruct, type, loc);
@ -4178,7 +4244,7 @@ TIntermTyped* TParseContext::addConstructor(TSourceLoc loc, TIntermNode* node, c
else if (op == EOpConstructStruct) else if (op == EOpConstructStruct)
newNode = constructStruct(*p, *(memberTypes[paramCount]).type, paramCount+1, node->getLoc()); newNode = constructStruct(*p, *(memberTypes[paramCount]).type, paramCount+1, node->getLoc());
else else
newNode = constructBuiltIn(type, op, *p, node->getLoc(), true); newNode = constructBuiltIn(type, op, (*p)->getAsTyped(), node->getLoc(), true);
if (newNode) if (newNode)
*p = newNode; *p = newNode;
@ -4198,7 +4264,7 @@ TIntermTyped* TParseContext::addConstructor(TSourceLoc loc, TIntermNode* node, c
// //
// Returns 0 for an error or the constructed node. // Returns 0 for an error or the constructed node.
// //
TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermNode* node, TSourceLoc loc, bool subset) TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node, TSourceLoc loc, bool subset)
{ {
TIntermTyped* newNode; TIntermTyped* newNode;
TOperator basicOp; TOperator basicOp;

View File

@ -95,6 +95,8 @@ public:
int getIoArrayImplicitSize() const; int getIoArrayImplicitSize() const;
void checkIoArrayConsistency(TSourceLoc, int requiredSize, const char* feature, TType&, const TString&); void checkIoArrayConsistency(TSourceLoc, int requiredSize, const char* feature, TType&, const TString&);
TIntermTyped* handleBinaryMath(TSourceLoc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right);
TIntermTyped* handleUnaryMath(TSourceLoc, const char* str, TOperator op, TIntermTyped* childNode);
TIntermTyped* handleDotDereference(TSourceLoc, TIntermTyped* base, TString& field); TIntermTyped* handleDotDereference(TSourceLoc, TIntermTyped* base, TString& field);
TFunction* handleFunctionDeclarator(TSourceLoc loc, TFunction& function, bool prototype); TFunction* handleFunctionDeclarator(TSourceLoc loc, TFunction& function, bool prototype);
TIntermAggregate* handleFunctionDefinition(TSourceLoc, TFunction&); TIntermAggregate* handleFunctionDefinition(TSourceLoc, TFunction&);
@ -111,6 +113,7 @@ public:
void binaryOpError(TSourceLoc, const char* op, TString left, TString right); void binaryOpError(TSourceLoc, const char* op, TString left, TString right);
void variableCheck(TIntermTyped*& nodePtr); void variableCheck(TIntermTyped*& nodePtr);
bool lValueErrorCheck(TSourceLoc, const char* op, TIntermTyped*); bool lValueErrorCheck(TSourceLoc, const char* op, TIntermTyped*);
void rValueErrorCheck(TSourceLoc, const char* op, TIntermTyped*);
void constantValueCheck(TIntermTyped* node, const char* token); void constantValueCheck(TIntermTyped* node, const char* token);
void integerCheck(const TIntermTyped* node, const char* token); void integerCheck(const TIntermTyped* node, const char* token);
void globalCheck(TSourceLoc, const char* token); void globalCheck(TSourceLoc, const char* token);
@ -170,7 +173,7 @@ public:
TIntermNode* declareVariable(TSourceLoc, TString& identifier, const TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0); TIntermNode* declareVariable(TSourceLoc, TString& identifier, const TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0);
TIntermTyped* addConstructor(TSourceLoc, TIntermNode*, const TType&, TOperator); TIntermTyped* addConstructor(TSourceLoc, TIntermNode*, const TType&, TOperator);
TIntermTyped* constructStruct(TIntermNode*, const TType&, int, TSourceLoc); TIntermTyped* constructStruct(TIntermNode*, const TType&, int, TSourceLoc);
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermNode*, TSourceLoc, bool subset); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, TSourceLoc, bool subset);
void declareBlock(TSourceLoc, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0); void declareBlock(TSourceLoc, TTypeList& typeList, const TString* instanceName = 0, TArraySizes* arraySizes = 0);
void fixBlockLocations(TSourceLoc, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); void fixBlockLocations(TSourceLoc, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation);
void fixBlockXfbOffsets(TSourceLoc, TQualifier&, TTypeList&); void fixBlockXfbOffsets(TSourceLoc, TQualifier&, TTypeList&);

View File

@ -677,8 +677,7 @@ int TScanContext::tokenizeIdentifier()
if (parseContext.profile == EEsProfile && parseContext.version >= 310 || if (parseContext.profile == EEsProfile && parseContext.version >= 310 ||
parseContext.extensionsTurnedOn(1, &GL_ARB_shader_atomic_counters)) parseContext.extensionsTurnedOn(1, &GL_ARB_shader_atomic_counters))
return keyword; return keyword;
else return es30ReservedFromGLSL(420);
return es30ReservedFromGLSL(420);
case COHERENT: case COHERENT:
case RESTRICT: case RESTRICT:
@ -686,10 +685,11 @@ int TScanContext::tokenizeIdentifier()
case WRITEONLY: case WRITEONLY:
if (parseContext.profile == EEsProfile && parseContext.version >= 310) if (parseContext.profile == EEsProfile && parseContext.version >= 310)
return keyword; return keyword;
else return es30ReservedFromGLSL(parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store) ? 130 : 420);
return es30ReservedFromGLSL(parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store) ? 130 : 420);
case VOLATILE: case VOLATILE:
if (parseContext.profile == EEsProfile && parseContext.version >= 310)
return keyword;
if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || (parseContext.version < 420 && ! parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store)))) if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || (parseContext.version < 420 && ! parseContext.extensionsTurnedOn(1, &GL_ARB_shader_image_load_store))))
reservedWord(); reservedWord();
return keyword; return keyword;

View File

@ -265,20 +265,12 @@ postfix_expression
| postfix_expression INC_OP { | postfix_expression INC_OP {
parseContext.variableCheck($1); parseContext.variableCheck($1);
parseContext.lValueErrorCheck($2.loc, "++", $1); parseContext.lValueErrorCheck($2.loc, "++", $1);
$$ = parseContext.intermediate.addUnaryMath(EOpPostIncrement, $1, $2.loc); $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1);
if ($$ == 0) {
parseContext.unaryOpError($2.loc, "++", $1->getCompleteString());
$$ = $1;
}
} }
| postfix_expression DEC_OP { | postfix_expression DEC_OP {
parseContext.variableCheck($1); parseContext.variableCheck($1);
parseContext.lValueErrorCheck($2.loc, "--", $1); parseContext.lValueErrorCheck($2.loc, "--", $1);
$$ = parseContext.intermediate.addUnaryMath(EOpPostDecrement, $1, $2.loc); $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1);
if ($$ == 0) {
parseContext.unaryOpError($2.loc, "--", $1->getCompleteString());
$$ = $1;
}
} }
; ;
@ -391,34 +383,22 @@ unary_expression
} }
| INC_OP unary_expression { | INC_OP unary_expression {
parseContext.lValueErrorCheck($1.loc, "++", $2); parseContext.lValueErrorCheck($1.loc, "++", $2);
$$ = parseContext.intermediate.addUnaryMath(EOpPreIncrement, $2, $1.loc); $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2);
if ($$ == 0) {
parseContext.unaryOpError($1.loc, "++", $2->getCompleteString());
$$ = $2;
}
} }
| DEC_OP unary_expression { | DEC_OP unary_expression {
parseContext.lValueErrorCheck($1.loc, "--", $2); parseContext.lValueErrorCheck($1.loc, "--", $2);
$$ = parseContext.intermediate.addUnaryMath(EOpPreDecrement, $2, $1.loc); $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2);
if ($$ == 0) {
parseContext.unaryOpError($1.loc, "--", $2->getCompleteString());
$$ = $2;
}
} }
| unary_operator unary_expression { | unary_operator unary_expression {
if ($1.op != EOpNull) { if ($1.op != EOpNull) {
$$ = parseContext.intermediate.addUnaryMath($1.op, $2, $1.loc); char errorOp[2] = {0, 0};
if ($$ == 0) { switch($1.op) {
char errorOp[2] = {0, 0}; case EOpNegative: errorOp[0] = '-'; break;
switch($1.op) { case EOpLogicalNot: errorOp[0] = '!'; break;
case EOpNegative: errorOp[0] = '-'; break; case EOpBitwiseNot: errorOp[0] = '~'; break;
case EOpLogicalNot: errorOp[0] = '!'; break; default: break; // some compilers want this
case EOpBitwiseNot: errorOp[0] = '~'; break;
default: break; // some compilers want this
}
parseContext.unaryOpError($1.loc, errorOp, $2->getCompleteString());
$$ = $2;
} }
$$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2);
} else { } else {
$$ = $2; $$ = $2;
if ($$->getAsConstantUnion()) if ($$->getAsConstantUnion())
@ -440,44 +420,34 @@ unary_operator
multiplicative_expression multiplicative_expression
: unary_expression { $$ = $1; } : unary_expression { $$ = $1; }
| multiplicative_expression STAR unary_expression { | multiplicative_expression STAR unary_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpMul, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "*", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
| multiplicative_expression SLASH unary_expression { | multiplicative_expression SLASH unary_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpDiv, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "/", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
| multiplicative_expression PERCENT unary_expression { | multiplicative_expression PERCENT unary_expression {
parseContext.fullIntegerCheck($2.loc, "%"); parseContext.fullIntegerCheck($2.loc, "%");
$$ = parseContext.intermediate.addBinaryMath(EOpMod, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "%", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
; ;
additive_expression additive_expression
: multiplicative_expression { $$ = $1; } : multiplicative_expression { $$ = $1; }
| additive_expression PLUS multiplicative_expression { | additive_expression PLUS multiplicative_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpAdd, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "+", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
| additive_expression DASH multiplicative_expression { | additive_expression DASH multiplicative_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpSub, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "-", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
; ;
@ -485,51 +455,39 @@ shift_expression
: additive_expression { $$ = $1; } : additive_expression { $$ = $1; }
| shift_expression LEFT_OP additive_expression { | shift_expression LEFT_OP additive_expression {
parseContext.fullIntegerCheck($2.loc, "bit shift left"); parseContext.fullIntegerCheck($2.loc, "bit shift left");
$$ = parseContext.intermediate.addBinaryMath(EOpLeftShift, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "<<", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
| shift_expression RIGHT_OP additive_expression { | shift_expression RIGHT_OP additive_expression {
parseContext.fullIntegerCheck($2.loc, "bit shift right"); parseContext.fullIntegerCheck($2.loc, "bit shift right");
$$ = parseContext.intermediate.addBinaryMath(EOpRightShift, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, ">>", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
; ;
relational_expression relational_expression
: shift_expression { $$ = $1; } : shift_expression { $$ = $1; }
| relational_expression LEFT_ANGLE shift_expression { | relational_expression LEFT_ANGLE shift_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpLessThan, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "<", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
| relational_expression RIGHT_ANGLE shift_expression { | relational_expression RIGHT_ANGLE shift_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpGreaterThan, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, ">", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
| relational_expression LE_OP shift_expression { | relational_expression LE_OP shift_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "<=", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
| relational_expression GE_OP shift_expression { | relational_expression GE_OP shift_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, ">=", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
; ;
@ -538,20 +496,16 @@ equality_expression
| equality_expression EQ_OP relational_expression { | equality_expression EQ_OP relational_expression {
parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison"); parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
parseContext.opaqueCheck($2.loc, $1->getType(), "=="); parseContext.opaqueCheck($2.loc, $1->getType(), "==");
$$ = parseContext.intermediate.addBinaryMath(EOpEqual, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "==", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
| equality_expression NE_OP relational_expression { | equality_expression NE_OP relational_expression {
parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison"); parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
parseContext.opaqueCheck($2.loc, $1->getType(), "!="); parseContext.opaqueCheck($2.loc, $1->getType(), "!=");
$$ = parseContext.intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "!=", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
; ;
@ -559,11 +513,9 @@ and_expression
: equality_expression { $$ = $1; } : equality_expression { $$ = $1; }
| and_expression AMPERSAND equality_expression { | and_expression AMPERSAND equality_expression {
parseContext.fullIntegerCheck($2.loc, "bitwise and"); parseContext.fullIntegerCheck($2.loc, "bitwise and");
$$ = parseContext.intermediate.addBinaryMath(EOpAnd, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "&", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
; ;
@ -571,11 +523,9 @@ exclusive_or_expression
: and_expression { $$ = $1; } : and_expression { $$ = $1; }
| exclusive_or_expression CARET and_expression { | exclusive_or_expression CARET and_expression {
parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or"); parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or");
$$ = parseContext.intermediate.addBinaryMath(EOpExclusiveOr, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "^", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
; ;
@ -583,44 +533,36 @@ inclusive_or_expression
: exclusive_or_expression { $$ = $1; } : exclusive_or_expression { $$ = $1; }
| inclusive_or_expression VERTICAL_BAR exclusive_or_expression { | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or"); parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or");
$$ = parseContext.intermediate.addBinaryMath(EOpInclusiveOr, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "|", $1->getCompleteString(), $3->getCompleteString());
$$ = $1; $$ = $1;
}
} }
; ;
logical_and_expression logical_and_expression
: inclusive_or_expression { $$ = $1; } : inclusive_or_expression { $$ = $1; }
| logical_and_expression AND_OP inclusive_or_expression { | logical_and_expression AND_OP inclusive_or_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "&&", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
; ;
logical_xor_expression logical_xor_expression
: logical_and_expression { $$ = $1; } : logical_and_expression { $$ = $1; }
| logical_xor_expression XOR_OP logical_and_expression { | logical_xor_expression XOR_OP logical_and_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpLogicalXor, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "^^", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
; ;
logical_or_expression logical_or_expression
: logical_xor_expression { $$ = $1; } : logical_xor_expression { $$ = $1; }
| logical_or_expression OR_OP logical_xor_expression { | logical_or_expression OR_OP logical_xor_expression {
$$ = parseContext.intermediate.addBinaryMath(EOpLogicalOr, $1, $3, $2.loc); $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3);
if ($$ == 0) { if ($$ == 0)
parseContext.binaryOpError($2.loc, "||", $1->getCompleteString(), $3->getCompleteString());
$$ = parseContext.intermediate.addConstantUnion(false, $2.loc); $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
}
} }
; ;
@ -628,7 +570,9 @@ conditional_expression
: logical_or_expression { $$ = $1; } : logical_or_expression { $$ = $1; }
| logical_or_expression QUESTION expression COLON assignment_expression { | logical_or_expression QUESTION expression COLON assignment_expression {
parseContext.boolCheck($2.loc, $1); parseContext.boolCheck($2.loc, $1);
parseContext.rValueErrorCheck($2.loc, "?", $1);
parseContext.rValueErrorCheck($4.loc, ":", $3);
parseContext.rValueErrorCheck($4.loc, ":", $5);
$$ = parseContext.intermediate.addSelection($1, $3, $5, $2.loc); $$ = parseContext.intermediate.addSelection($1, $3, $5, $2.loc);
if ($$ == 0) { if ($$ == 0) {
parseContext.binaryOpError($2.loc, ":", $3->getCompleteString(), $5->getCompleteString()); parseContext.binaryOpError($2.loc, ":", $3->getCompleteString(), $5->getCompleteString());
@ -643,6 +587,7 @@ assignment_expression
parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment"); parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment");
parseContext.opaqueCheck($2.loc, $1->getType(), "="); parseContext.opaqueCheck($2.loc, $1->getType(), "=");
parseContext.lValueErrorCheck($2.loc, "assign", $1); parseContext.lValueErrorCheck($2.loc, "assign", $1);
parseContext.rValueErrorCheck($2.loc, "assign", $3);
$$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc); $$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc);
if ($$ == 0) { if ($$ == 0) {
parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString()); parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());

View File

@ -161,7 +161,7 @@ public:
TIntermTyped* addBinaryMath(TOperator, TIntermTyped* left, TIntermTyped* right, TSourceLoc); TIntermTyped* addBinaryMath(TOperator, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc); TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc);
TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc); TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc);
TIntermTyped* addUnaryMath(TOperator, TIntermNode* child, TSourceLoc); TIntermTyped* addUnaryMath(TOperator, TIntermTyped* child, TSourceLoc);
TIntermTyped* addBuiltInFunctionCall(TSourceLoc line, TOperator, bool unary, TIntermNode*, const TType& returnType); TIntermTyped* addBuiltInFunctionCall(TSourceLoc line, TOperator, bool unary, TIntermNode*, const TType& returnType);
bool canImplicitlyPromote(TBasicType from, TBasicType to) const; bool canImplicitlyPromote(TBasicType from, TBasicType to) const;
TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right); TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right);