• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#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;
7layout(local_size_y = 0) in;      // ERROR, 0 not allowed
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 readonly iimage2D iimg2Drgba;
81layout(rgba32f) uniform readonly image2D img2Drgba;   // ERROR, no default
82layout(r32ui) uniform uimage2D uimg2D;                // ERROR, no default
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);   // ERROR, changing formats
110    passr(qualim2);   // ERROR, drops restrict, ERROR, changing formats
111    passr(iimg2D);    // ERROR, changing formats
112}
113
114highp layout(rg8i)     uniform readonly uimage2D i1bad; // ERROR, type mismatch
115highp layout(rgba32i)  uniform readonly image2D i2bad;  // ERROR, type mismatch
116highp layout(rgba32f)  uniform readonly uimage2D i3bad; // ERROR, type mismatch
117layout(r8_snorm) uniform readonly iimage2D i4bad; // ERROR, type mismatch
118layout(rgba32ui) uniform readonly iimage2D i5bad; // ERROR, type mismatch
119layout(r8ui)     uniform readonly 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
142
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, non-integer
150    countArr[2];
151    countArr[i];
152}
153
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}
164
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
173highp uniform image2DMS i2dms;  // ERROR
174uniform uimage2DMSArray u2dmsa; // ERROR
175
176highp layout(r32f)  coherent volatile restrict readonly writeonly uniform  image2D okay1;
177      layout(r32i)  coherent volatile restrict readonly           uniform iimage2D okay2;
178highp layout(r32ui) coherent volatile restrict          writeonly uniform uimage2D okay3;
179highp layout(r32f)  coherent volatile restrict                    uniform  image2D okay4;
180
181highp layout(rgba32f)  coherent volatile restrict                 uniform  image2D badQ1;  // ERROR, bad qualifiers
182      layout(rgba8i)   coherent volatile restrict                 uniform iimage2D badQ2;  // ERROR, bad qualifiers
183highp layout(rgba16ui) coherent volatile restrict                 uniform uimage2D badQ3;  // ERROR, bad qualifiers
184
185writeonly buffer woblock
186{
187    int value;
188    float values[];
189} wo;
190
191void foowo()
192{
193    float g;
194    g = wo.values[2];            // ERROR, writeonly
195    float f = wo.values[2];      // ERROR, writeonly
196    ++wo.values[2];              // ERROR, writeonly
197    wo.values[2]--;              // ERROR, writeonly
198    f + wo.values[2];            // ERROR, writeonly
199    wo.values[2] - f;            // ERROR, writeonly
200    bool b;
201    b ? f : wo.values[2];        // ERROR, writeonly
202    b ? wo.values[2] : f;        // ERROR, writeonly
203    if (f == wo.values[2])       // ERROR, writeonly
204        ++f;
205    if (f >= wo.values[2])       // ERROR, writeonly
206        ++f;
207    f = vec3(wo.values[2]).x;    // ERROR, writeonly
208    ~wo.value;                   // ERROR, writeonly
209    wo.values[2] = 3.4;
210}
211
212buffer multioblock
213{
214    readonly int value;
215    writeonly float values[];
216} multio;
217
218void foomultio()
219{
220    float g;
221    g = wo.values[2];            // ERROR, writeonly
222    ~wo.value;
223    wo.values[2] = 3.4;
224    wo.value = 2;                // ERROR, readonly
225}
226
227in inb {     // ERROR
228    int a;
229} inbi;
230
231out outb {     // ERROR
232    int a;
233} outbi;
234
235float t__;  // ERROR, no __ until revision 310
236
237    // ERROR, no __ until revision 310
238#define __D
239
240shared vec4 arr[2][3][4];
241
242void devi()
243{
244    gl_DeviceIndex; // ERROR, no extension
245    gl_ViewIndex;   // ERROR, never this stage
246}
247
248#ifdef GL_EXT_device_group
249#extension GL_EXT_device_group : enable
250#endif
251
252void devie()
253{
254    gl_DeviceIndex;
255    gl_ViewIndex;   // ERROR, never this stage
256}
257