• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 320 es
2
3out outbname {
4    int a;
5    out vec4 v;
6    highp sampler2D s;   // ERROR, opaque type
7} outbinst;
8
9out outbname2 {
10    layout(location = 12) int aAnon;
11    layout(location = 13) vec4 vAnon;
12};
13
14layout(location = 12) out highp int aliased;  // ERROR, aliasing location
15
16in inbname { int a; } inbinst;  // ERROR, no in block in vertex shader
17
18out gl_PerVertex {              // ERROR, has extra member
19    highp vec4 gl_Position;
20    highp vec4 t;
21};
22
23void main()
24{
25    int sum  = gl_VertexID +
26               gl_InstanceID;
27    gl_Position = vec4(1.0);
28    gl_PointSize = 2.0;         // ERROR, removed by redeclaration
29}
30
31out gl_PerVertex {              // ERROR, already used and already redeclared
32    highp vec4 gl_Position;
33    highp vec4 t;
34};
35
36smooth out smo {                // ERROR, no smooth on a block
37    int i;
38} smon;
39
40flat out fmo {                  // ERROR, no flat on a block
41    int i;
42} fmon;
43
44centroid out cmo {              // ERROR, no centroid on a block
45    int i;
46} cmon;
47
48invariant out imo {             // ERROR, no invariant on a block
49    int i;
50} imon;
51
52in vec2 inf, ing;
53uniform ivec2 offsets[4];
54uniform sampler2D sArray[4];
55uniform int sIndex;
56layout(binding = 0) uniform atomic_uint auArray[2];
57uniform ubName { int i; } ubInst[4];
58buffer bbName { int i; } bbInst[4];
59highp uniform writeonly image2D iArray[5];
60const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
61
62void pfoo()
63{
64    precise vec2 h;
65    h = fma(inf, ing, h);
66    sArray[sIndex + 1];
67    ubInst[sIndex + 1];
68    bbInst[sIndex - 2];      // ERROR, still not supported
69    iArray[2];
70    iArray[sIndex - 2];
71    textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
72    textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
73    textureGatherOffsets(sArray[0], vec2(0.1), offsets);   // ERROR, offset not constant
74}
75
76uniform samplerBuffer  noPreSamp1;            // ERROR, no default precision
77uniform isamplerBuffer noPreSamp2;            // ERROR, no default precision
78uniform usamplerBuffer noPreSamp3;            // ERROR, no default precision
79uniform writeonly imageBuffer    noPreSamp4;  // ERROR, no default precision
80uniform writeonly iimageBuffer   noPreSamp5;  // ERROR, no default precision
81uniform writeonly uimageBuffer   noPreSamp6;  // ERROR, no default precision
82
83precision highp samplerBuffer;
84precision highp isamplerBuffer;
85precision highp usamplerBuffer;
86precision highp imageBuffer;
87precision highp iimageBuffer;
88precision highp uimageBuffer;
89
90#ifdef GL_OES_texture_buffer
91uniform samplerBuffer  bufSamp1;
92uniform isamplerBuffer bufSamp2;
93uniform usamplerBuffer bufSamp3;
94#endif
95#ifdef GL_EXT_texture_buffer
96uniform writeonly imageBuffer    bufSamp4;
97uniform writeonly iimageBuffer   bufSamp5;
98uniform writeonly uimageBuffer   bufSamp6;
99#endif
100
101void bufferT()
102{
103    highp int s1 = textureSize(bufSamp1);
104    highp int s2 = textureSize(bufSamp2);
105    highp int s3 = textureSize(bufSamp3);
106
107    highp int s4 = imageSize(bufSamp4);
108    highp int s5 = imageSize(bufSamp5);
109    highp int s6 = imageSize(bufSamp6);
110
111    highp vec4 f1 = texelFetch(bufSamp1, s1);
112    highp ivec4 f2 = texelFetch(bufSamp2, s2);
113    highp uvec4 f3 = texelFetch(bufSamp3, s3);
114}
115
116uniform writeonly imageCubeArray  noPreCA1;   // ERROR, no default precision
117uniform writeonly iimageCubeArray noPreCA2;   // ERROR, no default precision
118uniform writeonly uimageCubeArray noPreCA3;   // ERROR, no default precision
119
120uniform samplerCubeArray          noPreCA4;   // ERROR, no default precision
121uniform samplerCubeArrayShadow    noPreCA5;   // ERROR, no default precision
122uniform isamplerCubeArray         noPreCA6;   // ERROR, no default precision
123uniform usamplerCubeArray         noPreCA7;   // ERROR, no default precision
124
125precision highp imageCubeArray        ;
126precision highp iimageCubeArray       ;
127precision highp uimageCubeArray       ;
128
129precision highp samplerCubeArray      ;
130precision highp samplerCubeArrayShadow;
131precision highp isamplerCubeArray     ;
132precision highp usamplerCubeArray     ;
133
134uniform writeonly imageCubeArray  CA1;
135uniform writeonly iimageCubeArray CA2;
136uniform writeonly uimageCubeArray CA3;
137
138layout(rgba16f) uniform readonly imageCubeArray  rCA1;
139layout(rgba32i) uniform readonly iimageCubeArray rCA2;
140layout(r32ui) uniform readonly uimageCubeArray rCA3;
141
142#ifdef GL_OES_texture_cube_map_array
143uniform samplerCubeArray          CA4;
144uniform samplerCubeArrayShadow    CA5;
145uniform isamplerCubeArray         CA6;
146uniform usamplerCubeArray         CA7;
147#endif
148
149void CAT()
150{
151    highp ivec3 s4 = textureSize(CA4, 1);
152    highp ivec3 s5 = textureSize(CA5, 1);
153    highp ivec3 s6 = textureSize(CA6, 1);
154    highp ivec3 s7 = textureSize(CA7, 1);
155
156    highp vec4 t4 = texture(CA4, vec4(0.5));
157    highp float t5 = texture(CA5, vec4(0.5), 3.0);
158    highp ivec4 t6 = texture(CA6, vec4(0.5));
159    highp uvec4 t7 = texture(CA7, vec4(0.5));
160
161    highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24);
162    highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26);
163    highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27);
164
165    highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2));
166    highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2));
167    highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2));
168
169    highp vec4 gath4 = textureGather(CA4, vec4(0.5));
170    highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2);
171    highp ivec4 gath6 = textureGather(CA6, vec4(0.5));
172    highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1);
173    highp uvec4 gath7 = textureGather(CA7, vec4(0.5));
174    highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0);
175
176    highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5);
177
178    highp ivec3 s1 = imageSize(CA1);
179    highp ivec3 s2 = imageSize(CA2);
180    highp ivec3 s3 = imageSize(CA3);
181
182    imageStore(CA1, s3, vec4(1));
183    imageStore(CA2, s3, ivec4(1));
184    imageStore(CA3, s3, uvec4(1));
185
186    highp vec4 cl1 = imageLoad(rCA1, s3);
187    highp ivec4 cl2 = imageLoad(rCA2, s3);
188    highp uvec4 cl3 = imageLoad(rCA3, s3);
189}
190
191uniform sampler2DMSArray  noPrec2DMS;    // ERROR, no default
192uniform isampler2DMSArray noPrec2DMSi;   // ERROR, no default
193uniform usampler2DMSArray noPrec2DMSu;   // ERROR, no default
194
195precision highp sampler2DMSArray;
196precision highp isampler2DMSArray;
197precision highp usampler2DMSArray;
198
199uniform sampler2DMSArray  samp2DMSA;
200uniform isampler2DMSArray samp2DMSAi;
201uniform usampler2DMSArray samp2DMSAu;
202
203void MSA()
204{
205    vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2);
206    ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2);
207    uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2);
208
209    ivec3 tfs = textureSize(samp2DMSA);
210    ivec3 tfsi = textureSize(samp2DMSAi);
211    ivec3 tfsb = textureSize(samp2DMSAi, 4);  // ERROR, no lod
212    ivec3 tfsu = textureSize(samp2DMSAu);
213}
214
215uniform layout(r32f)  highp  image2D im2Df;
216uniform layout(r32ui) highp uimage2D im2Du;
217uniform layout(r32i)  highp iimage2D im2Di;
218uniform ivec2 P;
219
220void goodImageAtom()
221{
222    float datf;
223    int dati;
224    uint datu;
225
226    imageAtomicAdd(     im2Di, P, dati);
227    imageAtomicAdd(     im2Du, P, datu);
228    imageAtomicMin(     im2Di, P, dati);
229    imageAtomicMin(     im2Du, P, datu);
230    imageAtomicMax(     im2Di, P, dati);
231    imageAtomicMax(     im2Du, P, datu);
232    imageAtomicAnd(     im2Di, P, dati);
233    imageAtomicAnd(     im2Du, P, datu);
234    imageAtomicOr(      im2Di, P, dati);
235    imageAtomicOr(      im2Du, P, datu);
236    imageAtomicXor(     im2Di, P, dati);
237    imageAtomicXor(     im2Du, P, datu);
238    imageAtomicExchange(im2Di, P, dati);
239    imageAtomicExchange(im2Du, P, datu);
240    imageAtomicExchange(im2Df, P, datf);
241    imageAtomicCompSwap(im2Di, P,  3, dati);
242    imageAtomicCompSwap(im2Du, P, 5u, datu);
243}
244
245sample out vec4 colorSample;
246flat sample out vec4 colorfsi;
247sample out vec3 sampInArray[4];
248in vec4 inv4;
249
250void badInterp()
251{
252    interpolateAtCentroid(inv4);             // ERROR, wrong stage
253    interpolateAtSample(inv4, 1);            // ERROR, need extension
254    interpolateAtOffset(inv4, vec2(0.2));    // ERROR, need extension
255}
256