• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 400 core
2
3in vec2 c2D;
4flat in int i;
5out vec4 outp;
6uniform sampler2D arrayedSampler[5];
7uniform usampler2DRect samp2dr;
8uniform isampler2DArray isamp2DA;
9
10#extension GL_ARB_shader_storage_buffer_object : enable
11
12buffer Buffer
13{
14    int atomi;
15    uint atomu;
16};
17
18void atomicOpPass()
19{
20    int origi = atomicAdd(atomi, 3);
21    uint origu = atomicAnd(atomu, 7u);
22    origi = atomicExchange(atomi, 4);
23    origu = atomicCompSwap(atomu, 10u, 8u);
24}
25
26buffer ssboElem01
27{
28    int member01;
29    int memberArr01[2];
30    int memberUnsizedArr01[];
31} ssboStd430Arr[2];
32
33// if turns on EShReflectionSharedStd140SSBO, SPIR-V would be different
34buffer ssboElem02
35{
36    int member02;
37    int memberArr02[2];
38    int memberUnsizedArr02[];
39} ssboSharedArr[2];
40
41#extension GL_ARB_shader_storage_buffer_object : disable
42
43void main()
44{
45    vec4 v;
46    v = texture(arrayedSampler[i], c2D);
47    outp.x = gl_ClipDistance[1];
48
49    ivec2 offsets[4];
50    const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
51    uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2);  // ERROR, offsets not constant
52    uv4 = textureGatherOffsets(samp2dr, c2D, constOffsets, 2);
53    vec4 v4 = textureGather(arrayedSampler[0], c2D);
54    ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
55    iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i);  // ERROR, last argument not const
56    iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4);  // ERROR, last argument out of range
57    iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
58    iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i));
59
60    vec4 c = gl_FragCoord;
61}
62
63layout(location = 4) in vec4 vl; // ERROR, not supported
64
65#ifdef GL_ARB_separate_shader_objects
66#extension GL_ARB_separate_shader_objects : enable
67#endif
68
69layout(location = 6) in vec4 vl2;
70
71layout(location = 3) uniform vec3 uv3;
72
73layout(location = 5) in vec4 gl_Color;      // ERROR, layout
74noperspective in float gl_ClipDistance[4];  // ERROR, can't change qualifier
75
76layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;  // ERROR, declared after use
77
78uniform sampler2DRectShadow u2drs;
79
80void foo23()
81{
82    const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
83
84    textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), ivec2(c2D));     // ERROR, offset not constant
85    textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), offsets[1]);
86    textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), offsets[2]);     // ERROR, offset out of range
87    textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
88}
89
90patch in vec4 patchIn;              // ERROR
91patch out vec4 patchOut;            // ERROR
92
93void foo24()
94{
95    dvec3 df, di;
96    df = modf(dvec3(outp.xyz), di);
97}
98
99in float in1;
100in vec2 in2;
101in vec3 in3;
102in vec4 in4;
103
104void foodc1()
105{
106    vec2 v2 = dFdxFine(in2);           // ERROR
107    vec3 v3 = dFdyCoarse(in3);         // ERROR
108    vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4);   // ERROR
109}
110
111#extension GL_ARB_derivative_control : enable
112
113void foodc2()
114{
115    vec2 v2 = dFdxFine(in2);
116    vec3 v3 = dFdyCoarse(in3);
117    vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4);
118
119    uint u1;
120    ivec3 i3;
121    ivec2 i2;
122    v2 = frexp(v2, i2);
123    v3 = ldexp(v3, i3);
124
125    u1 = packUnorm4x8(v4);
126    u1 = packSnorm4x8(v4);
127    v4 = unpackUnorm4x8(u1);
128    v4 = unpackSnorm4x8(u1);
129
130    double d;
131    uvec2 u2;
132    d = packDouble2x32(u2);
133    u2 = unpackDouble2x32(d);
134}
135
136sample in vec4 colorSampIn;
137sample out vec4 colorSampleBad;     // ERROR
138noperspective in vec4 colorfsi;
139sample in vec3 sampInArray[4];
140smooth in float scalarIn;
141flat centroid in vec2 colorfc;
142
143struct S {
144    float x;
145};
146
147in S s1;
148sample S s2;
149
150void interp()
151{
152    interpolateAtCentroid(colorfc);
153    interpolateAtCentroid(colorSampIn);
154    interpolateAtCentroid(colorfsi);
155    interpolateAtCentroid(scalarIn);
156    interpolateAtCentroid(sampInArray);         // ERROR
157    interpolateAtCentroid(sampInArray[2]);
158    interpolateAtCentroid(sampInArray[2].xy);   // ERROR
159
160    interpolateAtSample(sampInArray, 1);        // ERROR
161    interpolateAtSample(sampInArray[i], 0);
162    interpolateAtSample(s1.x, 2);
163    interpolateAtSample(scalarIn, 1);
164
165    interpolateAtOffset(sampInArray, vec2(0.2));         // ERROR
166    interpolateAtOffset(sampInArray[2], vec2(0.2));
167    interpolateAtOffset(sampInArray[2].xy, vec2(0.2));   // ERROR, no swizzle
168    interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
169    interpolateAtOffset(s2.x, vec2(0.2));      // ERROR
170
171    float f;
172    interpolateAtCentroid(f);           // ERROR, not interpolant
173    interpolateAtSample(outp, 0);       // ERROR, not interpolant
174}
175
176uniform sampler1D samp1D;
177uniform isampler2D isamp2D;
178uniform usampler3D usamp3D;
179uniform samplerCube sampCube;
180uniform isampler1DArray isamp1DA;
181uniform usampler2DArray usamp2DA;
182uniform isamplerCubeArray isampCubeA;
183
184uniform sampler1DShadow samp1Ds;
185uniform sampler2DShadow samp2Ds;
186uniform samplerCubeShadow sampCubes;
187uniform sampler1DArrayShadow samp1DAs;
188uniform sampler2DArrayShadow samp2DAs;
189uniform samplerCubeArrayShadow sampCubeAs;
190
191uniform samplerBuffer sampBuf;
192uniform sampler2DRect sampRect;
193
194void qlod()
195{
196    vec2 lod;
197    float pf;
198    vec2 pf2;
199    vec3 pf3;
200
201    lod = textureQueryLod(samp1D, pf);
202    lod = textureQueryLod(isamp2D, pf2);
203    lod = textureQueryLod(usamp3D, pf3);
204    lod = textureQueryLod(sampCube, pf3);
205    lod = textureQueryLod(isamp1DA, pf);
206    lod = textureQueryLod(usamp2DA, pf2);
207    lod = textureQueryLod(isampCubeA, pf3);
208
209    lod = textureQueryLod(samp1Ds, pf);
210    lod = textureQueryLod(samp2Ds, pf2);
211    lod = textureQueryLod(sampCubes, pf3);
212    lod = textureQueryLod(samp1DAs, pf);
213    lod = textureQueryLod(samp2DAs, pf2);
214    lod = textureQueryLod(sampCubeAs, pf3);
215
216    lod = textureQueryLod(sampBuf, pf);     // ERROR
217    lod = textureQueryLod(sampRect, pf2);   // ERROR
218}
219
220uniform uint uu;
221out uint iout;
222
223void bitwiseConv()
224{
225    iout = uu & i;
226    iout += uu ^ i;
227    iout += i | uu;
228}
229
230subroutine(subT1, subT2);
231subroutine float subT1() { return 1.0; }
232subroutine float subT2() { return 1.0; }
233
234struct SKeyMem { int precise; } KeyMem;     // ERROR, keyword can't be a member
235