blob: f2cd8c57a5f7365fc7c7898a65775fdec3f7fb34 [file] [log] [blame]
John Kessenich4d570902014-08-12 22:07:22 +00001#version 310 es
2
3layout(local_size_x = 2) in;
4layout(local_size_x = 16) in; // ERROR, changing
5layout(local_size_z = 4096) in; // ERROR, too large
6layout(local_size_x = 2) in;
7
8const int total = gl_MaxComputeWorkGroupCount.y
9 + gl_MaxComputeUniformComponents
10 + gl_MaxComputeTextureImageUnits
11 + gl_MaxComputeImageUniforms
12 + gl_MaxComputeAtomicCounters
13 + gl_MaxComputeAtomicCounterBuffers;
14
15buffer ShaderStorageBlock
16{
17 int value;
18 float values[];
19};
20
21buffer InvalidShaderStorageBlock
22{
23 float values[]; // ERROR
24 int value;
25} invalid;
26
27void main()
28{
29 barrier();
30 memoryBarrier();
31 memoryBarrierAtomicCounter();
32 memoryBarrierBuffer();
33 memoryBarrierShared();
34 memoryBarrierImage();
35 groupMemoryBarrier();
36 value = int(values[gl_LocalInvocationIndex]);
37}
38
39layout(location = 2) in vec3 v3; // ERROR
40in float f; // ERROR
41out float fo; // ERROR
42
43shared vec4 s;
44layout(location = 2) shared vec4 sl; // ERROR
45shared float fs = 4.2; // ERROR
46
47layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) out; // ERROR
48
49int arrX[gl_WorkGroupSize.x];
50int arrY[gl_WorkGroupSize.y];
51int arrZ[gl_WorkGroupSize.z];
52
53readonly buffer roblock
54{
55 int value;
56 float values[];
57} ro;
58
59void foo()
60{
61 ro.values[2] = 4.7; // ERROR, readonly
62 ro.values.length();
63 ++s;
64}
65
66buffer vec4 v; // ERROR
67
68uniform usampler2D us2dbad; // ERROR, default precision
69
70precision highp usampler2D;
71precision highp iimage2DArray;
72precision highp iimage2D;
73
74uniform usampler2D us2d;
75
76uniform iimage2DArray ii2dabad; // ERROR, not writeonly
77uniform writeonly iimage2DArray ii2da;
78
79layout(r32i) uniform iimage2D iimg2D;
80layout(rgba32i) uniform iimage2D iimg2Drgba;
81layout(rgba32f) uniform image2D img2Drgba;
82layout(r32ui) uniform uimage2D uimg2D;
83
84void qux()
85{
86 int i = 4;
87 imageAtomicCompSwap(iimg2D, ivec2(i,i), i, i);// ERROR no longer in 310
88 imageAtomicAdd(uimg2D, ivec2(i,i), uint(i)); // ERROR no longer in 310
89 imageAtomicMin(iimg2Drgba, ivec2(i,i), i); // ERROR no longer in 310 // ERROR iimg2Drgba does not have r32i layout
90 imageAtomicMax(img2Drgba, ivec2(i,i), i); // ERROR no longer in 310 // ERROR img2Drgba is not integer image
91 ivec4 pos = imageLoad(iimg2D, ivec2(i,i));
92 imageStore(ii2da, ivec3(i,i,i), ivec4(0));
93 imageLoad(img2Drgba, ivec2(i,i));
94 imageLoad(ii2da, ivec3(i,i,i)); // ERROR, drops writeonly
95}
96
97volatile float vol; // ERROR, not an image
98readonly int vol2; // ERROR, not an image
99
100void passr(coherent readonly iimage2D image)
101{
102}
103
104layout(r32i) coherent readonly uniform iimage2D qualim1;
105layout(r32i) coherent restrict readonly uniform iimage2D qualim2;
106
107void passrc()
108{
109 passr(qualim1);
110 passr(qualim2); // ERROR, drops restrict
111 passr(iimg2D);
112}
113
114layout(rg8i) uniform uimage2D i1bad; // ERROR, type mismatch
115layout(rgba32i) uniform image2D i2bad; // ERROR, type mismatch
116layout(rgba32f) uniform uimage2D i3bad; // ERROR, type mismatch
117layout(r8_snorm) uniform iimage2D i4bad; // ERROR, type mismatch
118layout(rgba32ui) uniform iimage2D i5bad; // ERROR, type mismatch
119layout(r8ui) uniform iimage2D i6bad; // ERROR, type mismatch
120
121layout(binding = 0) uniform atomic_uint counter;
122
123uint func(atomic_uint c)
124{
125 return atomicCounterIncrement(c);
126}
127
128uint func2(out atomic_uint c) // ERROR, output
129{
130 return counter; // ERROR, type mismatch
131 return atomicCounter(counter);
132}
133
134void mainAC()
135{
136 atomic_uint non_uniform_counter; // ERROR
137 uint val = atomicCounter(counter);
138 atomicCounterDecrement(counter);
139}
140
141layout(binding = 1) uniform mediump atomic_uint counterBad; // ERROR, not highp
John Kessenich265f5fb2014-08-13 01:04:28 +0000142
143layout(binding = 2, offset = 4) uniform atomic_uint countArr[4];
144uniform int i;
145
146void opac()
147{
148 int a[3];
149 a[counter]; // ERROR
150 countArr[2];
151 countArr[i];
152}
John Kessenichdf1d81a2014-08-13 08:32:15 +0000153
154shared int atomi;
155shared uint atomu;
156
157void atoms()
158{
159 int origi = atomicAdd(atomi, 3);
160 uint origu = atomicAnd(atomu, 7u);
161 origi = atomicExchange(atomi, 4);
162 origu = atomicCompSwap(atomu, 10u, 8u);
163}
John Kessenichb3007512014-08-14 07:07:21 +0000164
165precision highp atomic_uint;
166precision lowp atomic_uint; // ERROR
167
168precise int pfoo; // ERROR, reserved
169
170dmat2x4 dm; // ERROR
171uniform samplerCubeArray sca; // ERROR
172uniform iimage2DRect i2dr; // ERROR
173uniform image2DMS i2dms; // ERROR
174uniform uimage2DMSArray u2dmsa; // ERROR