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