1 /*------------------------------------------------------------------------
2 * Vulkan Conformance Tests
3 * ------------------------
5 * Copyright (c) 2015 The Khronos Group Inc.
6 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Copyright (c) 2016 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Shader struct tests.
24 *//*--------------------------------------------------------------------*/
26 #include "vktShaderRenderStructTests.hpp"
27 #include "vktShaderRender.hpp"
28 #include "tcuStringTemplate.hpp"
38 class ShaderStructCase : public ShaderRenderCase
41 ShaderStructCase (tcu::TestContext& testCtx,
42 const std::string& name,
43 const std::string& description,
45 ShaderEvalFunc evalFunc,
46 UniformSetupFunc setupUniformsFunc,
47 const std::string& vertShaderSource,
48 const std::string& fragShaderSource);
49 ~ShaderStructCase (void);
52 ShaderStructCase (const ShaderStructCase&);
53 ShaderStructCase& operator= (const ShaderStructCase&);
56 ShaderStructCase::ShaderStructCase (tcu::TestContext& testCtx,
57 const std::string& name,
58 const std::string& description,
60 ShaderEvalFunc evalFunc,
61 UniformSetupFunc setupUniformsFunc,
62 const std::string& vertShaderSource,
63 const std::string& fragShaderSource)
64 : ShaderRenderCase (testCtx, name, description, isVertexCase, evalFunc, new UniformSetup(setupUniformsFunc), DE_NULL)
66 m_vertShaderSource = vertShaderSource;
67 m_fragShaderSource = fragShaderSource;
70 ShaderStructCase::~ShaderStructCase (void)
74 static de::MovePtr<ShaderStructCase> createStructCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description, bool isVertexCase, ShaderEvalFunc evalFunc, UniformSetupFunc uniformFunc, const LineStream& shaderSrc)
76 static std::string defaultVertSrc =
78 "layout(location = 0) in highp vec4 a_position;\n"
79 "layout(location = 1) in highp vec4 a_coords;\n"
80 "layout(location = 0) out mediump vec4 v_coords;\n\n"
83 " v_coords = a_coords;\n"
84 " gl_Position = a_position;\n"
86 static std::string defaultFragSrc =
88 "layout(location = 0) in mediump vec4 v_color;\n"
89 "layout(location = 0) out mediump vec4 o_color;\n\n"
92 " o_color = v_color;\n"
95 // Fill in specialization parameters and build the shader source.
98 std::map<std::string, std::string> spParams;
104 "layout(location = 0) in highp vec4 a_position;\n"
105 "layout(location = 1) in highp vec4 a_coords;\n"
106 "layout(location = 0) out mediump vec4 v_color;";
107 spParams["COORDS"] = "a_coords";
108 spParams["DST"] = "v_color";
109 spParams["ASSIGN_POS"] = "gl_Position = a_position;";
111 vertSrc = tcu::StringTemplate(shaderSrc.str()).specialize(spParams);
112 fragSrc = defaultFragSrc;
118 "layout(location = 0) in mediump vec4 v_coords;\n"
119 "layout(location = 0) out mediump vec4 o_color;";
120 spParams["COORDS"] = "v_coords";
121 spParams["DST"] = "o_color";
122 spParams["ASSIGN_POS"] = "";
124 vertSrc = defaultVertSrc;
125 fragSrc = tcu::StringTemplate(shaderSrc.str()).specialize(spParams);
128 return de::MovePtr<ShaderStructCase>(new ShaderStructCase(testCtx, name, description, isVertexCase, evalFunc, uniformFunc, vertSrc, fragSrc));
131 class LocalStructTests : public tcu::TestCaseGroup
134 LocalStructTests (tcu::TestContext& testCtx)
135 : TestCaseGroup(testCtx, "local", "Local structs")
139 ~LocalStructTests (void)
143 virtual void init (void);
146 void LocalStructTests::init (void)
148 #define LOCAL_STRUCT_CASE(NAME, DESCRIPTION, SHADER_SRC, SET_UNIFORMS_BODY, EVAL_FUNC_BODY) \
150 struct SetUniforms_##NAME { static void setUniforms (ShaderRenderCaseInstance& instance, const tcu::Vec4&) SET_UNIFORMS_BODY }; /* NOLINT(SET_UNIFORMS_BODY) */ \
151 struct Eval_##NAME { static void eval (ShaderEvalContext& c) EVAL_FUNC_BODY }; /* NOLINT(EVAL_FUNC_BODY) */ \
152 addChild(createStructCase(m_testCtx, #NAME "_vertex", DESCRIPTION, true, &Eval_##NAME::eval, &SetUniforms_##NAME::setUniforms, SHADER_SRC).release()); \
153 addChild(createStructCase(m_testCtx, #NAME "_fragment", DESCRIPTION, false, &Eval_##NAME::eval, &SetUniforms_##NAME::setUniforms, SHADER_SRC).release()); \
154 } while (deGetFalse())
156 LOCAL_STRUCT_CASE(basic, "Basic struct usage",
159 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
162 << " mediump float a;"
163 << " mediump vec3 b;"
167 << "void main (void)"
169 << " S s = S(${COORDS}.x, vec3(0.0), ui_one);"
170 << " s.b = ${COORDS}.yzw;"
171 << " ${DST} = vec4(s.a, s.b.x, s.b.y, s.c);"
175 instance.useUniform(0u, UI_ONE);
178 c.color.xyz() = c.coords.swizzle(0, 1, 2);
181 LOCAL_STRUCT_CASE(nested, "Nested struct",
184 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
185 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
189 << " mediump vec2 b;"
192 << " mediump float a;"
197 << "void main (void)"
199 << " S s = S(${COORDS}.x, T(0, vec2(0.0)), ui_one);"
200 << " s.b = T(ui_zero, ${COORDS}.yz);"
201 << " ${DST} = vec4(s.a, s.b.b, s.b.a + s.c);"
205 instance.useUniform(0u, UI_ZERO);
206 instance.useUniform(1u, UI_ONE);
209 c.color.xyz() = c.coords.swizzle(0, 1, 2);
212 LOCAL_STRUCT_CASE(array_member, "Struct with array member",
215 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
218 << " mediump float a;"
219 << " mediump float b[3];"
223 << "void main (void)"
226 << " s.a = ${COORDS}.w;"
228 << " s.b[0] = ${COORDS}.z;"
229 << " s.b[1] = ${COORDS}.y;"
230 << " s.b[2] = ${COORDS}.x;"
231 << " ${DST} = vec4(s.a, s.b[0], s.b[1], s.c);"
235 instance.useUniform(0u, UI_ONE);
238 c.color.xyz() = c.coords.swizzle(3, 2, 1);
241 LOCAL_STRUCT_CASE(array_member_dynamic_index, "Struct with array member, dynamic indexing",
244 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
245 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
246 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
249 << " mediump float a;"
250 << " mediump float b[3];"
254 << "void main (void)"
257 << " s.a = ${COORDS}.w;"
259 << " s.b[0] = ${COORDS}.z;"
260 << " s.b[1] = ${COORDS}.y;"
261 << " s.b[2] = ${COORDS}.x;"
262 << " ${DST} = vec4(s.b[ui_one], s.b[ui_zero], s.b[ui_two], s.c);"
266 instance.useUniform(0u, UI_ZERO);
267 instance.useUniform(1u, UI_ONE);
268 instance.useUniform(2u, UI_TWO);
271 c.color.xyz() = c.coords.swizzle(1,2,0);
274 LOCAL_STRUCT_CASE(struct_array, "Struct array",
277 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
278 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
279 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
282 << " mediump float a;"
286 << "void main (void)"
289 << " s[0] = S(${COORDS}.x, ui_zero);"
290 << " s[1].a = ${COORDS}.y;"
291 << " s[1].b = ui_one;"
292 << " s[2] = S(${COORDS}.z, ui_two);"
293 << " ${DST} = vec4(s[2].a, s[1].a, s[0].a, s[2].b - s[1].b + s[0].b);"
297 instance.useUniform(0u, UI_ZERO);
298 instance.useUniform(1u, UI_ONE);
299 instance.useUniform(2u, UI_TWO);
302 c.color.xyz() = c.coords.swizzle(2, 1, 0);
305 LOCAL_STRUCT_CASE(struct_array_dynamic_index, "Struct array with dynamic indexing",
308 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
309 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
310 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
313 << " mediump float a;"
317 << "void main (void)"
320 << " s[0] = S(${COORDS}.x, ui_zero);"
321 << " s[1].a = ${COORDS}.y;"
322 << " s[1].b = ui_one;"
323 << " s[2] = S(${COORDS}.z, ui_two);"
324 << " ${DST} = vec4(s[ui_two].a, s[ui_one].a, s[ui_zero].a, s[ui_two].b - s[ui_one].b + s[ui_zero].b);"
328 instance.useUniform(0u, UI_ZERO);
329 instance.useUniform(1u, UI_ONE);
330 instance.useUniform(2u, UI_TWO);
333 c.color.xyz() = c.coords.swizzle(2, 1, 0);
336 LOCAL_STRUCT_CASE(nested_struct_array, "Nested struct array",
339 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
340 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
341 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
342 << "layout (std140, set = 0, binding = 3) uniform buffer3 { mediump float uf_two; };"
343 << "layout (std140, set = 0, binding = 4) uniform buffer4 { mediump float uf_three; };"
344 << "layout (std140, set = 0, binding = 5) uniform buffer5 { mediump float uf_four; };"
345 << "layout (std140, set = 0, binding = 6) uniform buffer6 { mediump float uf_half; };"
346 << "layout (std140, set = 0, binding = 7) uniform buffer7 { mediump float uf_third; };"
347 << "layout (std140, set = 0, binding = 8) uniform buffer8 { mediump float uf_fourth; };"
350 << " mediump float a;"
351 << " mediump vec2 b[2];"
354 << " mediump float a;"
359 << "void main (void)"
364 << " s[0].a = ${COORDS}.x;"
365 << " s[0].b[0].a = uf_half;"
366 << " s[0].b[0].b[0] = ${COORDS}.xy;"
367 << " s[0].b[0].b[1] = ${COORDS}.zw;"
368 << " s[0].b[1].a = uf_third;"
369 << " s[0].b[1].b[0] = ${COORDS}.zw;"
370 << " s[0].b[1].b[1] = ${COORDS}.xy;"
371 << " s[0].b[2].a = uf_fourth;"
372 << " s[0].b[2].b[0] = ${COORDS}.xz;"
373 << " s[0].b[2].b[1] = ${COORDS}.yw;"
374 << " s[0].c = ui_zero;"
377 << " s[1].a = ${COORDS}.w;"
378 << " s[1].b[0].a = uf_two;"
379 << " s[1].b[0].b[0] = ${COORDS}.xx;"
380 << " s[1].b[0].b[1] = ${COORDS}.yy;"
381 << " s[1].b[1].a = uf_three;"
382 << " s[1].b[1].b[0] = ${COORDS}.zz;"
383 << " s[1].b[1].b[1] = ${COORDS}.ww;"
384 << " s[1].b[2].a = uf_four;"
385 << " s[1].b[2].b[0] = ${COORDS}.yx;"
386 << " s[1].b[2].b[1] = ${COORDS}.wz;"
387 << " s[1].c = ui_one;"
389 << " mediump float r = (s[0].b[1].b[0].x + s[1].b[2].b[1].y) * s[0].b[0].a; // (z + z) * 0.5"
390 << " mediump float g = s[1].b[0].b[0].y * s[0].b[2].a * s[1].b[2].a; // x * 0.25 * 4"
391 << " mediump float b = (s[0].b[2].b[1].y + s[0].b[1].b[0].y + s[1].a) * s[0].b[1].a; // (w + w + w) * 0.333"
392 << " mediump float a = float(s[0].c) + s[1].b[2].a - s[1].b[1].a; // 0 + 4.0 - 3.0"
393 << " ${DST} = vec4(r, g, b, a);"
397 instance.useUniform(0u, UI_ZERO);
398 instance.useUniform(1u, UI_ONE);
399 instance.useUniform(2u, UI_TWO);
400 instance.useUniform(3u, UF_TWO);
401 instance.useUniform(4u, UF_THREE);
402 instance.useUniform(5u, UF_FOUR);
403 instance.useUniform(6u, UF_HALF);
404 instance.useUniform(7u, UF_THIRD);
405 instance.useUniform(8u, UF_FOURTH);
408 c.color.xyz() = c.coords.swizzle(2, 0, 3);
411 LOCAL_STRUCT_CASE(nested_struct_array_dynamic_index, "Nested struct array with dynamic indexing",
414 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
415 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
416 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
417 << "layout (std140, set = 0, binding = 3) uniform buffer3 { mediump float uf_two; };"
418 << "layout (std140, set = 0, binding = 4) uniform buffer4 { mediump float uf_three; };"
419 << "layout (std140, set = 0, binding = 5) uniform buffer5 { mediump float uf_four; };"
420 << "layout (std140, set = 0, binding = 6) uniform buffer6 { mediump float uf_half; };"
421 << "layout (std140, set = 0, binding = 7) uniform buffer7 { mediump float uf_third; };"
422 << "layout (std140, set = 0, binding = 8) uniform buffer8 { mediump float uf_fourth; };"
425 << " mediump float a;"
426 << " mediump vec2 b[2];"
429 << " mediump float a;"
434 << "void main (void)"
439 << " s[0].a = ${COORDS}.x;"
440 << " s[0].b[0].a = uf_half;"
441 << " s[0].b[0].b[0] = ${COORDS}.xy;"
442 << " s[0].b[0].b[1] = ${COORDS}.zw;"
443 << " s[0].b[1].a = uf_third;"
444 << " s[0].b[1].b[0] = ${COORDS}.zw;"
445 << " s[0].b[1].b[1] = ${COORDS}.xy;"
446 << " s[0].b[2].a = uf_fourth;"
447 << " s[0].b[2].b[0] = ${COORDS}.xz;"
448 << " s[0].b[2].b[1] = ${COORDS}.yw;"
449 << " s[0].c = ui_zero;"
452 << " s[1].a = ${COORDS}.w;"
453 << " s[1].b[0].a = uf_two;"
454 << " s[1].b[0].b[0] = ${COORDS}.xx;"
455 << " s[1].b[0].b[1] = ${COORDS}.yy;"
456 << " s[1].b[1].a = uf_three;"
457 << " s[1].b[1].b[0] = ${COORDS}.zz;"
458 << " s[1].b[1].b[1] = ${COORDS}.ww;"
459 << " s[1].b[2].a = uf_four;"
460 << " s[1].b[2].b[0] = ${COORDS}.yx;"
461 << " s[1].b[2].b[1] = ${COORDS}.wz;"
462 << " s[1].c = ui_one;"
464 << " mediump float r = (s[0].b[ui_one].b[ui_one-1].x + s[ui_one].b[ui_two].b[ui_zero+1].y) * s[0].b[0].a; // (z + z) * 0.5"
465 << " mediump float g = s[ui_two-1].b[ui_two-2].b[ui_zero].y * s[0].b[ui_two].a * s[ui_one].b[2].a; // x * 0.25 * 4"
466 << " mediump float b = (s[ui_zero].b[ui_one+1].b[1].y + s[0].b[ui_one*ui_one].b[0].y + s[ui_one].a) * s[0].b[ui_two-ui_one].a; // (w + w + w) * 0.333"
467 << " mediump float a = float(s[ui_zero].c) + s[ui_one-ui_zero].b[ui_two].a - s[ui_zero+ui_one].b[ui_two-ui_one].a; // 0 + 4.0 - 3.0"
468 << " ${DST} = vec4(r, g, b, a);"
472 instance.useUniform(0u, UI_ZERO);
473 instance.useUniform(1u, UI_ONE);
474 instance.useUniform(2u, UI_TWO);
475 instance.useUniform(3u, UF_TWO);
476 instance.useUniform(4u, UF_THREE);
477 instance.useUniform(5u, UF_FOUR);
478 instance.useUniform(6u, UF_HALF);
479 instance.useUniform(7u, UF_THIRD);
480 instance.useUniform(8u, UF_FOURTH);
483 c.color.xyz() = c.coords.swizzle(2, 0, 3);
486 LOCAL_STRUCT_CASE(parameter, "Struct as a function parameter",
489 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
492 << " mediump float a;"
493 << " mediump vec3 b;"
497 << "mediump vec4 myFunc (S s)"
499 << " return vec4(s.a, s.b.x, s.b.y, s.c);"
502 << "void main (void)"
504 << " S s = S(${COORDS}.x, vec3(0.0), ui_one);"
505 << " s.b = ${COORDS}.yzw;"
506 << " ${DST} = myFunc(s);"
510 instance.useUniform(0u, UI_ONE);
513 c.color.xyz() = c.coords.swizzle(0, 1, 2);
516 LOCAL_STRUCT_CASE(parameter_nested, "Nested struct as a function parameter",
519 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
520 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
524 << " mediump vec2 b;"
527 << " mediump float a;"
532 << "mediump vec4 myFunc (S s)"
534 << " return vec4(s.a, s.b.b, s.b.a + s.c);"
537 << "void main (void)"
539 << " S s = S(${COORDS}.x, T(0, vec2(0.0)), ui_one);"
540 << " s.b = T(ui_zero, ${COORDS}.yz);"
541 << " ${DST} = myFunc(s);"
545 instance.useUniform(0u, UI_ZERO);
546 instance.useUniform(1u, UI_ONE);
549 c.color.xyz() = c.coords.swizzle(0, 1, 2);
552 LOCAL_STRUCT_CASE(return, "Struct as a return value",
555 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
558 << " mediump float a;"
559 << " mediump vec3 b;"
565 << " S s = S(${COORDS}.x, vec3(0.0), ui_one);"
566 << " s.b = ${COORDS}.yzw;"
570 << "void main (void)"
572 << " S s = myFunc();"
573 << " ${DST} = vec4(s.a, s.b.x, s.b.y, s.c);"
577 instance.useUniform(0u, UI_ONE);
580 c.color.xyz() = c.coords.swizzle(0, 1, 2);
583 LOCAL_STRUCT_CASE(return_nested, "Nested struct",
586 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
587 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
591 << " mediump vec2 b;"
594 << " mediump float a;"
601 << " S s = S(${COORDS}.x, T(0, vec2(0.0)), ui_one);"
602 << " s.b = T(ui_zero, ${COORDS}.yz);"
606 << "void main (void)"
608 << " S s = myFunc();"
609 << " ${DST} = vec4(s.a, s.b.b, s.b.a + s.c);"
613 instance.useUniform(0u, UI_ZERO);
614 instance.useUniform(1u, UI_ONE);
617 c.color.xyz() = c.coords.swizzle(0, 1, 2);
620 LOCAL_STRUCT_CASE(conditional_assignment, "Conditional struct assignment",
623 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
624 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
625 << "layout (std140, set = 0, binding = 2) uniform buffer2 { mediump float uf_one; };"
628 << " mediump float a;"
629 << " mediump vec3 b;"
633 << "void main (void)"
635 << " S s = S(${COORDS}.x, ${COORDS}.yzw, ui_zero);"
636 << " if (uf_one > 0.0)"
637 << " s = S(${COORDS}.w, ${COORDS}.zyx, ui_one);"
638 << " ${DST} = vec4(s.a, s.b.xy, s.c);"
642 instance.useUniform(0u, UI_ZERO);
643 instance.useUniform(1u, UI_ONE);
644 instance.useUniform(2u, UF_ONE);
647 c.color.xyz() = c.coords.swizzle(3, 2, 1);
650 LOCAL_STRUCT_CASE(loop_assignment, "Struct assignment in loop",
653 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
654 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
657 << " mediump float a;"
658 << " mediump vec3 b;"
662 << "void main (void)"
664 << " S s = S(${COORDS}.x, ${COORDS}.yzw, ui_zero);"
665 << " for (int i = 0; i < 3; i++)"
668 << " s = S(${COORDS}.w, ${COORDS}.zyx, ui_one);"
670 << " ${DST} = vec4(s.a, s.b.xy, s.c);"
674 instance.useUniform(0u, UI_ZERO);
675 instance.useUniform(1u, UI_ONE);
678 c.color.xyz() = c.coords.swizzle(3, 2, 1);
681 LOCAL_STRUCT_CASE(dynamic_loop_assignment, "Struct assignment in loop",
684 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
685 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
686 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_three; };"
689 << " mediump float a;"
690 << " mediump vec3 b;"
694 << "void main (void)"
696 << " S s = S(${COORDS}.x, ${COORDS}.yzw, ui_zero);"
697 << " for (int i = 0; i < ui_three; i++)"
699 << " if (i == ui_one)"
700 << " s = S(${COORDS}.w, ${COORDS}.zyx, ui_one);"
702 << " ${DST} = vec4(s.a, s.b.xy, s.c);"
706 instance.useUniform(0u, UI_ZERO);
707 instance.useUniform(1u, UI_ONE);
708 instance.useUniform(2u, UI_THREE);
711 c.color.xyz() = c.coords.swizzle(3, 2, 1);
714 LOCAL_STRUCT_CASE(nested_conditional_assignment, "Conditional assignment of nested struct",
717 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
718 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
719 << "layout (std140, set = 0, binding = 2) uniform buffer2 { mediump float uf_one; };"
723 << " mediump vec2 b;"
726 << " mediump float a;"
731 << "void main (void)"
733 << " S s = S(${COORDS}.x, T(ui_one, ${COORDS}.yz), ui_one);"
734 << " if (uf_one > 0.0)"
735 << " s.b = T(ui_zero, ${COORDS}.zw);"
736 << " ${DST} = vec4(s.a, s.b.b, s.c - s.b.a);"
740 instance.useUniform(0u, UI_ZERO);
741 instance.useUniform(1u, UI_ONE);
742 instance.useUniform(2u, UF_ONE);
745 c.color.xyz() = c.coords.swizzle(0, 2, 3);
748 LOCAL_STRUCT_CASE(nested_loop_assignment, "Nested struct assignment in loop",
751 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
752 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
753 << "layout (std140, set = 0, binding = 2) uniform buffer2 { mediump float uf_one; };"
757 << " mediump vec2 b;"
760 << " mediump float a;"
765 << "void main (void)"
767 << " S s = S(${COORDS}.x, T(ui_one, ${COORDS}.yz), ui_one);"
768 << " for (int i = 0; i < 3; i++)"
771 << " s.b = T(ui_zero, ${COORDS}.zw);"
773 << " ${DST} = vec4(s.a, s.b.b, s.c - s.b.a);"
777 instance.useUniform(0u, UI_ZERO);
778 instance.useUniform(1u, UI_ONE);
779 instance.useUniform(2u, UF_ONE);
782 c.color.xyz() = c.coords.swizzle(0, 2, 3);
785 LOCAL_STRUCT_CASE(nested_dynamic_loop_assignment, "Nested struct assignment in dynamic loop",
788 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
789 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
790 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_three; };"
791 << "layout (std140, set = 0, binding = 3) uniform buffer3 { mediump float uf_one; };"
795 << " mediump vec2 b;"
798 << " mediump float a;"
803 << "void main (void)"
805 << " S s = S(${COORDS}.x, T(ui_one, ${COORDS}.yz), ui_one);"
806 << " for (int i = 0; i < ui_three; i++)"
808 << " if (i == ui_one)"
809 << " s.b = T(ui_zero, ${COORDS}.zw);"
811 << " ${DST} = vec4(s.a, s.b.b, s.c - s.b.a);"
815 instance.useUniform(0u, UI_ZERO);
816 instance.useUniform(1u, UI_ONE);
817 instance.useUniform(2u, UI_THREE);
818 instance.useUniform(3u, UF_ONE);
821 c.color.xyz() = c.coords.swizzle(0, 2, 3);
824 LOCAL_STRUCT_CASE(loop_struct_array, "Struct array usage in loop",
827 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
828 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
829 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
832 << " mediump float a;"
836 << "void main (void)"
839 << " s[0] = S(${COORDS}.x, ui_zero);"
840 << " s[1].a = ${COORDS}.y;"
841 << " s[1].b = -ui_one;"
842 << " s[2] = S(${COORDS}.z, ui_two);"
844 << " mediump float rgb[3];"
846 << " for (int i = 0; i < 3; i++)"
848 << " rgb[i] = s[2-i].a;"
849 << " alpha += s[i].b;"
851 << " ${DST} = vec4(rgb[0], rgb[1], rgb[2], alpha);"
855 instance.useUniform(0u, UI_ZERO);
856 instance.useUniform(1u, UI_ONE);
857 instance.useUniform(2u, UI_TWO);
860 c.color.xyz() = c.coords.swizzle(2, 1, 0);
863 LOCAL_STRUCT_CASE(loop_nested_struct_array, "Nested struct array usage in loop",
866 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
867 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
868 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
869 << "layout (std140, set = 0, binding = 3) uniform buffer3 { mediump float uf_two; };"
870 << "layout (std140, set = 0, binding = 4) uniform buffer4 { mediump float uf_three; };"
871 << "layout (std140, set = 0, binding = 5) uniform buffer5 { mediump float uf_four; };"
872 << "layout (std140, set = 0, binding = 6) uniform buffer6 { mediump float uf_half; };"
873 << "layout (std140, set = 0, binding = 7) uniform buffer7 { mediump float uf_third; };"
874 << "layout (std140, set = 0, binding = 8) uniform buffer8 { mediump float uf_fourth; };"
875 << "layout (std140, set = 0, binding = 9) uniform buffer9 { mediump float uf_sixth; };"
878 << " mediump float a;"
879 << " mediump vec2 b[2];"
882 << " mediump float a;"
887 << "void main (void)"
892 << " s[0].a = ${COORDS}.x;"
893 << " s[0].b[0].a = uf_half;"
894 << " s[0].b[0].b[0] = ${COORDS}.yx;"
895 << " s[0].b[0].b[1] = ${COORDS}.zx;"
896 << " s[0].b[1].a = uf_third;"
897 << " s[0].b[1].b[0] = ${COORDS}.yy;"
898 << " s[0].b[1].b[1] = ${COORDS}.wy;"
899 << " s[0].b[2].a = uf_fourth;"
900 << " s[0].b[2].b[0] = ${COORDS}.zx;"
901 << " s[0].b[2].b[1] = ${COORDS}.zy;"
902 << " s[0].c = ui_zero;"
905 << " s[1].a = ${COORDS}.w;"
906 << " s[1].b[0].a = uf_two;"
907 << " s[1].b[0].b[0] = ${COORDS}.zx;"
908 << " s[1].b[0].b[1] = ${COORDS}.zy;"
909 << " s[1].b[1].a = uf_three;"
910 << " s[1].b[1].b[0] = ${COORDS}.zz;"
911 << " s[1].b[1].b[1] = ${COORDS}.ww;"
912 << " s[1].b[2].a = uf_four;"
913 << " s[1].b[2].b[0] = ${COORDS}.yx;"
914 << " s[1].b[2].b[1] = ${COORDS}.wz;"
915 << " s[1].c = ui_one;"
917 << " mediump float r = 0.0; // (x*3 + y*3) / 6.0"
918 << " mediump float g = 0.0; // (y*3 + z*3) / 6.0"
919 << " mediump float b = 0.0; // (z*3 + w*3) / 6.0"
920 << " mediump float a = 1.0;"
921 << " for (int i = 0; i < 2; i++)"
923 << " for (int j = 0; j < 3; j++)"
925 << " r += s[0].b[j].b[i].y;"
926 << " g += s[i].b[j].b[0].x;"
927 << " b += s[i].b[j].b[1].x;"
928 << " a *= s[i].b[j].a;"
931 << " ${DST} = vec4(r*uf_sixth, g*uf_sixth, b*uf_sixth, a);"
935 instance.useUniform(0u, UI_ZERO);
936 instance.useUniform(1u, UI_ONE);
937 instance.useUniform(2u, UI_TWO);
938 instance.useUniform(3u, UF_TWO);
939 instance.useUniform(4u, UF_THREE);
940 instance.useUniform(5u, UF_FOUR);
941 instance.useUniform(6u, UF_HALF);
942 instance.useUniform(7u, UF_THIRD);
943 instance.useUniform(8u, UF_FOURTH);
944 instance.useUniform(9u, UF_SIXTH);
947 c.color.xyz() = (c.coords.swizzle(0, 1, 2) + c.coords.swizzle(1, 2, 3)) * 0.5f;
950 LOCAL_STRUCT_CASE(dynamic_loop_struct_array, "Struct array usage in dynamic loop",
953 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
954 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
955 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
956 << "layout (std140, set = 0, binding = 3) uniform buffer3 { int ui_three; };"
959 << " mediump float a;"
963 << "void main (void)"
966 << " s[0] = S(${COORDS}.x, ui_zero);"
967 << " s[1].a = ${COORDS}.y;"
968 << " s[1].b = -ui_one;"
969 << " s[2] = S(${COORDS}.z, ui_two);"
971 << " mediump float rgb[3];"
973 << " for (int i = 0; i < ui_three; i++)"
975 << " rgb[i] = s[2-i].a;"
976 << " alpha += s[i].b;"
978 << " ${DST} = vec4(rgb[0], rgb[1], rgb[2], alpha);"
982 instance.useUniform(0u, UI_ZERO);
983 instance.useUniform(1u, UI_ONE);
984 instance.useUniform(2u, UI_TWO);
985 instance.useUniform(3u, UI_THREE);
988 c.color.xyz() = c.coords.swizzle(2, 1, 0);
991 LOCAL_STRUCT_CASE(dynamic_loop_nested_struct_array, "Nested struct array usage in dynamic loop",
994 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
995 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
996 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
997 << "layout (std140, set = 0, binding = 3) uniform buffer3 { int ui_three; };"
998 << "layout (std140, set = 0, binding = 4) uniform buffer4 { mediump float uf_two; };"
999 << "layout (std140, set = 0, binding = 5) uniform buffer5 { mediump float uf_three; };"
1000 << "layout (std140, set = 0, binding = 6) uniform buffer6 { mediump float uf_four; };"
1001 << "layout (std140, set = 0, binding = 7) uniform buffer7 { mediump float uf_half; };"
1002 << "layout (std140, set = 0, binding = 8) uniform buffer8 { mediump float uf_third; };"
1003 << "layout (std140, set = 0, binding = 9) uniform buffer9 { mediump float uf_fourth; };"
1004 << "layout (std140, set = 0, binding = 10) uniform buffer10 { mediump float uf_sixth; };"
1007 << " mediump float a;"
1008 << " mediump vec2 b[2];"
1011 << " mediump float a;"
1016 << "void main (void)"
1020 << " s[0].a = ${COORDS}.x;"
1021 << " s[0].b[0].a = uf_half;"
1022 << " s[0].b[0].b[0] = ${COORDS}.yx;"
1023 << " s[0].b[0].b[1] = ${COORDS}.zx;"
1024 << " s[0].b[1].a = uf_third;"
1025 << " s[0].b[1].b[0] = ${COORDS}.yy;"
1026 << " s[0].b[1].b[1] = ${COORDS}.wy;"
1027 << " s[0].b[2].a = uf_fourth;"
1028 << " s[0].b[2].b[0] = ${COORDS}.zx;"
1029 << " s[0].b[2].b[1] = ${COORDS}.zy;"
1030 << " s[0].c = ui_zero;"
1032 << " s[1].a = ${COORDS}.w;"
1033 << " s[1].b[0].a = uf_two;"
1034 << " s[1].b[0].b[0] = ${COORDS}.zx;"
1035 << " s[1].b[0].b[1] = ${COORDS}.zy;"
1036 << " s[1].b[1].a = uf_three;"
1037 << " s[1].b[1].b[0] = ${COORDS}.zz;"
1038 << " s[1].b[1].b[1] = ${COORDS}.ww;"
1039 << " s[1].b[2].a = uf_four;"
1040 << " s[1].b[2].b[0] = ${COORDS}.yx;"
1041 << " s[1].b[2].b[1] = ${COORDS}.wz;"
1042 << " s[1].c = ui_one;"
1044 << " mediump float r = 0.0; // (x*3 + y*3) / 6.0"
1045 << " mediump float g = 0.0; // (y*3 + z*3) / 6.0"
1046 << " mediump float b = 0.0; // (z*3 + w*3) / 6.0"
1047 << " mediump float a = 1.0;"
1048 << " for (int i = 0; i < ui_two; i++)"
1050 << " for (int j = 0; j < ui_three; j++)"
1052 << " r += s[0].b[j].b[i].y;"
1053 << " g += s[i].b[j].b[0].x;"
1054 << " b += s[i].b[j].b[1].x;"
1055 << " a *= s[i].b[j].a;"
1058 << " ${DST} = vec4(r*uf_sixth, g*uf_sixth, b*uf_sixth, a);"
1062 instance.useUniform(0u, UI_ZERO);
1063 instance.useUniform(1u, UI_ONE);
1064 instance.useUniform(2u, UI_TWO);
1065 instance.useUniform(3u, UI_THREE);
1066 instance.useUniform(4u, UF_TWO);
1067 instance.useUniform(5u, UF_THREE);
1068 instance.useUniform(6u, UF_FOUR);
1069 instance.useUniform(7u, UF_HALF);
1070 instance.useUniform(8u, UF_THIRD);
1071 instance.useUniform(9u, UF_FOURTH);
1072 instance.useUniform(10u, UF_SIXTH);
1075 c.color.xyz() = (c.coords.swizzle(0, 1, 2) + c.coords.swizzle(1, 2, 3)) * 0.5f;
1078 LOCAL_STRUCT_CASE(basic_equal, "Basic struct equality",
1081 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
1082 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_two; };"
1085 << " mediump float a;"
1086 << " mediump vec3 b;"
1090 << "void main (void)"
1092 << " S a = S(floor(${COORDS}.x), vec3(0.0, floor(${COORDS}.y), 2.3), ui_one);"
1093 << " S b = S(floor(${COORDS}.x+0.5), vec3(0.0, floor(${COORDS}.y), 2.3), ui_one);"
1094 << " S c = S(floor(${COORDS}.x), vec3(0.0, floor(${COORDS}.y+0.5), 2.3), ui_one);"
1095 << " S d = S(floor(${COORDS}.x), vec3(0.0, floor(${COORDS}.y), 2.3), ui_two);"
1096 << " ${DST} = vec4(0.0, 0.0, 0.0, 1.0);"
1097 << " if (a == b) ${DST}.x = 1.0;"
1098 << " if (a == c) ${DST}.y = 1.0;"
1099 << " if (a == d) ${DST}.z = 1.0;"
1103 instance.useUniform(0u, UI_ONE);
1104 instance.useUniform(1u, UI_TWO);
1107 if (deFloatFloor(c.coords[0]) == deFloatFloor(c.coords[0] + 0.5f))
1109 if (deFloatFloor(c.coords[1]) == deFloatFloor(c.coords[1] + 0.5f))
1113 LOCAL_STRUCT_CASE(basic_not_equal, "Basic struct equality",
1116 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
1117 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_two; };"
1120 << " mediump float a;"
1121 << " mediump vec3 b;"
1125 << "void main (void)"
1127 << " S a = S(floor(${COORDS}.x), vec3(0.0, floor(${COORDS}.y), 2.3), ui_one);"
1128 << " S b = S(floor(${COORDS}.x+0.5), vec3(0.0, floor(${COORDS}.y), 2.3), ui_one);"
1129 << " S c = S(floor(${COORDS}.x), vec3(0.0, floor(${COORDS}.y+0.5), 2.3), ui_one);"
1130 << " S d = S(floor(${COORDS}.x), vec3(0.0, floor(${COORDS}.y), 2.3), ui_two);"
1131 << " ${DST} = vec4(0.0, 0.0, 0.0, 1.0);"
1132 << " if (a != b) ${DST}.x = 1.0;"
1133 << " if (a != c) ${DST}.y = 1.0;"
1134 << " if (a != d) ${DST}.z = 1.0;"
1138 instance.useUniform(0u, UI_ONE);
1139 instance.useUniform(1u, UI_TWO);
1142 if (deFloatFloor(c.coords[0]) != deFloatFloor(c.coords[0] + 0.5f))
1144 if (deFloatFloor(c.coords[1]) != deFloatFloor(c.coords[1] + 0.5f))
1149 LOCAL_STRUCT_CASE(nested_equal, "Nested struct struct equality",
1152 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
1153 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_two; };"
1156 << " mediump vec3 a;"
1160 << " mediump float a;"
1165 << "void main (void)"
1167 << " S a = S(floor(${COORDS}.x), T(vec3(0.0, floor(${COORDS}.y), 2.3), ui_one), 1);"
1168 << " S b = S(floor(${COORDS}.x+0.5), T(vec3(0.0, floor(${COORDS}.y), 2.3), ui_one), 1);"
1169 << " S c = S(floor(${COORDS}.x), T(vec3(0.0, floor(${COORDS}.y+0.5), 2.3), ui_one), 1);"
1170 << " S d = S(floor(${COORDS}.x), T(vec3(0.0, floor(${COORDS}.y), 2.3), ui_two), 1);"
1171 << " ${DST} = vec4(0.0, 0.0, 0.0, 1.0);"
1172 << " if (a == b) ${DST}.x = 1.0;"
1173 << " if (a == c) ${DST}.y = 1.0;"
1174 << " if (a == d) ${DST}.z = 1.0;"
1178 instance.useUniform(0u, UI_ONE);
1179 instance.useUniform(1u, UI_TWO);
1182 if (deFloatFloor(c.coords[0]) == deFloatFloor(c.coords[0] + 0.5f))
1184 if (deFloatFloor(c.coords[1]) == deFloatFloor(c.coords[1] + 0.5f))
1188 LOCAL_STRUCT_CASE(nested_not_equal, "Nested struct struct equality",
1191 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
1192 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_two; };"
1195 << " mediump vec3 a;"
1199 << " mediump float a;"
1204 << "void main (void)"
1206 << " S a = S(floor(${COORDS}.x), T(vec3(0.0, floor(${COORDS}.y), 2.3), ui_one), 1);"
1207 << " S b = S(floor(${COORDS}.x+0.5), T(vec3(0.0, floor(${COORDS}.y), 2.3), ui_one), 1);"
1208 << " S c = S(floor(${COORDS}.x), T(vec3(0.0, floor(${COORDS}.y+0.5), 2.3), ui_one), 1);"
1209 << " S d = S(floor(${COORDS}.x), T(vec3(0.0, floor(${COORDS}.y), 2.3), ui_two), 1);"
1210 << " ${DST} = vec4(0.0, 0.0, 0.0, 1.0);"
1211 << " if (a != b) ${DST}.x = 1.0;"
1212 << " if (a != c) ${DST}.y = 1.0;"
1213 << " if (a != d) ${DST}.z = 1.0;"
1217 instance.useUniform(0u, UI_ONE);
1218 instance.useUniform(1u, UI_TWO);
1221 if (deFloatFloor(c.coords[0]) != deFloatFloor(c.coords[0] + 0.5f))
1223 if (deFloatFloor(c.coords[1]) != deFloatFloor(c.coords[1] + 0.5f))
1229 class UniformStructTests : public tcu::TestCaseGroup
1232 UniformStructTests (tcu::TestContext& testCtx)
1233 : TestCaseGroup(testCtx, "uniform", "Uniform structs")
1237 ~UniformStructTests (void)
1241 virtual void init (void);
1244 void UniformStructTests::init (void)
1246 #define UNIFORM_STRUCT_CASE(NAME, DESCRIPTION, SHADER_SRC, SET_UNIFORMS_BODY, EVAL_FUNC_BODY) \
1248 struct SetUniforms_##NAME { \
1249 static void setUniforms (ShaderRenderCaseInstance& instance, const tcu::Vec4& constCoords) SET_UNIFORMS_BODY /* NOLINT(SET_UNIFORMS_BODY) */ \
1251 struct Eval_##NAME { static void eval (ShaderEvalContext& c) EVAL_FUNC_BODY }; /* NOLINT(EVAL_FUNC_BODY) */ \
1252 addChild(createStructCase(m_testCtx, #NAME "_vertex", DESCRIPTION, true, Eval_##NAME::eval, SetUniforms_##NAME::setUniforms, SHADER_SRC).release()); \
1253 addChild(createStructCase(m_testCtx, #NAME "_fragment", DESCRIPTION, false, Eval_##NAME::eval, SetUniforms_##NAME::setUniforms, SHADER_SRC).release()); \
1254 } while (deGetFalse())
1256 UNIFORM_STRUCT_CASE(basic, "Basic struct usage",
1259 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
1262 << " mediump float a;"
1263 << " mediump vec3 b;"
1266 << "layout (std140, set = 0, binding = 1) uniform buffer1 { S s; };"
1268 << "void main (void)"
1270 << " ${DST} = vec4(s.a, s.b.x, s.b.y, s.c);"
1274 instance.useUniform(0u, UI_ONE);
1284 s.a = constCoords.x();
1285 s.b = constCoords.swizzle(1, 2, 3);
1287 instance.addUniform(1u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(S), &s);
1290 c.color.xyz() = c.constCoords.swizzle(0, 1, 2);
1293 UNIFORM_STRUCT_CASE(nested, "Nested struct",
1296 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1297 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1301 << " mediump vec2 b;"
1304 << " mediump float a;"
1308 << "layout (std140, set = 0, binding = 2) uniform buffer2 { S s; };"
1310 << "void main (void)"
1312 << " ${DST} = vec4(s.a, s.b.b, s.b.a + s.c);"
1316 instance.useUniform(0u, UI_ZERO);
1317 instance.useUniform(1u, UI_ONE);
1334 s.a = constCoords.x();
1336 s.b.b = constCoords.swizzle(1, 2);
1338 instance.addUniform(2u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,sizeof(S), &s);
1341 c.color.xyz() = c.constCoords.swizzle(0, 1, 2);
1344 UNIFORM_STRUCT_CASE(array_member, "Struct with array member",
1347 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_one; };"
1350 << " mediump float a;"
1351 << " mediump float b[3];"
1354 << "layout (std140, set = 0, binding = 1) uniform buffer1 { S s; };"
1356 << "void main (void)"
1358 << " ${DST} = vec4(s.a, s.b[0], s.b[1], s.c);"
1362 instance.useUniform(0u, UI_ONE);
1364 struct paddedFloat {
1376 s.a.value = constCoords.w();
1377 s.b[0].value = constCoords.z();
1378 s.b[1].value = constCoords.y();
1379 s.b[2].value = constCoords.x();
1381 instance.addUniform(1u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,sizeof(S), &s);
1384 c.color.xyz() = c.constCoords.swizzle(3, 2, 1);
1387 UNIFORM_STRUCT_CASE(array_member_dynamic_index, "Struct with array member, dynamic indexing",
1390 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1391 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1392 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
1395 << " mediump float a;"
1396 << " mediump float b[3];"
1399 << "layout (std140, set = 0, binding = 3) uniform buffer3 { S s; };"
1401 << "void main (void)"
1403 << " ${DST} = vec4(s.b[ui_one], s.b[ui_zero], s.b[ui_two], s.c);"
1407 instance.useUniform(0u, UI_ZERO);
1408 instance.useUniform(1u, UI_ONE);
1409 instance.useUniform(2u, UI_TWO);
1411 struct paddedFloat {
1423 s.a.value = constCoords.w();
1424 s.b[0].value = constCoords.z();
1425 s.b[1].value = constCoords.y();
1426 s.b[2].value = constCoords.x();
1428 instance.addUniform(3u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(S), &s);
1431 c.color.xyz() = c.constCoords.swizzle(1, 2, 0);
1434 UNIFORM_STRUCT_CASE(struct_array, "Struct array",
1437 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1438 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1439 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
1442 << " mediump float a;"
1443 << " mediump int b;"
1445 << "layout (std140, set = 0, binding = 3) uniform buffer3 { S s[3]; };"
1447 << "void main (void)"
1449 << " ${DST} = vec4(s[2].a, s[1].a, s[0].a, s[2].b - s[1].b + s[0].b);"
1453 instance.useUniform(0u, UI_ZERO);
1454 instance.useUniform(1u, UI_ONE);
1455 instance.useUniform(2u, UI_TWO);
1464 s[0].a = constCoords.x();
1466 s[1].a = constCoords.y();
1468 s[2].a = constCoords.z();
1470 instance.addUniform(3u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3 * sizeof(S), s);
1473 c.color.xyz() = c.constCoords.swizzle(2, 1, 0);
1476 UNIFORM_STRUCT_CASE(struct_array_dynamic_index, "Struct array with dynamic indexing",
1479 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1480 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1481 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
1484 << " mediump float a;"
1485 << " mediump int b;"
1487 << "layout (std140, set = 0, binding = 3) uniform buffer3 { S s[3]; };"
1489 << "void main (void)"
1491 << " ${DST} = vec4(s[ui_two].a, s[ui_one].a, s[ui_zero].a, s[ui_two].b - s[ui_one].b + s[ui_zero].b);"
1495 instance.useUniform(0u, UI_ZERO);
1496 instance.useUniform(1u, UI_ONE);
1497 instance.useUniform(2u, UI_TWO);
1506 s[0].a = constCoords.x();
1508 s[1].a = constCoords.y();
1510 s[2].a = constCoords.z();
1512 instance.addUniform(3u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3 * sizeof(S), s);
1515 c.color.xyz() = c.constCoords.swizzle(2, 1, 0);
1518 UNIFORM_STRUCT_CASE(nested_struct_array, "Nested struct array",
1522 << " mediump float a;"
1523 << " mediump vec2 b[2];"
1526 << " mediump float a;"
1530 << "layout (std140, set = 0, binding = 0) uniform buffer0 { S s[2]; };"
1532 << "void main (void)"
1534 << " mediump float r = (s[0].b[1].b[0].x + s[1].b[2].b[1].y) * s[0].b[0].a; // (z + z) * 0.5"
1535 << " mediump float g = s[1].b[0].b[0].y * s[0].b[2].a * s[1].b[2].a; // x * 0.25 * 4"
1536 << " mediump float b = (s[0].b[2].b[1].y + s[0].b[1].b[0].y + s[1].a) * s[0].b[1].a; // (w + w + w) * 0.333"
1537 << " mediump float a = float(s[0].c) + s[1].b[2].a - s[1].b[1].a; // 0 + 4.0 - 3.0"
1538 << " ${DST} = vec4(r, g, b, a);"
1558 s[0].a = constCoords.x();
1560 s[0].b[0].b[0] = constCoords.swizzle(0,1,0,0);
1561 s[0].b[0].b[1] = constCoords.swizzle(2,3,0,0);
1562 s[0].b[1].a = 1.0f / 3.0f;
1563 s[0].b[1].b[0] = constCoords.swizzle(2,3,0,0);
1564 s[0].b[1].b[1] = constCoords.swizzle(0,1,0,0);
1565 s[0].b[2].a = 1.0f / 4.0f;
1566 s[0].b[2].b[0] = constCoords.swizzle(0,2,0,0);
1567 s[0].b[2].b[1] = constCoords.swizzle(1,3,0,0);
1570 s[1].a = constCoords.w();
1572 s[1].b[0].b[0] = constCoords.swizzle(0,0,0,0);
1573 s[1].b[0].b[1] = constCoords.swizzle(1,1,0,0);
1575 s[1].b[1].b[0] = constCoords.swizzle(2,2,0,0);
1576 s[1].b[1].b[1] = constCoords.swizzle(3,3,0,0);
1578 s[1].b[2].b[0] = constCoords.swizzle(1,0,0,0);
1579 s[1].b[2].b[1] = constCoords.swizzle(3,2,0,0);
1582 instance.addUniform(0u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2 * sizeof(S), s);
1585 c.color.xyz() = c.constCoords.swizzle(2, 0, 3);
1588 UNIFORM_STRUCT_CASE(nested_struct_array_dynamic_index, "Nested struct array with dynamic indexing",
1591 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1592 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1593 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
1596 << " mediump float a;"
1597 << " mediump vec2 b[2];"
1600 << " mediump float a;"
1604 << "layout (set = 0, binding = 3) uniform buffer3 { S s[2]; };"
1606 << "void main (void)"
1608 << " mediump float r = (s[0].b[ui_one].b[ui_one-1].x + s[ui_one].b[ui_two].b[ui_zero+1].y) * s[0].b[0].a; // (z + z) * 0.5"
1609 << " mediump float g = s[ui_two-1].b[ui_two-2].b[ui_zero].y * s[0].b[ui_two].a * s[ui_one].b[2].a; // x * 0.25 * 4"
1610 << " mediump float b = (s[ui_zero].b[ui_one+1].b[1].y + s[0].b[ui_one*ui_one].b[0].y + s[ui_one].a) * s[0].b[ui_two-ui_one].a; // (w + w + w) * 0.333"
1611 << " mediump float a = float(s[ui_zero].c) + s[ui_one-ui_zero].b[ui_two].a - s[ui_zero+ui_one].b[ui_two-ui_one].a; // 0 + 4.0 - 3.0"
1612 << " ${DST} = vec4(r, g, b, a);"
1631 s[0].a = constCoords.x();
1633 s[0].b[0].b[0] = constCoords.swizzle(0,1,0,0);
1634 s[0].b[0].b[1] = constCoords.swizzle(2,3,0,0);
1635 s[0].b[1].a = 1.0f / 3.0f;
1636 s[0].b[1].b[0] = constCoords.swizzle(2,3,0,0);
1637 s[0].b[1].b[1] = constCoords.swizzle(0,1,0,0);
1638 s[0].b[2].a = 1.0f / 4.0f;
1639 s[0].b[2].b[0] = constCoords.swizzle(0,2,0,0);
1640 s[0].b[2].b[1] = constCoords.swizzle(1,3,0,0);
1643 s[1].a = constCoords.w();
1645 s[1].b[0].b[0] = constCoords.swizzle(0,0,0,0);
1646 s[1].b[0].b[1] = constCoords.swizzle(1,1,0,0);
1648 s[1].b[1].b[0] = constCoords.swizzle(2,2,0,0);
1649 s[1].b[1].b[1] = constCoords.swizzle(3,3,0,0);
1651 s[1].b[2].b[0] = constCoords.swizzle(1,0,0,0);
1652 s[1].b[2].b[1] = constCoords.swizzle(3,2,0,0);
1655 instance.useUniform(0u, UI_ZERO);
1656 instance.useUniform(1u, UI_ONE);
1657 instance.useUniform(2u, UI_TWO);
1658 instance.addUniform(3u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2 * sizeof(S), s);
1661 c.color.xyz() = c.constCoords.swizzle(2, 0, 3);
1663 UNIFORM_STRUCT_CASE(loop_struct_array, "Struct array usage in loop",
1666 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1667 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1668 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
1671 << " mediump float a;"
1672 << " mediump int b;"
1674 << "layout (std140, set = 0, binding = 3) uniform buffer3 { S s[3]; };"
1676 << "void main (void)"
1678 << " mediump float rgb[3];"
1679 << " int alpha = 0;"
1680 << " for (int i = 0; i < 3; i++)"
1682 << " rgb[i] = s[2-i].a;"
1683 << " alpha += s[i].b;"
1685 << " ${DST} = vec4(rgb[0], rgb[1], rgb[2], alpha);"
1689 instance.useUniform(0u, UI_ZERO);
1690 instance.useUniform(1u, UI_ONE);
1691 instance.useUniform(2u, UI_TWO);
1700 s[0].a = constCoords.x();
1702 s[1].a = constCoords.y();
1704 s[2].a = constCoords.z();
1706 instance.addUniform(3u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3u * sizeof(S), s);
1709 c.color.xyz() = c.constCoords.swizzle(2, 1, 0);
1712 UNIFORM_STRUCT_CASE(loop_nested_struct_array, "Nested struct array usage in loop",
1715 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1716 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1717 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
1718 << "layout (std140, set = 0, binding = 3) uniform buffer3 { mediump float uf_two; };"
1719 << "layout (std140, set = 0, binding = 4) uniform buffer4 { mediump float uf_three; };"
1720 << "layout (std140, set = 0, binding = 5) uniform buffer5 { mediump float uf_four; };"
1721 << "layout (std140, set = 0, binding = 6) uniform buffer6 { mediump float uf_half; };"
1722 << "layout (std140, set = 0, binding = 7) uniform buffer7 { mediump float uf_third; };"
1723 << "layout (std140, set = 0, binding = 8) uniform buffer8 { mediump float uf_fourth; };"
1724 << "layout (std140, set = 0, binding = 9) uniform buffer9 { mediump float uf_sixth; };"
1727 << " mediump float a;"
1728 << " mediump vec2 b[2];"
1731 << " mediump float a;"
1735 << "layout (std140, set = 0, binding = 10) uniform buffer10 { S s[2]; };"
1737 << "void main (void)"
1739 << " mediump float r = 0.0; // (x*3 + y*3) / 6.0"
1740 << " mediump float g = 0.0; // (y*3 + z*3) / 6.0"
1741 << " mediump float b = 0.0; // (z*3 + w*3) / 6.0"
1742 << " mediump float a = 1.0;"
1743 << " for (int i = 0; i < 2; i++)"
1745 << " for (int j = 0; j < 3; j++)"
1747 << " r += s[0].b[j].b[i].y;"
1748 << " g += s[i].b[j].b[0].x;"
1749 << " b += s[i].b[j].b[1].x;"
1750 << " a *= s[i].b[j].a;"
1753 << " ${DST} = vec4(r*uf_sixth, g*uf_sixth, b*uf_sixth, a);"
1757 instance.useUniform(0u, UI_ZERO);
1758 instance.useUniform(1u, UI_ONE);
1759 instance.useUniform(2u, UI_TWO);
1760 instance.useUniform(3u, UF_TWO);
1761 instance.useUniform(4u, UF_THREE);
1762 instance.useUniform(5u, UF_FOUR);
1763 instance.useUniform(6u, UF_HALF);
1764 instance.useUniform(7u, UF_THIRD);
1765 instance.useUniform(8u, UF_FOURTH);
1766 instance.useUniform(9u, UF_SIXTH);
1783 s[0].a = constCoords.x();
1785 s[0].b[0].b[0] = constCoords.swizzle(1,0,0,0);
1786 s[0].b[0].b[1] = constCoords.swizzle(2,0,0,0);
1787 s[0].b[1].a = 1.0f / 3.0f;
1788 s[0].b[1].b[0] = constCoords.swizzle(1,1,0,0);
1789 s[0].b[1].b[1] = constCoords.swizzle(3,1,0,0);
1790 s[0].b[2].a = 1.0f / 4.0f;
1791 s[0].b[2].b[0] = constCoords.swizzle(2,1,0,0);
1792 s[0].b[2].b[1] = constCoords.swizzle(2,1,0,0);
1795 s[1].a = constCoords.w();
1797 s[1].b[0].b[0] = constCoords.swizzle(2,0,0,0);
1798 s[1].b[0].b[1] = constCoords.swizzle(2,1,0,0);
1800 s[1].b[1].b[0] = constCoords.swizzle(2,2,0,0);
1801 s[1].b[1].b[1] = constCoords.swizzle(3,3,0,0);
1803 s[1].b[2].b[0] = constCoords.swizzle(1,0,0,0);
1804 s[1].b[2].b[1] = constCoords.swizzle(3,2,0,0);
1807 instance.addUniform(10u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2 * sizeof(S), s);
1811 c.color.xyz() = (c.constCoords.swizzle(0, 1, 2) + c.constCoords.swizzle(1, 2, 3)) * 0.5f;
1814 UNIFORM_STRUCT_CASE(dynamic_loop_struct_array, "Struct array usage in dynamic loop",
1817 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1818 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1819 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
1820 << "layout (std140, set = 0, binding = 3) uniform buffer3 { int ui_three; };"
1823 << " mediump float a;"
1824 << " mediump int b;"
1826 << "layout (std140, set = 0, binding = 4) uniform buffer4 { S s[3]; };"
1828 << "void main (void)"
1830 << " mediump float rgb[3];"
1831 << " int alpha = 0;"
1832 << " for (int i = 0; i < ui_three; i++)"
1834 << " rgb[i] = s[2-i].a;"
1835 << " alpha += s[i].b;"
1837 << " ${DST} = vec4(rgb[0], rgb[1], rgb[2], alpha);"
1841 instance.useUniform(0u, UI_ZERO);
1842 instance.useUniform(1u, UI_ONE);
1843 instance.useUniform(2u, UI_TWO);
1844 instance.useUniform(3u, UI_THREE);
1853 s[0].a = constCoords.x();
1855 s[1].a = constCoords.y();
1857 s[2].a = constCoords.z();
1859 instance.addUniform(4u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 3u * sizeof(S), s);
1863 c.color.xyz() = c.constCoords.swizzle(2, 1, 0);
1866 UNIFORM_STRUCT_CASE(dynamic_loop_nested_struct_array, "Nested struct array usage in dynamic loop",
1869 << "layout (std140, set = 0, binding = 0) uniform buffer0 { int ui_zero; };"
1870 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_one; };"
1871 << "layout (std140, set = 0, binding = 2) uniform buffer2 { int ui_two; };"
1872 << "layout (std140, set = 0, binding = 3) uniform buffer3 { int ui_three; };"
1873 << "layout (std140, set = 0, binding = 4) uniform buffer4 { mediump float uf_two; };"
1874 << "layout (std140, set = 0, binding = 5) uniform buffer5 { mediump float uf_three; };"
1875 << "layout (std140, set = 0, binding = 6) uniform buffer6 { mediump float uf_four; };"
1876 << "layout (std140, set = 0, binding = 7) uniform buffer7 { mediump float uf_half; };"
1877 << "layout (std140, set = 0, binding = 8) uniform buffer8 { mediump float uf_third; };"
1878 << "layout (std140, set = 0, binding = 9) uniform buffer9 { mediump float uf_fourth; };"
1879 << "layout (std140, set = 0, binding = 10) uniform buffer10 { mediump float uf_sixth; };"
1882 << " mediump float a;"
1883 << " mediump vec2 b[2];"
1886 << " mediump float a;"
1890 << "layout (std140, set = 0, binding = 11) uniform buffer11 { S s[2]; };"
1892 << "void main (void)"
1894 << " mediump float r = 0.0; // (x*3 + y*3) / 6.0"
1895 << " mediump float g = 0.0; // (y*3 + z*3) / 6.0"
1896 << " mediump float b = 0.0; // (z*3 + w*3) / 6.0"
1897 << " mediump float a = 1.0;"
1898 << " for (int i = 0; i < ui_two; i++)"
1900 << " for (int j = 0; j < ui_three; j++)"
1902 << " r += s[0].b[j].b[i].y;"
1903 << " g += s[i].b[j].b[0].x;"
1904 << " b += s[i].b[j].b[1].x;"
1905 << " a *= s[i].b[j].a;"
1908 << " ${DST} = vec4(r*uf_sixth, g*uf_sixth, b*uf_sixth, a);"
1912 instance.useUniform(0u, UI_ZERO);
1913 instance.useUniform(1u, UI_ONE);
1914 instance.useUniform(2u, UI_TWO);
1915 instance.useUniform(3u, UI_THREE);
1916 instance.useUniform(4u, UF_TWO);
1917 instance.useUniform(5u, UF_THREE);
1918 instance.useUniform(6u, UF_FOUR);
1919 instance.useUniform(7u, UF_HALF);
1920 instance.useUniform(8u, UF_THIRD);
1921 instance.useUniform(9u, UF_FOURTH);
1922 instance.useUniform(10u, UF_SIXTH);
1939 s[0].a = constCoords.x();
1941 s[0].b[0].b[0] = constCoords.swizzle(1,0,0,0);
1942 s[0].b[0].b[1] = constCoords.swizzle(2,0,0,0);
1943 s[0].b[1].a = 1.0f / 3.0f;
1944 s[0].b[1].b[0] = constCoords.swizzle(1,1,0,0);
1945 s[0].b[1].b[1] = constCoords.swizzle(3,1,0,0);
1946 s[0].b[2].a = 1.0f / 4.0f;
1947 s[0].b[2].b[0] = constCoords.swizzle(2,1,0,0);
1948 s[0].b[2].b[1] = constCoords.swizzle(2,1,0,0);
1951 s[1].a = constCoords.w();
1953 s[1].b[0].b[0] = constCoords.swizzle(2,0,0,0);
1954 s[1].b[0].b[1] = constCoords.swizzle(2,1,0,0);
1956 s[1].b[1].b[0] = constCoords.swizzle(2,2,0,0);
1957 s[1].b[1].b[1] = constCoords.swizzle(3,3,0,0);
1959 s[1].b[2].b[0] = constCoords.swizzle(1,0,0,0);
1960 s[1].b[2].b[1] = constCoords.swizzle(3,2,0,0);
1963 instance.addUniform(11u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 2 * sizeof(S), s);
1967 c.color.xyz() = (c.constCoords.swizzle(0, 1, 2) + c.constCoords.swizzle(1, 2, 3)) * 0.5f;
1970 UNIFORM_STRUCT_CASE(equal, "Struct equality",
1973 << "layout (std140, set = 0, binding = 0) uniform buffer0 { mediump float uf_one; };"
1974 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_two; };"
1977 << " mediump float a;"
1978 << " mediump vec3 b;"
1981 << "layout (std140, set = 0, binding = 2) uniform buffer2 { S a; };"
1982 << "layout (std140, set = 0, binding = 3) uniform buffer3 { S b; };"
1983 << "layout (std140, set = 0, binding = 4) uniform buffer4 { S c; };"
1985 << "void main (void)"
1987 << " S d = S(uf_one, vec3(0.0, floor(${COORDS}.y+1.0), 2.0), ui_two);"
1988 << " ${DST} = vec4(0.0, 0.0, 0.0, 1.0);"
1989 << " if (a == b) ${DST}.x = 1.0;"
1990 << " if (a == c) ${DST}.y = 1.0;"
1991 << " if (a == d) ${DST}.z = 1.0;"
1995 DE_UNREF(constCoords);
1996 instance.useUniform(0u, UF_ONE);
1997 instance.useUniform(1u, UI_TWO);
2008 sa.b = tcu::Vec3(0.0f, 1.0f, 2.0f);
2010 instance.addUniform(2u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(S), &sa);
2014 sb.b = tcu::Vec3(0.0f, 1.0f, 2.0f);
2016 instance.addUniform(3u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(S), &sb);
2020 sc.b = tcu::Vec3(0.0f, 1.1f, 2.0f);
2022 instance.addUniform(4u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(S), &sc);
2025 c.color.xy() = tcu::Vec2(1.0f, 0.0f);
2026 if (deFloatFloor(c.coords[1] + 1.0f) == deFloatFloor(1.1f))
2030 UNIFORM_STRUCT_CASE(not_equal, "Struct equality",
2033 << "layout (std140, set = 0, binding = 0) uniform buffer0 { mediump float uf_one; };"
2034 << "layout (std140, set = 0, binding = 1) uniform buffer1 { int ui_two; };"
2037 << " mediump float a;"
2038 << " mediump vec3 b;"
2041 << "layout (std140, set = 0, binding = 2) uniform buffer2 { S a; };"
2042 << "layout (std140, set = 0, binding = 3) uniform buffer3 { S b; };"
2043 << "layout (std140, set = 0, binding = 4) uniform buffer4 { S c; };"
2045 << "void main (void)"
2047 << " S d = S(uf_one, vec3(0.0, floor(${COORDS}.y+1.0), 2.0), ui_two);"
2048 << " ${DST} = vec4(0.0, 0.0, 0.0, 1.0);"
2049 << " if (a != b) ${DST}.x = 1.0;"
2050 << " if (a != c) ${DST}.y = 1.0;"
2051 << " if (a != d) ${DST}.z = 1.0;"
2055 DE_UNREF(constCoords);
2056 instance.useUniform(0u, UF_ONE);
2057 instance.useUniform(1u, UI_TWO);
2068 sa.b = tcu::Vec3(0.0f, 1.0f, 2.0f);
2070 instance.addUniform(2u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(S), &sa);
2074 sb.b = tcu::Vec3(0.0f, 1.0f, 2.0f);
2076 instance.addUniform(3u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(S), &sb);
2080 sc.b = tcu::Vec3(0.0f, 1.1f, 2.0f);
2082 instance.addUniform(4u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(S), &sc);
2085 c.color.xy() = tcu::Vec2(0.0f, 1.0f);
2086 if (deFloatFloor(c.coords[1] + 1.0f) != deFloatFloor(1.1f))
2091 class ShaderStructTests : public tcu::TestCaseGroup
2094 ShaderStructTests (tcu::TestContext& context);
2095 virtual ~ShaderStructTests (void);
2097 virtual void init (void);
2100 ShaderStructTests (const ShaderStructTests&); // not allowed!
2101 ShaderStructTests& operator= (const ShaderStructTests&); // not allowed!
2104 ShaderStructTests::ShaderStructTests (tcu::TestContext& testCtx)
2105 : TestCaseGroup(testCtx, "struct", "Struct Tests")
2109 ShaderStructTests::~ShaderStructTests (void)
2113 void ShaderStructTests::init (void)
2115 addChild(new LocalStructTests(m_testCtx));
2116 addChild(new UniformStructTests(m_testCtx));
2121 tcu::TestCaseGroup* createStructTests (tcu::TestContext& testCtx)
2123 return new ShaderStructTests(testCtx);