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