Turn on ESSL 3.1 for most features:

- images: load/store, memory qualifiers
 - buffer blocks
 - compute shaders
 - atomic counters
 - texture gather
 - SSO
 - uniform locations
 - all the numeric-based version # comparisons


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27710 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2014-08-12 22:07:22 +00:00
parent bedb1bc2db
commit 4d57090da5
20 changed files with 500 additions and 195 deletions

View File

@@ -168,3 +168,7 @@ int Bfoo;
layout(std140) Binst; // ERROR
layout(std140) Bblock; // ERROR
layout(std140) Bfoo; // ERROR
struct SNA {
int a[]; // ERROR
};

141
Test/310.comp Normal file
View File

@@ -0,0 +1,141 @@
#version 310 es
layout(local_size_x = 2) in;
layout(local_size_x = 16) in; // ERROR, changing
layout(local_size_z = 4096) in; // ERROR, too large
layout(local_size_x = 2) in;
const int total = gl_MaxComputeWorkGroupCount.y
+ gl_MaxComputeUniformComponents
+ gl_MaxComputeTextureImageUnits
+ gl_MaxComputeImageUniforms
+ gl_MaxComputeAtomicCounters
+ gl_MaxComputeAtomicCounterBuffers;
buffer ShaderStorageBlock
{
int value;
float values[];
};
buffer InvalidShaderStorageBlock
{
float values[]; // ERROR
int value;
} invalid;
void main()
{
barrier();
memoryBarrier();
memoryBarrierAtomicCounter();
memoryBarrierBuffer();
memoryBarrierShared();
memoryBarrierImage();
groupMemoryBarrier();
value = int(values[gl_LocalInvocationIndex]);
}
layout(location = 2) in vec3 v3; // ERROR
in float f; // ERROR
out float fo; // ERROR
shared vec4 s;
layout(location = 2) shared vec4 sl; // ERROR
shared float fs = 4.2; // ERROR
layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) out; // ERROR
int arrX[gl_WorkGroupSize.x];
int arrY[gl_WorkGroupSize.y];
int arrZ[gl_WorkGroupSize.z];
readonly buffer roblock
{
int value;
float values[];
} ro;
void foo()
{
ro.values[2] = 4.7; // ERROR, readonly
ro.values.length();
++s;
}
buffer vec4 v; // ERROR
uniform usampler2D us2dbad; // ERROR, default precision
precision highp usampler2D;
precision highp iimage2DArray;
precision highp iimage2D;
uniform usampler2D us2d;
uniform iimage2DArray ii2dabad; // ERROR, not writeonly
uniform writeonly iimage2DArray ii2da;
layout(r32i) uniform iimage2D iimg2D;
layout(rgba32i) uniform iimage2D iimg2Drgba;
layout(rgba32f) uniform image2D img2Drgba;
layout(r32ui) uniform uimage2D uimg2D;
void qux()
{
int i = 4;
imageAtomicCompSwap(iimg2D, ivec2(i,i), i, i);// ERROR no longer in 310
imageAtomicAdd(uimg2D, ivec2(i,i), uint(i)); // ERROR no longer in 310
imageAtomicMin(iimg2Drgba, ivec2(i,i), i); // ERROR no longer in 310 // ERROR iimg2Drgba does not have r32i layout
imageAtomicMax(img2Drgba, ivec2(i,i), i); // ERROR no longer in 310 // ERROR img2Drgba is not integer image
ivec4 pos = imageLoad(iimg2D, ivec2(i,i));
imageStore(ii2da, ivec3(i,i,i), ivec4(0));
imageLoad(img2Drgba, ivec2(i,i));
imageLoad(ii2da, ivec3(i,i,i)); // ERROR, drops writeonly
}
volatile float vol; // ERROR, not an image
readonly int vol2; // ERROR, not an image
void passr(coherent readonly iimage2D image)
{
}
layout(r32i) coherent readonly uniform iimage2D qualim1;
layout(r32i) coherent restrict readonly uniform iimage2D qualim2;
void passrc()
{
passr(qualim1);
passr(qualim2); // ERROR, drops restrict
passr(iimg2D);
}
layout(rg8i) uniform uimage2D i1bad; // ERROR, type mismatch
layout(rgba32i) uniform image2D i2bad; // ERROR, type mismatch
layout(rgba32f) uniform uimage2D i3bad; // ERROR, type mismatch
layout(r8_snorm) uniform iimage2D i4bad; // ERROR, type mismatch
layout(rgba32ui) uniform iimage2D i5bad; // ERROR, type mismatch
layout(r8ui) uniform iimage2D i6bad; // ERROR, type mismatch
layout(binding = 0) uniform atomic_uint counter;
uint func(atomic_uint c)
{
return atomicCounterIncrement(c);
}
uint func2(out atomic_uint c) // ERROR, output
{
return counter; // ERROR, type mismatch
return atomicCounter(counter);
}
void mainAC()
{
atomic_uint non_uniform_counter; // ERROR
uint val = atomicCounter(counter);
atomicCounterDecrement(counter);
}
layout(binding = 1) uniform mediump atomic_uint counterBad; // ERROR, not highp

46
Test/310.frag Normal file
View File

@@ -0,0 +1,46 @@
#version 310 es
precision mediump float;
precision highp usampler2D;
precision highp sampler2D;
precision highp isampler2DArray;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, not supported
layout(location = 2) in vec3 v3;
layout(location = 2) in mat4 yi; // ERROR, locations conflict with xi
uniform sampler2D arrayedSampler[5];
uniform usampler2D usamp2d;
uniform usampler2DRect samp2dr; // ERROR, reserved
uniform isampler2DArray isamp2DA;
in vec2 c2D;
uniform int i;
void main()
{
vec4 v = texture(arrayedSampler[i], c2D); // ERROR
ivec2 offsets[4];
const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2); // ERROR, not supported
vec4 v4 = textureGather(arrayedSampler[0], c2D);
ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i));
}
out vec4 outp;
void foo23()
{
const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(c2D)); // ERROR, offset not constant
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
}

10
Test/310.vert Normal file
View File

@@ -0,0 +1,10 @@
#version 310 es
shared vec4 s; // ERROR
layout(local_size_x = 2) out; // ERROR
buffer vec4 v; // ERROR
layout(location = 2) uniform mat4 x;
layout(location = 3) uniform mat4 y;
layout(location = 2) out mat4 xi;
layout(location = 3) out mat4 yi; // ERROR, locations conflict with xi

View File

@@ -143,7 +143,7 @@ out bblck5 {
layout(xfb_stride=80, xfb_buffer=1, xfb_offset=64) vec4 bbv2;
} bbinst5;
shared vec4 sharedv;
shared vec4 sharedv; // ERROR
void fooBarrier()
{

View File

@@ -9,7 +9,8 @@ uint func(atomic_uint c)
uint func2(out atomic_uint c) // ERROR
{
return counter;
return counter; // ERROR, type mismatch
return atomicCounter(counter);
}
void main()

View File

@@ -19,11 +19,11 @@ ERROR: 0:85: 'dvec3' : Reserved word.
ERROR: 0:85: 'double vector' : not supported with this profile: es
ERROR: 0:86: 'dvec4' : Reserved word.
ERROR: 0:86: 'double vector' : not supported with this profile: es
ERROR: 0:101: 'arrays of arrays' : not supported with this profile: es
ERROR: 0:102: 'arrays of arrays' : not supported with this profile: es
ERROR: 0:102: 'arrays of arrays' : not supported with this profile: es
ERROR: 0:103: 'arrays of arrays' : not supported with this profile: es
ERROR: 0:100: 'arrays of arrays' : not supported with this profile: es
ERROR: 0:101: 'arrays of arrays' : not supported for this version or the enabled extensions
ERROR: 0:102: 'arrays of arrays' : not supported for this version or the enabled extensions
ERROR: 0:102: 'arrays of arrays' : not supported for this version or the enabled extensions
ERROR: 0:103: 'arrays of arrays' : not supported for this version or the enabled extensions
ERROR: 0:100: 'arrays of arrays' : not supported for this version or the enabled extensions
ERROR: 0:111: 'variable indexing fragment shader ouput array' : not supported with this profile: es
ERROR: 0:119: '==' : can't use with samplers or structs containing samplers
ERROR: 0:120: '!=' : can't use with samplers or structs containing samplers

View File

@@ -16,8 +16,8 @@ ERROR: 0:18: 'uniform' : too many storage qualifiers
ERROR: 0:56: '#error' : GL_ES is set
ERROR: 0:62: '' : array size required
ERROR: 0:63: '' : array size required
ERROR: 0:65: '' : array size required
ERROR: 0:64: '' : array size required
ERROR: 0:65: 'implicitly-sized array in a block' : not supported with this profile: es
ERROR: 0:67: '' : array size required
ERROR: 0:76: 'invariant' : cannot change qualification after use
ERROR: 0:78: 'invariant' : can only apply to an output: invIn
@@ -38,7 +38,8 @@ ERROR: 0:149: 'float' : cannot apply precision statement to this type; use 'floa
ERROR: 0:168: 'Binst' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable
ERROR: 0:169: 'Bblock' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable
ERROR: 0:170: 'Bfoo' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable
ERROR: 39 compilation errors. No code generated.
ERROR: 0:173: '' : array size required
ERROR: 40 compilation errors. No code generated.
Shader version: 300

View File

@@ -1,8 +1,9 @@
300layout.frag
ERROR: 0:4: 'location qualifier on input' : not supported in this stage: fragment
ERROR: 0:4: 'location qualifier on input' : not supported for this version or the enabled extensions
ERROR: 0:18: 'location' : overlapping use of location 41
ERROR: 0:19: 'location' : overlapping use of location 40
ERROR: 3 compilation errors. No code generated.
ERROR: 4 compilation errors. No code generated.
Shader version: 300

View File

@@ -13,11 +13,12 @@ ERROR: 0:23: 'bad3' : member of block cannot have a packing layout qualifier
ERROR: 0:31: 'T3' : nameless block contains a member that already has a name at global scope
ERROR: 0:38: 'output block' : not supported with this profile: es
ERROR: 0:42: 'location qualifier on output' : not supported in this stage: vertex
ERROR: 0:50: 'shared' : not supported with this profile: es
ERROR: 0:42: 'location qualifier on output' : not supported for this version or the enabled extensions
ERROR: 0:50: 'shared' : not supported for this version or the enabled extensions
ERROR: 0:50: 'shared' : not supported in this stage: vertex
ERROR: 0:54: 'layout' : cannot specify packing on a variable declaration
ERROR: 0:57: 'location' : overlapping use of location 40
ERROR: 18 compilation errors. No code generated.
ERROR: 19 compilation errors. No code generated.
Shader version: 300

View File

@@ -2,7 +2,7 @@ atomic_uint.frag
Warning, version 420 is not yet complete; most version-specific features are present, but some are missing.
ERROR: 0:10: 'atomic_uint' : samplers and atomic_uints cannot be output parameters
ERROR: 0:12: 'return' : type does not match, or is not convertible to, the function's return type
ERROR: 0:17: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: non_uniform_counter
ERROR: 0:18: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: non_uniform_counter
ERROR: 3 compilation errors. No code generated.
@@ -21,16 +21,19 @@ ERROR: node is still EOpNull!
0:12 Sequence
0:12 Branch: Return with expression
0:12 'counter' (layout(binding=0 ) uniform atomic_uint)
0:15 Function Definition: main( (void)
0:15 Function Parameters:
0:13 Branch: Return with expression
0:13 Function Call: atomicCounter(au1; (uint)
0:13 'counter' (layout(binding=0 ) uniform atomic_uint)
0:16 Function Definition: main( (void)
0:16 Function Parameters:
0:? Sequence
0:18 Sequence
0:18 move second child to first child (uint)
0:18 'val' (uint)
0:18 Function Call: atomicCounter(au1; (uint)
0:18 'counter' (layout(binding=0 ) uniform atomic_uint)
0:19 Function Call: atomicCounterDecrement(au1; (uint)
0:19 'counter' (layout(binding=0 ) uniform atomic_uint)
0:19 Sequence
0:19 move second child to first child (uint)
0:19 'val' (uint)
0:19 Function Call: atomicCounter(au1; (uint)
0:19 'counter' (layout(binding=0 ) uniform atomic_uint)
0:20 Function Call: atomicCounterDecrement(au1; (uint)
0:20 'counter' (layout(binding=0 ) uniform atomic_uint)
0:? Linker Objects
0:? 'counter' (layout(binding=0 ) uniform atomic_uint)
@@ -53,16 +56,19 @@ ERROR: node is still EOpNull!
0:12 Sequence
0:12 Branch: Return with expression
0:12 'counter' (layout(binding=0 ) uniform atomic_uint)
0:15 Function Definition: main( (void)
0:15 Function Parameters:
0:13 Branch: Return with expression
0:13 Function Call: atomicCounter(au1; (uint)
0:13 'counter' (layout(binding=0 ) uniform atomic_uint)
0:16 Function Definition: main( (void)
0:16 Function Parameters:
0:? Sequence
0:18 Sequence
0:18 move second child to first child (uint)
0:18 'val' (uint)
0:18 Function Call: atomicCounter(au1; (uint)
0:18 'counter' (layout(binding=0 ) uniform atomic_uint)
0:19 Function Call: atomicCounterDecrement(au1; (uint)
0:19 'counter' (layout(binding=0 ) uniform atomic_uint)
0:19 Sequence
0:19 move second child to first child (uint)
0:19 'val' (uint)
0:19 Function Call: atomicCounter(au1; (uint)
0:19 'counter' (layout(binding=0 ) uniform atomic_uint)
0:20 Function Call: atomicCounterDecrement(au1; (uint)
0:20 'counter' (layout(binding=0 ) uniform atomic_uint)
0:? Linker Objects
0:? 'counter' (layout(binding=0 ) uniform atomic_uint)

View File

@@ -36,6 +36,9 @@ comment.frag
300layout.frag
300operations.frag
300block.frag
310.comp
310.vert
310.frag
330.frag
330comp.frag
constErrors.frag