1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
4 *
5 * Copyright 2016 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief Negative Shader Directive Tests
22 *//*--------------------------------------------------------------------*/
23
24 #include "es31fNegativeShaderDirectiveTests.hpp"
25
26 #include "gluShaderProgram.hpp"
27
28 namespace deqp
29 {
30 namespace gles31
31 {
32 namespace Functional
33 {
34 namespace NegativeTestShared
35 {
36 namespace
37 {
38
39 enum ExpectResult
40 {
41 EXPECT_RESULT_PASS = 0,
42 EXPECT_RESULT_FAIL,
43
44 EXPECT_RESULT_LAST
45 };
46
verifyProgram(NegativeTestContext & ctx,glu::ProgramSources sources,ExpectResult expect)47 void verifyProgram(NegativeTestContext& ctx, glu::ProgramSources sources, ExpectResult expect)
48 {
49 DE_ASSERT(expect >= EXPECT_RESULT_PASS && expect < EXPECT_RESULT_LAST);
50
51 tcu::TestLog& log = ctx.getLog();
52 const glu::ShaderProgram program (ctx.getRenderContext(), sources);
53 bool testFailed = false;
54 std::string message;
55
56 log << program;
57
58 if (expect == EXPECT_RESULT_PASS)
59 {
60 testFailed = !program.getProgramInfo().linkOk;
61 message = "Program did not link.";
62 }
63 else
64 {
65 testFailed = program.getProgramInfo().linkOk;
66 message = "Program was not expected to link.";
67 }
68
69 if (testFailed)
70 {
71 log << tcu::TestLog::Message << message << tcu::TestLog::EndMessage;
72 ctx.fail(message);
73 }
74 }
75
verifyShader(NegativeTestContext & ctx,glu::ShaderType shaderType,std::string shaderSource,ExpectResult expect)76 void verifyShader(NegativeTestContext& ctx, glu::ShaderType shaderType, std::string shaderSource, ExpectResult expect)
77 {
78 DE_ASSERT(expect >= EXPECT_RESULT_PASS && expect < EXPECT_RESULT_LAST);
79
80 tcu::TestLog& log = ctx.getLog();
81 bool testFailed = false;
82 const char* const source = shaderSource.c_str();
83 const int length = (int) shaderSource.size();
84 glu::Shader shader (ctx.getRenderContext(), shaderType);
85 std::string message;
86
87 shader.setSources(1, &source, &length);
88 shader.compile();
89
90 log << shader;
91
92 if (expect == EXPECT_RESULT_PASS)
93 {
94 testFailed = !shader.getCompileStatus();
95 message = "Shader did not compile.";
96 }
97 else
98 {
99 testFailed = shader.getCompileStatus();
100 message = "Shader was not expected to compile.";
101 }
102
103 if (testFailed)
104 {
105 log << tcu::TestLog::Message << message << tcu::TestLog::EndMessage;
106 ctx.fail(message);
107 }
108 }
109
primitive_bounding_box(NegativeTestContext & ctx)110 void primitive_bounding_box (NegativeTestContext& ctx)
111 {
112 if (ctx.isShaderSupported(glu::SHADERTYPE_TESSELLATION_CONTROL))
113 {
114 ctx.beginSection("GL_EXT_primitive_bounding_box features require enabling the extension in 310 es shaders.");
115 std::ostringstream source;
116 source << "#version 310 es\n"
117 "void main()\n"
118 "{\n"
119 " gl_BoundingBoxEXT[0] = vec4(0.0, 0.0, 0.0, 0.0);\n"
120 " gl_BoundingBoxEXT[1] = vec4(1.0, 1.0, 1.0, 1.0);\n"
121 "}\n";
122 verifyShader(ctx, glu::SHADERTYPE_TESSELLATION_CONTROL, source.str(), EXPECT_RESULT_FAIL);
123 ctx.endSection();
124 }
125
126 if (contextSupports(ctx.getRenderContext().getType() , glu::ApiType::es(3, 2)))
127 {
128 ctx.beginSection("gl_BoundingBox does not require the OES/EXT suffix in a 320 es shader.");
129 {
130 const std::string source = "#version 320 es\n"
131 "layout(vertices = 3) out;\n"
132 "void main()\n"
133 "{\n"
134 " gl_BoundingBox[0] = vec4(0.0, 0.0, 0.0, 0.0);\n"
135 " gl_BoundingBox[1] = vec4(0.0, 0.0, 0.0, 0.0);\n"
136 "}\n";
137 verifyShader(ctx, glu::SHADERTYPE_TESSELLATION_CONTROL, source, EXPECT_RESULT_PASS);
138 }
139 ctx.endSection();
140
141 ctx.beginSection("Invalid index used when assigning to gl_BoundingBox in 320 es shader.");
142 {
143 const std::string source = "#version 320 es\n"
144 "layout(vertices = 3) out;\n"
145 "void main()\n"
146 "{\n"
147 " gl_BoundingBox[0] = vec4(0.0, 0.0, 0.0, 0.0);\n"
148 " gl_BoundingBox[2] = vec4(0.0, 0.0, 0.0, 0.0);\n"
149 "}\n";
150 verifyShader(ctx, glu::SHADERTYPE_TESSELLATION_CONTROL, source, EXPECT_RESULT_FAIL);
151 }
152 ctx.endSection();
153
154 ctx.beginSection("Invalid type assignment to per-patch output array in 320 es shader.");
155 {
156 const std::string source = "#version 320 es\n"
157 "layout(vertices = 3) out;\n"
158 "void main()\n"
159 "{\n"
160 " gl_BoundingBox[0] = ivec4(0, 0, 0, 0);\n"
161 " gl_BoundingBox[1] = ivec4(0, 0, 0, 0);\n"
162 "}\n";
163 verifyShader(ctx, glu::SHADERTYPE_TESSELLATION_CONTROL, source, EXPECT_RESULT_FAIL);
164 }
165 ctx.endSection();
166 }
167 }
168
blend_equation_advanced(NegativeTestContext & ctx)169 void blend_equation_advanced (NegativeTestContext& ctx)
170 {
171 static const char* const s_qualifiers[] =
172 {
173 "blend_support_multiply",
174 "blend_support_screen",
175 "blend_support_overlay",
176 "blend_support_darken",
177 "blend_support_lighten",
178 "blend_support_colordodge",
179 "blend_support_colorburn",
180 "blend_support_hardlight",
181 "blend_support_softlight",
182 "blend_support_difference",
183 "blend_support_exclusion",
184 "blend_support_hsl_hue",
185 "blend_support_hsl_saturation",
186 "blend_support_hsl_color",
187 "blend_support_hsl_luminosity",
188 };
189
190 ctx.beginSection("GL_KHR_blend_equation_advanced features require enabling the extension in 310 es shaders.");
191 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_qualifiers); ++ndx)
192 {
193 std::ostringstream source;
194 source << "#version 310 es\n"
195 "layout(" << s_qualifiers[ndx] << ") out;\n"
196 "void main()\n"
197 "{\n"
198 "}\n";
199 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
200 }
201 ctx.endSection();
202 }
203
sample_variables(NegativeTestContext & ctx)204 void sample_variables (NegativeTestContext& ctx)
205 {
206 TCU_CHECK_AND_THROW(NotSupportedError, contextSupports(ctx.getRenderContext().getType() , glu::ApiType::es(3, 2)), "Test requires a context version 3.2 or higher.");
207
208 static const char* const s_tests[] =
209 {
210 "int sampleId = gl_SampleID;",
211 "vec2 samplePos = gl_SamplePosition;",
212 "int sampleMaskIn0 = gl_SampleMaskIn[0];",
213 "int sampleMask0 = gl_SampleMask[0];",
214 "int numSamples = gl_NumSamples;",
215 };
216
217 ctx.beginSection("GL_OES_sample_variables features require enabling the extension in 310 es shaders.");
218 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_tests); ++ndx)
219 {
220 std::ostringstream source;
221 source << "#version 310 es\n"
222 "precision mediump float;\n"
223 "void main()\n"
224 "{\n"
225 " " << s_tests[ndx] << "\n"
226 "}\n";
227 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
228 }
229 ctx.endSection();
230 }
231
shader_image_atomic(NegativeTestContext & ctx)232 void shader_image_atomic (NegativeTestContext& ctx)
233 {
234 static const char* const s_tests[] =
235 {
236 "imageAtomicAdd(u_image, ivec2(1, 1), 1u);",
237 "imageAtomicMin(u_image, ivec2(1, 1), 1u);",
238 "imageAtomicMax(u_image, ivec2(1, 1), 1u);",
239 "imageAtomicAnd(u_image, ivec2(1, 1), 1u);",
240 "imageAtomicOr(u_image, ivec2(1, 1), 1u);",
241 "imageAtomicXor(u_image, ivec2(1, 1), 1u);",
242 "imageAtomicExchange(u_image, ivec2(1, 1), 1u);",
243 "imageAtomicCompSwap(u_image, ivec2(1, 1), 1u, 1u);",
244 };
245
246 ctx.beginSection("GL_OES_shader_image_atomic features require enabling the extension in 310 es shaders.");
247 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_tests); ++ndx)
248 {
249 std::ostringstream source;
250 source << "#version 310 es\n"
251 "layout(binding=0, r32ui) coherent uniform highp uimage2D u_image;\n"
252 "precision mediump float;\n"
253 "void main()\n"
254 "{\n"
255 " " << s_tests[ndx] << "\n"
256 "}\n";
257 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
258 }
259 ctx.endSection();
260 }
261
shader_multisample_interpolation(NegativeTestContext & ctx)262 void shader_multisample_interpolation (NegativeTestContext& ctx)
263 {
264 static const char* const s_sampleTests[] =
265 {
266 "sample in highp float v_var;",
267 "sample out highp float v_var;"
268 };
269
270 static const char* const s_interpolateAtTests[] =
271 {
272 "interpolateAtCentroid(interpolant);",
273 "interpolateAtSample(interpolant, 1);",
274 "interpolateAtOffset(interpolant, vec2(1.0, 0.0));"
275 };
276
277 ctx.beginSection("GL_OES_shader_multisample_interpolation features require enabling the extension in 310 es shaders.");
278 ctx.beginSection("Test sample in/out qualifiers.");
279 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_sampleTests); ++ndx)
280 {
281 std::ostringstream source;
282 source << "#version 310 es\n"
283 " " << s_sampleTests[ndx] << "\n"
284 "precision mediump float;\n"
285 "void main()\n"
286 "{\n"
287 "}\n";
288 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
289 }
290 ctx.endSection();
291
292 ctx.beginSection("Test interpolateAt* functions.");
293 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_sampleTests); ++ndx)
294 {
295 std::ostringstream source;
296 source << "#version 310 es\n"
297 "in mediump float interpolant;\n"
298 "precision mediump float;\n"
299 "void main()\n"
300 "{\n"
301 " " << s_interpolateAtTests[ndx] << "\n"
302 "}\n";
303 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
304 }
305 ctx.endSection();
306 ctx.endSection();
307 }
308
texture_storage_multisample_2d_array(NegativeTestContext & ctx)309 void texture_storage_multisample_2d_array (NegativeTestContext& ctx)
310 {
311 static const char* const s_samplerTypeTests[] =
312 {
313 "uniform mediump sampler2DMSArray u_sampler;",
314 "uniform mediump isampler2DMSArray u_sampler;",
315 "uniform mediump usampler2DMSArray u_sampler;",
316 };
317
318 ctx.beginSection("GL_OES_texture_storage_multisample_2d_array features require enabling the extension in 310 es shaders.");
319 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_samplerTypeTests); ++ndx)
320 {
321 std::ostringstream source;
322 source << "#version 310 es\n"
323 " " << s_samplerTypeTests[ndx] << "\n"
324 "precision mediump float;\n"
325 "void main()\n"
326 "{\n"
327 "}\n";
328 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
329 }
330 ctx.endSection();
331 }
332
geometry_shader(NegativeTestContext & ctx)333 void geometry_shader (NegativeTestContext& ctx)
334 {
335 if (ctx.isShaderSupported(glu::SHADERTYPE_GEOMETRY))
336 {
337 const std::string simpleVtxFrag = "#version 310 es\n"
338 "void main()\n"
339 "{\n"
340 "}\n";
341 const std::string geometry = "#version 310 es\n"
342 "layout(points, invocations = 1) in;\n"
343 "layout(points, max_vertices = 3) out;\n"
344 "precision mediump float;\n"
345 "void main()\n"
346 "{\n"
347 " EmitVertex();\n"
348 " EndPrimitive();\n"
349 "}\n";
350 ctx.beginSection("GL_EXT_geometry_shader features require enabling the extension in 310 es shaders.");
351 verifyProgram(ctx, glu::ProgramSources() << glu::VertexSource(simpleVtxFrag) << glu::GeometrySource(geometry) << glu::FragmentSource(simpleVtxFrag), EXPECT_RESULT_FAIL);
352 ctx.endSection();
353 }
354 }
355
gpu_shader_5(NegativeTestContext & ctx)356 void gpu_shader_5 (NegativeTestContext& ctx)
357 {
358 ctx.beginSection("GL_EXT_gpu_shader5 features require enabling the extension in 310 es shaders.");
359 ctx.beginSection("Testing the precise qualifier.");
360 {
361 std::ostringstream source;
362 source << "#version 310 es\n"
363 "void main()\n"
364 "{\n"
365 " int low = 0;\n"
366 " int high = 10;\n"
367 " precise int middle = low + ((high - low) / 2);\n"
368 "}\n";
369 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
370 }
371 ctx.endSection();
372
373 ctx.beginSection("Testing fused multiply-add.");
374 {
375 std::ostringstream source;
376 source << "#version 310 es\n"
377 "in mediump float v_var;"
378 "void main()\n"
379 "{\n"
380 " float fmaResult = fma(v_var, v_var, v_var);"
381 "}\n";
382 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
383 }
384 ctx.endSection();
385
386 ctx.beginSection("Testing textureGatherOffsets.");
387 {
388 std::ostringstream source;
389 source << "#version 310 es\n"
390 "uniform mediump sampler2D u_tex;\n"
391 "void main()\n"
392 "{\n"
393 " highp vec2 coords = vec2(0.0, 1.0);\n"
394 " const ivec2 offsets[4] = ivec2[](ivec2(0,0), ivec2(1, 0), ivec2(0, 1), ivec2(1, 1));\n"
395 " textureGatherOffsets(u_tex, coords, offsets);\n"
396 "}\n";
397 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
398 }
399 ctx.endSection();
400
401 ctx.endSection();
402 }
403
shader_io_blocks(NegativeTestContext & ctx)404 void shader_io_blocks (NegativeTestContext& ctx)
405 {
406 ctx.beginSection("GL_EXT_shader_io_blocks features require enabling the extension in 310 es shaders.");
407 {
408 std::ostringstream source;
409 source << "#version 310 es\n"
410 "in Data\n"
411 "{\n"
412 " mediump vec3 a;\n"
413 "} data;\n"
414 "void main()\n"
415 "{\n"
416 "}\n";
417 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
418 }
419 ctx.endSection();
420 }
421
tessellation_shader(NegativeTestContext & ctx)422 void tessellation_shader (NegativeTestContext& ctx)
423 {
424 if (ctx.isShaderSupported(glu::SHADERTYPE_TESSELLATION_CONTROL))
425 {
426 const std::string simpleVtxFrag = "#version 310 es\n"
427 "void main()\n"
428 "{\n"
429 "}\n";
430 const std::string tessControl = "#version 310 es\n"
431 "layout(vertices = 3) out;\n"
432 "void main()\n"
433 "{\n"
434 "}\n";
435 const std::string tessEvaluation = "#version 310 es\n"
436 "layout(triangles, equal_spacing, cw) in;\n"
437 "void main()\n"
438 "{\n"
439 "}\n";
440 ctx.beginSection("GL_EXT_tessellation_shader features require enabling the extension in 310 es shaders.");
441 glu::ProgramSources sources;
442 sources << glu::VertexSource(simpleVtxFrag)
443 << glu::TessellationControlSource(tessControl)
444 << glu::TessellationEvaluationSource(tessEvaluation)
445 << glu::FragmentSource(simpleVtxFrag);
446 verifyProgram(ctx, sources, EXPECT_RESULT_FAIL);
447 ctx.endSection();
448 }
449 }
450
texture_buffer(NegativeTestContext & ctx)451 void texture_buffer (NegativeTestContext& ctx)
452 {
453 static const char* const s_samplerBufferTypes[] =
454 {
455 "uniform mediump samplerBuffer",
456 "uniform mediump isamplerBuffer",
457 "uniform mediump usamplerBuffer",
458 "layout(rgba32f) uniform mediump writeonly imageBuffer",
459 "layout(rgba32i) uniform mediump writeonly iimageBuffer",
460 "layout(rgba32ui) uniform mediump writeonly uimageBuffer"
461 };
462
463 ctx.beginSection("GL_EXT_texture_buffer features require enabling the extension in 310 es shaders.");
464 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_samplerBufferTypes); ++ndx)
465 {
466 std::ostringstream source;
467 source << "#version 310 es\n"
468 "" << s_samplerBufferTypes[ndx] << " u_buffer;\n"
469 "void main()\n"
470 "{\n"
471 "}\n";
472 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
473 }
474 ctx.endSection();
475 }
476
477
texture_cube_map_array(NegativeTestContext & ctx)478 void texture_cube_map_array (NegativeTestContext& ctx)
479 {
480 static const char* const s_samplerCubeArrayTypes[] =
481 {
482 "uniform mediump samplerCubeArray",
483 "uniform mediump isamplerCubeArray",
484 "uniform mediump usamplerCubeArray",
485 "uniform mediump samplerCubeArrayShadow",
486 "layout(rgba32f) uniform mediump writeonly imageCubeArray",
487 "layout(rgba32i) uniform mediump writeonly iimageCubeArray",
488 "layout(rgba32ui) uniform mediump writeonly uimageCubeArray"
489 };
490
491 ctx.beginSection("GL_EXT_texture_cube_map_array features require enabling the extension in 310 es shaders.");
492 for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_samplerCubeArrayTypes); ++ndx)
493 {
494 std::ostringstream source;
495 source << "#version 310 es\n"
496 "" << s_samplerCubeArrayTypes[ndx] << " u_cube;\n"
497 "void main()\n"
498 "{\n"
499 "}\n";
500 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, source.str(), EXPECT_RESULT_FAIL);
501 }
502 ctx.endSection();
503 }
504
executeAccessingBoundingBoxType(NegativeTestContext & ctx,const std::string builtInTypeName,glu::GLSLVersion glslVersion)505 void executeAccessingBoundingBoxType (NegativeTestContext& ctx, const std::string builtInTypeName, glu::GLSLVersion glslVersion)
506 {
507 std::ostringstream sourceStream;
508 std::string version;
509 std::string extensionPrim;
510 std::string extensionTess;
511
512 if (glslVersion == glu::GLSL_VERSION_310_ES)
513 {
514 version = "#version 310 es\n";
515 extensionPrim = "#extension GL_EXT_primitive_bounding_box : require\n";
516 extensionTess = "#extension GL_EXT_tessellation_shader : require\n";
517 }
518 else if (glslVersion >= glu::GLSL_VERSION_320_ES)
519 {
520 version = "#version 320 es\n";
521 extensionPrim = "";
522 extensionTess = "";
523 }
524 else
525 {
526 DE_FATAL("error: context below 3.1 and not supported");
527 }
528
529 ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in vertex shader");
530 sourceStream << version
531 << extensionPrim
532 << "void main()\n"
533 << "{\n"
534 << " " + builtInTypeName + "[0] = vec4(1.0, 1.0, 1.0, 1.0);\n"
535 << " gl_Position = " + builtInTypeName + "[0];\n"
536 << "}\n";
537 verifyShader(ctx, glu::SHADERTYPE_VERTEX, sourceStream.str(), EXPECT_RESULT_FAIL);
538 ctx.endSection();
539
540 sourceStream.str(std::string());
541
542 if (ctx.isShaderSupported(glu::SHADERTYPE_TESSELLATION_EVALUATION))
543 {
544 ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in tessellation evaluation shader");
545 sourceStream << version
546 << extensionPrim
547 << extensionTess
548 << "layout (triangles, equal_spacing, ccw) in;\n"
549 << "void main()\n"
550 << "{\n"
551 << " " + builtInTypeName + "[0] = vec4(1.0, 1.0, 1.0, 1.0);\n"
552 << " gl_Position = ( gl_TessCoord.x * " + builtInTypeName + "[0] +\n"
553 << " gl_TessCoord.y * " + builtInTypeName + "[0] +\n"
554 << " gl_TessCoord.z * " + builtInTypeName + "[0]);\n"
555 << "}\n";
556 verifyShader(ctx, glu::SHADERTYPE_TESSELLATION_EVALUATION, sourceStream.str(), EXPECT_RESULT_FAIL);
557 ctx.endSection();
558
559 sourceStream.str(std::string());
560 }
561
562 if (ctx.isShaderSupported(glu::SHADERTYPE_GEOMETRY))
563 {
564 ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in geometry shader");
565 sourceStream << version
566 << extensionPrim
567 << "layout (triangles) in;\n"
568 << "layout (triangle_strip, max_vertices = 3) out;\n"
569 << "void main()\n"
570 << "{\n"
571 << " " + builtInTypeName + "[0] = vec4(1.0, 1.0, 1.0, 1.0);\n"
572 << " for (int idx = 0; idx < 3; idx++)\n"
573 << " {\n"
574 << " gl_Position = gl_in[idx].gl_Position * " + builtInTypeName + "[0];\n"
575 << " EmitVertex();\n"
576 << " }\n"
577 << " EndPrimitive();\n"
578 << "}\n";
579 verifyShader(ctx, glu::SHADERTYPE_GEOMETRY, sourceStream.str(), EXPECT_RESULT_FAIL);
580 ctx.endSection();
581
582 sourceStream.str(std::string());
583 }
584
585 ctx.beginSection("cannot access built-in type " + builtInTypeName + "[]" + " in fragment shader");
586 sourceStream << version
587 << extensionPrim
588 << "layout (location = 0) out mediump vec4 fs_colour;\n"
589 << "void main()\n"
590 << "{\n"
591 << " " + builtInTypeName + "[0] = vec4(1.0, 1.0, 1.0, 1.0);\n"
592 << " fs_colour = " + builtInTypeName + "[0];\n"
593 << "}\n";
594 verifyShader(ctx, glu::SHADERTYPE_FRAGMENT, sourceStream.str(), EXPECT_RESULT_FAIL);
595 ctx.endSection();
596 }
597
accessing_bounding_box_type(NegativeTestContext & ctx)598 void accessing_bounding_box_type (NegativeTestContext& ctx)
599 {
600 // Extension requirements and name differences depending on the context
601 if ((ctx.getRenderContext().getType().getMajorVersion() == 3) && (ctx.getRenderContext().getType().getMinorVersion() == 1))
602 {
603 executeAccessingBoundingBoxType(ctx, "gl_BoundingBoxEXT", glu::GLSL_VERSION_310_ES);
604 }
605 else
606 {
607 executeAccessingBoundingBoxType(ctx, "gl_BoundingBox", glu::GLSL_VERSION_320_ES);
608 }
609
610 }
611
612 } // anonymous
613
getNegativeShaderDirectiveTestFunctions(void)614 std::vector<FunctionContainer> getNegativeShaderDirectiveTestFunctions (void)
615 {
616 const FunctionContainer funcs[] =
617 {
618 {primitive_bounding_box, "primitive_bounding_box", "GL_EXT_primitive_bounding_box required in 310 es shaders to use AEP features. Version 320 es shaders do not require suffixes." },
619 {blend_equation_advanced, "blend_equation_advanced", "GL_KHR_blend_equation_advanced is required in 310 es shaders to use AEP features" },
620 {sample_variables, "sample_variables", "GL_OES_sample_variables is required in 310 es shaders to use AEP features" },
621 {shader_image_atomic, "shader_image_atomic", "GL_OES_shader_image_atomic is required in 310 es shaders to use AEP features" },
622 {shader_multisample_interpolation, "shader_multisample_interpolation", "GL_OES_shader_multisample_interpolation is required in 310 es shaders to use AEP features" },
623 {texture_storage_multisample_2d_array, "texture_storage_multisample_2d_array", "GL_OES_texture_storage_multisample_2d_array is required in 310 es shaders to use AEP features" },
624 {geometry_shader, "geometry_shader", "GL_EXT_geometry_shader is required in 310 es shaders to use AEP features" },
625 {gpu_shader_5, "gpu_shader_5", "GL_EXT_gpu_shader5 is required in 310 es shaders to use AEP features" },
626 {shader_io_blocks, "shader_io_blocks", "GL_EXT_shader_io_blocks is required in 310 es shaders to use AEP features" },
627 {tessellation_shader, "tessellation_shader", "GL_EXT_tessellation_shader is required in 310 es shaders to use AEP features" },
628 {texture_buffer, "texture_buffer", "GL_EXT_texture_buffer is required in 310 es shaders to use AEP features" },
629 {texture_cube_map_array, "texture_cube_map_array", "GL_EXT_texture_cube_map_array is required in 310 es shaders to use AEP features" },
630 {accessing_bounding_box_type, "accessing_bounding_box_type", "Should not be able to access gl_BoundingBoxEXT[] and gl_BoundingBox[] in shaders other than tess control and evaluation" },
631 };
632
633 return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
634 }
635
636 } // NegativeTestShared
637 } // Functional
638 } // gles31
639 } // deqp
640