• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 320 es
2
3out outbname { int a; } outbinst;   // ERROR, not out block in fragment shader
4
5in inbname {
6    int a;
7    vec4 v;
8    struct { int b; } s;     // ERROR, nested struct definition
9} inbinst;
10
11in inbname2 {
12    layout(location = 12) int aAnon;
13    layout(location = 13) centroid in vec4 vAnon;
14};
15
16in layout(location = 13) vec4 aliased; // ERROR, aliased
17
18in inbname2 {                // ERROR, reuse of block name
19    int aAnon;
20    centroid in vec4 vAnon;
21};
22
23in badmember {               // ERROR, aAnon already in global scope
24    int aAnon;
25};
26
27int inbname;                 // ERROR, redefinition of block name
28
29vec4 vAnon;                  // ERROR, anon in global scope; redefinition
30
31in arrayed {
32    float f;
33} arrayedInst[4];
34uniform int i;
35void fooIO()
36{
37    vec4 v = inbinst.v + vAnon;
38    v *= arrayedInst[2].f;
39    v *= arrayedInst[i].f;
40}
41
42in vec4 gl_FragCoord;
43layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;  // ERROR, non-ES
44
45layout(early_fragment_tests) in;
46out float gl_FragDepth;
47layout(depth_any) out float gl_FragDepth;  // ERROR, non-ES
48
49void main()
50{
51    gl_FragDepth = 0.2;  // ERROR, early_fragment_tests declared
52    bool f = gl_FrontFacing;
53}
54
55out float gl_FragDepth;
56
57void foo_GS()
58{
59    highp int l = gl_Layer;
60    highp int p = gl_PrimitiveID;
61}
62
63in vec2 inf, ing;
64uniform ivec2 offsets[4];
65uniform sampler2D sArray[4];
66uniform int sIndex;
67layout(binding = 0) uniform atomic_uint auArray[2];
68uniform ubName { int i; } ubInst[4];
69buffer bbName { int i; } bbInst[4];
70highp uniform writeonly image2D iArray[5];
71const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
72
73void pfoo()
74{
75    precise vec2 h;
76    h = fma(inf, ing, h);
77    textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
78    textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
79    textureGatherOffsets(sArray[0], vec2(0.1), offsets);       // ERROR, offset not constant
80}
81
82precision highp imageCubeArray        ;
83precision highp iimageCubeArray       ;
84precision highp uimageCubeArray       ;
85
86precision highp samplerCubeArray      ;
87precision highp samplerCubeArrayShadow;
88precision highp isamplerCubeArray     ;
89precision highp usamplerCubeArray     ;
90
91uniform writeonly imageCubeArray  CA1;
92uniform writeonly iimageCubeArray CA2;
93uniform writeonly uimageCubeArray CA3;
94
95#ifdef GL_EXT_texture_cube_map_array
96uniform samplerCubeArray          CA4;
97uniform samplerCubeArrayShadow    CA5;
98uniform isamplerCubeArray         CA6;
99uniform usamplerCubeArray         CA7;
100#endif
101
102void CAT()
103{
104    highp vec4 b4 = texture(CA4, vec4(0.5), 0.24);
105    highp ivec4 b6 = texture(CA6, vec4(0.5), 0.26);
106    highp uvec4 b7 = texture(CA7, vec4(0.5), 0.27);
107}
108
109void goodSample()
110{
111    lowp     int  a1 = gl_SampleID;
112    mediump  vec2 a2 = gl_SamplePosition;
113    highp    int  a3 = gl_SampleMaskIn[0];
114    gl_SampleMask[0] = a3;
115    mediump int n1 = gl_MaxSamples;
116    mediump int n2 = gl_NumSamples;
117}
118
119uniform layout(r32f)  highp  image2D im2Df;
120uniform layout(r32ui) highp uimage2D im2Du;
121uniform layout(r32i)  highp iimage2D im2Di;
122uniform ivec2 P;
123
124uniform layout(rgba32f)  highp  image2D badIm2Df;  // ERROR, needs readonly or writeonly
125uniform layout(rgba8ui) highp uimage2D badIm2Du;   // ERROR, needs readonly or writeonly
126uniform layout(rgba16i)  highp iimage2D badIm2Di;  // ERROR, needs readonly or writeonly
127
128void goodImageAtom()
129{
130    float datf;
131    int dati;
132    uint datu;
133
134    imageAtomicAdd(     im2Di, P, dati);
135    imageAtomicAdd(     im2Du, P, datu);
136    imageAtomicMin(     im2Di, P, dati);
137    imageAtomicMin(     im2Du, P, datu);
138    imageAtomicMax(     im2Di, P, dati);
139    imageAtomicMax(     im2Du, P, datu);
140    imageAtomicAnd(     im2Di, P, dati);
141    imageAtomicAnd(     im2Du, P, datu);
142    imageAtomicOr(      im2Di, P, dati);
143    imageAtomicOr(      im2Du, P, datu);
144    imageAtomicXor(     im2Di, P, dati);
145    imageAtomicXor(     im2Du, P, datu);
146    imageAtomicExchange(im2Di, P, dati);
147    imageAtomicExchange(im2Du, P, datu);
148    imageAtomicExchange(im2Df, P, datf);
149    imageAtomicCompSwap(im2Di, P,  3, dati);
150    imageAtomicCompSwap(im2Du, P, 5u, datu);
151
152    imageAtomicMax(badIm2Di, P, dati);      // ERROR, not an allowed layout() on the image
153    imageAtomicMax(badIm2Du, P, datu);      // ERROR, not an allowed layout() on the image
154    imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
155}
156
157centroid out vec4 colorCentroidBad;  // ERROR
158flat out vec4 colorBadFlat;          // ERROR
159smooth out vec4 colorBadSmooth;      // ERROR
160noperspective out vec4 colorBadNo;   // ERROR
161flat centroid in vec2 colorfc;
162in float scalarIn;
163
164sample in vec4 colorSampIn;
165sample out vec4 colorSampleBad;     // ERROR
166flat sample in vec4 colorfsi;
167sample in vec3 sampInArray[4];
168
169void interp()
170{
171    float res;
172    vec2 res2;
173    vec3 res3;
174    vec4 res4;
175
176    res2 = interpolateAtCentroid(colorfc);
177    res4 = interpolateAtCentroid(colorSampIn);
178    res4 = interpolateAtCentroid(colorfsi);
179    res  = interpolateAtCentroid(scalarIn);
180    res3 = interpolateAtCentroid(sampInArray);         // ERROR
181    res3 = interpolateAtCentroid(sampInArray[2]);
182    res2 = interpolateAtCentroid(sampInArray[2].xy);   // ERROR
183
184    res3 = interpolateAtSample(sampInArray, 1);        // ERROR
185    res3 = interpolateAtSample(sampInArray[i], 0);
186    res2 = interpolateAtSample(sampInArray[2].xy, 2);  // ERROR
187    res  = interpolateAtSample(scalarIn, 1);
188
189    res3 = interpolateAtOffset(sampInArray, vec2(0.2));         // ERROR
190    res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
191    res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2));   // ERROR, no swizzle
192    res  = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
193    res  = interpolateAtOffset(scalarIn, vec2(0.2));
194
195    float f;
196    res  = interpolateAtCentroid(f);           // ERROR, not interpolant
197    res4 = interpolateAtSample(outp, 0);       // ERROR, not interpolant
198}
199
200layout(blend_support_multiply) out;
201layout(blend_support_screen) out;
202layout(blend_support_overlay) out;
203layout(blend_support_darken, blend_support_lighten) out;
204layout(blend_support_colordodge) layout(blend_support_colorburn) out;
205layout(blend_support_hardlight) out;
206layout(blend_support_softlight) out;
207layout(blend_support_difference) out;
208layout(blend_support_exclusion) out;
209layout(blend_support_hsl_hue) out;
210layout(blend_support_hsl_saturation) out;
211layout(blend_support_hsl_color) out;
212layout(blend_support_hsl_luminosity) out;
213layout(blend_support_all_equations) out;
214
215layout(blend_support_hsl_luminosity) out;              // okay to repeat
216
217layout(blend_support_hsl_luminosity) in;                       // ERROR, only on "out"
218layout(blend_support_hsl_luminosity) out vec4;                 // ERROR, only on standalone
219layout(blend_support_hsl_luminosity) out vec4 badout;          // ERROR, only on standalone
220layout(blend_support_hsl_luminosity) struct badS {int i;};     // ERROR, only on standalone
221layout(blend_support_hsl_luminosity) void blendFoo() { }       // ERROR, only on standalone
222void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on standalone
223layout(blend_support_flizbit) out;                             // ERROR, no flizbit
224
225out vec4 outAA[2][2];  // ERROR
226