Add ES 3.1 compatibility to 4.5 and the atomic memory functions (e.g. atomicAdd).

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27715 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2014-08-13 08:32:15 +00:00
parent 699684180f
commit df1d81a958
10 changed files with 353 additions and 16 deletions

View File

@@ -150,3 +150,14 @@ void opac()
countArr[2];
countArr[i];
}
shared int atomi;
shared uint atomu;
void atoms()
{
int origi = atomicAdd(atomi, 3);
uint origu = atomicAnd(atomu, 7u);
origi = atomicExchange(atomi, 4);
origu = atomicCompSwap(atomu, 10u, 8u);
}

View File

@@ -43,4 +43,19 @@ void foo23()
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[1]);
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[2]); // ERROR, offset out of range
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
if (gl_HelperInvocation)
++outp;
int sum = gl_MaxVertexImageUniforms +
gl_MaxFragmentImageUniforms +
gl_MaxComputeImageUniforms +
gl_MaxCombinedImageUniforms +
gl_MaxCombinedShaderOutputResources;
bool b1, b2, b3, b;
b1 = mix(b2, b3, b);
uvec3 um3 = mix(uvec3(i), uvec3(i), bvec3(b));
ivec4 im4 = mix(ivec4(i), ivec4(i), bvec4(b));
}

View File

@@ -17,4 +17,19 @@ void main()
float cull = gl_CullDistance[2];
float consts = gl_MaxCullDistances + gl_MaxCombinedClipAndCullDistances;
if (gl_HelperInvocation)
++v4;
int sum = gl_MaxVertexImageUniforms +
gl_MaxFragmentImageUniforms +
gl_MaxComputeImageUniforms +
gl_MaxCombinedImageUniforms +
gl_MaxCombinedShaderOutputResources;
bool b1, b3, b;
uint uin;
bvec2 b2 = mix(bvec2(b1), bvec2(b3), bvec2(b));
uint um = mix(uin, uin, b);
ivec3 im3 = mix(ivec3(uin), ivec3(uin), bvec3(b));
}

View File

@@ -187,6 +187,37 @@ ERROR: node is still EOpNull!
0:151 indirect index (layout(binding=2 offset=4 ) highp atomic_uint)
0:151 'countArr' (layout(binding=2 offset=4 ) uniform 4-element array of highp atomic_uint)
0:151 'i' (uniform highp int)
0:157 Function Definition: atoms( (void)
0:157 Function Parameters:
0:159 Sequence
0:159 Sequence
0:159 move second child to first child (highp int)
0:159 'origi' (highp int)
0:159 Function Call: atomicAdd(i1;i1; (highp int)
0:159 'atomi' (shared highp int)
0:159 Constant:
0:159 3 (const int)
0:160 Sequence
0:160 move second child to first child (highp uint)
0:160 'origu' (highp uint)
0:160 Function Call: atomicAnd(u1;u1; (highp uint)
0:160 'atomu' (shared highp uint)
0:160 Constant:
0:160 7 (const uint)
0:161 move second child to first child (highp int)
0:161 'origi' (highp int)
0:161 Function Call: atomicExchange(i1;i1; (highp int)
0:161 'atomi' (shared highp int)
0:161 Constant:
0:161 4 (const int)
0:162 move second child to first child (highp uint)
0:162 'origu' (highp uint)
0:162 Function Call: atomicCompSwap(u1;u1;u1; (highp uint)
0:162 'atomu' (shared highp uint)
0:162 Constant:
0:162 10 (const uint)
0:162 Constant:
0:162 8 (const uint)
0:? Linker Objects
0:? 'gl_WorkGroupSize' (const highp 3-component vector of uint)
0:? 2 (const uint)
@@ -229,6 +260,8 @@ ERROR: node is still EOpNull!
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:? 'i' (uniform highp int)
0:? 'atomi' (shared highp int)
0:? 'atomu' (shared highp uint)
Linked compute stage:
@@ -376,6 +409,37 @@ ERROR: node is still EOpNull!
0:151 indirect index (layout(binding=2 offset=4 ) highp atomic_uint)
0:151 'countArr' (layout(binding=2 offset=4 ) uniform 4-element array of highp atomic_uint)
0:151 'i' (uniform highp int)
0:157 Function Definition: atoms( (void)
0:157 Function Parameters:
0:159 Sequence
0:159 Sequence
0:159 move second child to first child (highp int)
0:159 'origi' (highp int)
0:159 Function Call: atomicAdd(i1;i1; (highp int)
0:159 'atomi' (shared highp int)
0:159 Constant:
0:159 3 (const int)
0:160 Sequence
0:160 move second child to first child (highp uint)
0:160 'origu' (highp uint)
0:160 Function Call: atomicAnd(u1;u1; (highp uint)
0:160 'atomu' (shared highp uint)
0:160 Constant:
0:160 7 (const uint)
0:161 move second child to first child (highp int)
0:161 'origi' (highp int)
0:161 Function Call: atomicExchange(i1;i1; (highp int)
0:161 'atomi' (shared highp int)
0:161 Constant:
0:161 4 (const int)
0:162 move second child to first child (highp uint)
0:162 'origu' (highp uint)
0:162 Function Call: atomicCompSwap(u1;u1;u1; (highp uint)
0:162 'atomu' (shared highp uint)
0:162 Constant:
0:162 10 (const uint)
0:162 Constant:
0:162 8 (const uint)
0:? Linker Objects
0:? 'gl_WorkGroupSize' (const highp 3-component vector of uint)
0:? 2 (const uint)
@@ -418,4 +482,6 @@ ERROR: node is still EOpNull!
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:? 'i' (uniform highp int)
0:? 'atomi' (shared highp int)
0:? 'atomu' (shared highp uint)

View File

@@ -153,6 +153,45 @@ ERROR: node is still EOpNull!
0:45 Constant:
0:45 -10 (const int)
0:45 20 (const int)
0:47 Test condition and select (void)
0:47 Condition
0:47 'gl_HelperInvocation' (in bool)
0:47 true case
0:48 Pre-Increment (mediump 4-component vector of float)
0:48 'outp' (out mediump 4-component vector of float)
0:50 Sequence
0:50 move second child to first child (mediump int)
0:50 'sum' (mediump int)
0:50 Constant:
0:50 32 (const int)
0:58 move second child to first child (bool)
0:58 'b1' (bool)
0:58 mix (bool)
0:58 'b2' (bool)
0:58 'b3' (bool)
0:58 'b' (bool)
0:59 Sequence
0:59 move second child to first child (mediump 3-component vector of uint)
0:59 'um3' (mediump 3-component vector of uint)
0:59 mix (mediump 3-component vector of uint)
0:59 Construct uvec3 (mediump 3-component vector of uint)
0:59 Convert int to uint (mediump uint)
0:59 'i' (uniform mediump int)
0:59 Construct uvec3 (mediump 3-component vector of uint)
0:59 Convert int to uint (mediump uint)
0:59 'i' (uniform mediump int)
0:59 Construct bvec3 (3-component vector of bool)
0:59 'b' (bool)
0:60 Sequence
0:60 move second child to first child (mediump 4-component vector of int)
0:60 'im4' (mediump 4-component vector of int)
0:60 mix (mediump 4-component vector of int)
0:60 Construct ivec4 (mediump 4-component vector of int)
0:60 'i' (uniform mediump int)
0:60 Construct ivec4 (mediump 4-component vector of int)
0:60 'i' (uniform mediump int)
0:60 Construct bvec4 (4-component vector of bool)
0:60 'b' (bool)
0:? Linker Objects
0:? 'gl_FragCoord' (smooth in mediump 4-component vector of float)
0:? 'v3' (layout(location=2 ) smooth in mediump 3-component vector of float)
@@ -303,6 +342,45 @@ ERROR: node is still EOpNull!
0:45 Constant:
0:45 -10 (const int)
0:45 20 (const int)
0:47 Test condition and select (void)
0:47 Condition
0:47 'gl_HelperInvocation' (in bool)
0:47 true case
0:48 Pre-Increment (mediump 4-component vector of float)
0:48 'outp' (out mediump 4-component vector of float)
0:50 Sequence
0:50 move second child to first child (mediump int)
0:50 'sum' (mediump int)
0:50 Constant:
0:50 32 (const int)
0:58 move second child to first child (bool)
0:58 'b1' (bool)
0:58 mix (bool)
0:58 'b2' (bool)
0:58 'b3' (bool)
0:58 'b' (bool)
0:59 Sequence
0:59 move second child to first child (mediump 3-component vector of uint)
0:59 'um3' (mediump 3-component vector of uint)
0:59 mix (mediump 3-component vector of uint)
0:59 Construct uvec3 (mediump 3-component vector of uint)
0:59 Convert int to uint (mediump uint)
0:59 'i' (uniform mediump int)
0:59 Construct uvec3 (mediump 3-component vector of uint)
0:59 Convert int to uint (mediump uint)
0:59 'i' (uniform mediump int)
0:59 Construct bvec3 (3-component vector of bool)
0:59 'b' (bool)
0:60 Sequence
0:60 move second child to first child (mediump 4-component vector of int)
0:60 'im4' (mediump 4-component vector of int)
0:60 mix (mediump 4-component vector of int)
0:60 Construct ivec4 (mediump 4-component vector of int)
0:60 'i' (uniform mediump int)
0:60 Construct ivec4 (mediump 4-component vector of int)
0:60 'i' (uniform mediump int)
0:60 Construct bvec4 (4-component vector of bool)
0:60 'b' (bool)
0:? Linker Objects
0:? 'gl_FragCoord' (smooth in mediump 4-component vector of float)
0:? 'v3' (layout(location=2 ) smooth in mediump 3-component vector of float)

View File

@@ -59,6 +59,46 @@ Shader version: 450
0:19 'consts' (float)
0:19 Constant:
0:19 16.000000
0:21 Test condition and select (void)
0:21 Condition
0:21 'gl_HelperInvocation' (in bool)
0:21 true case
0:22 Pre-Increment (4-component vector of float)
0:22 'v4' (4-component vector of float)
0:24 Sequence
0:24 move second child to first child (int)
0:24 'sum' (int)
0:24 Constant:
0:24 32 (const int)
0:32 Sequence
0:32 move second child to first child (2-component vector of bool)
0:32 'b2' (2-component vector of bool)
0:32 mix (2-component vector of bool)
0:32 Construct bvec2 (2-component vector of bool)
0:32 'b1' (bool)
0:32 Construct bvec2 (2-component vector of bool)
0:32 'b3' (bool)
0:32 Construct bvec2 (2-component vector of bool)
0:32 'b' (bool)
0:33 Sequence
0:33 move second child to first child (uint)
0:33 'um' (uint)
0:33 mix (uint)
0:33 'uin' (uint)
0:33 'uin' (uint)
0:33 'b' (bool)
0:34 Sequence
0:34 move second child to first child (3-component vector of int)
0:34 'im3' (3-component vector of int)
0:34 mix (3-component vector of int)
0:34 Construct ivec3 (3-component vector of int)
0:34 Convert uint to int (int)
0:34 'uin' (uint)
0:34 Construct ivec3 (3-component vector of int)
0:34 Convert uint to int (int)
0:34 'uin' (uint)
0:34 Construct bvec3 (3-component vector of bool)
0:34 'b' (bool)
0:? Linker Objects
0:? 'in1' (smooth in float)
0:? 'in2' (smooth in 2-component vector of float)
@@ -128,6 +168,46 @@ Shader version: 450
0:19 'consts' (float)
0:19 Constant:
0:19 16.000000
0:21 Test condition and select (void)
0:21 Condition
0:21 'gl_HelperInvocation' (in bool)
0:21 true case
0:22 Pre-Increment (4-component vector of float)
0:22 'v4' (4-component vector of float)
0:24 Sequence
0:24 move second child to first child (int)
0:24 'sum' (int)
0:24 Constant:
0:24 32 (const int)
0:32 Sequence
0:32 move second child to first child (2-component vector of bool)
0:32 'b2' (2-component vector of bool)
0:32 mix (2-component vector of bool)
0:32 Construct bvec2 (2-component vector of bool)
0:32 'b1' (bool)
0:32 Construct bvec2 (2-component vector of bool)
0:32 'b3' (bool)
0:32 Construct bvec2 (2-component vector of bool)
0:32 'b' (bool)
0:33 Sequence
0:33 move second child to first child (uint)
0:33 'um' (uint)
0:33 mix (uint)
0:33 'uin' (uint)
0:33 'uin' (uint)
0:33 'b' (bool)
0:34 Sequence
0:34 move second child to first child (3-component vector of int)
0:34 'im3' (3-component vector of int)
0:34 mix (3-component vector of int)
0:34 Construct ivec3 (3-component vector of int)
0:34 Convert uint to int (int)
0:34 'uin' (uint)
0:34 Construct ivec3 (3-component vector of int)
0:34 Convert uint to int (int)
0:34 'uin' (uint)
0:34 Construct bvec3 (3-component vector of bool)
0:34 'b' (bool)
0:? Linker Objects
0:? 'in1' (smooth in float)
0:? 'in2' (smooth in 2-component vector of float)