[Piglit] [PATCH 22/35] arb_gl_spirv: Add a test for a uniform struct with struct members
Alejandro PiƱeiro
apinheiro at igalia.com
Thu Aug 9 11:36:01 UTC 2018
From: Neil Roberts <nroberts at igalia.com>
---
.../execution/uniform/embedded-structs.shader_test | 151 +++++++++++++++++++++
1 file changed, 151 insertions(+)
create mode 100644 tests/spec/arb_gl_spirv/execution/uniform/embedded-structs.shader_test
diff --git a/tests/spec/arb_gl_spirv/execution/uniform/embedded-structs.shader_test b/tests/spec/arb_gl_spirv/execution/uniform/embedded-structs.shader_test
new file mode 100644
index 000000000..0dd7ba486
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/uniform/embedded-structs.shader_test
@@ -0,0 +1,151 @@
+# Tests an array of arrays with an explicit uniform location
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 4.50
+
+[vertex shader passthrough]
+
+[fragment shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 4
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %color
+ OpExecutionMode %main OriginLowerLeft
+ OpSource GLSL 450
+ OpName %main "main"
+ OpName %color "color"
+ OpName %pair "pair"
+ OpMemberName %pair 0 "a"
+ OpMemberName %pair 1 "b"
+ OpName %quadruple "quadruple"
+ OpMemberName %quadruple 0 "a"
+ OpMemberName %quadruple 1 "b"
+ OpName %_ ""
+ OpMemberName %_ 0 "r"
+ OpMemberName %_ 1 "g"
+ OpMemberName %_ 2 "b"
+ OpName %parts "parts"
+ OpDecorate %color Location 0
+ OpDecorate %parts Location 0
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %color = OpVariable %_ptr_Output_v4float Output
+ %pair = OpTypeStruct %float %float
+ %quadruple = OpTypeStruct %pair %pair
+ %_ = OpTypeStruct %quadruple %quadruple %quadruple
+%_ptr_UniformConstant__ = OpTypePointer UniformConstant %_
+ %parts = OpVariable %_ptr_UniformConstant__ UniformConstant
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_UniformConstant_float = OpTypePointer UniformConstant %float
+ %int_1 = OpConstant %int 1
+ %int_2 = OpConstant %int 2
+ %float_1 = OpConstant %float 1
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %18 = OpAccessChain %_ptr_UniformConstant_float %parts %int_0 %int_0 %int_0
+ %19 = OpLoad %float %18
+ %21 = OpAccessChain %_ptr_UniformConstant_float %parts %int_0 %int_0 %int_1
+ %22 = OpLoad %float %21
+ %23 = OpFAdd %float %19 %22
+ %24 = OpAccessChain %_ptr_UniformConstant_float %parts %int_0 %int_1 %int_0
+ %25 = OpLoad %float %24
+ %26 = OpFAdd %float %23 %25
+ %27 = OpAccessChain %_ptr_UniformConstant_float %parts %int_0 %int_1 %int_1
+ %28 = OpLoad %float %27
+ %29 = OpFAdd %float %26 %28
+ %30 = OpAccessChain %_ptr_UniformConstant_float %parts %int_1 %int_0 %int_0
+ %31 = OpLoad %float %30
+ %32 = OpAccessChain %_ptr_UniformConstant_float %parts %int_1 %int_0 %int_1
+ %33 = OpLoad %float %32
+ %34 = OpFAdd %float %31 %33
+ %35 = OpAccessChain %_ptr_UniformConstant_float %parts %int_1 %int_1 %int_0
+ %36 = OpLoad %float %35
+ %37 = OpFAdd %float %34 %36
+ %38 = OpAccessChain %_ptr_UniformConstant_float %parts %int_1 %int_1 %int_1
+ %39 = OpLoad %float %38
+ %40 = OpFAdd %float %37 %39
+ %42 = OpAccessChain %_ptr_UniformConstant_float %parts %int_2 %int_0 %int_0
+ %43 = OpLoad %float %42
+ %44 = OpAccessChain %_ptr_UniformConstant_float %parts %int_2 %int_0 %int_1
+ %45 = OpLoad %float %44
+ %46 = OpFAdd %float %43 %45
+ %47 = OpAccessChain %_ptr_UniformConstant_float %parts %int_2 %int_1 %int_0
+ %48 = OpLoad %float %47
+ %49 = OpFAdd %float %46 %48
+ %50 = OpAccessChain %_ptr_UniformConstant_float %parts %int_2 %int_1 %int_1
+ %51 = OpLoad %float %50
+ %52 = OpFAdd %float %49 %51
+ %54 = OpCompositeConstruct %v4float %29 %40 %52 %float_1
+ OpStore %color %54
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+#version 450
+
+struct pair {
+ float a;
+ float b;
+};
+
+struct quadruple {
+ pair a;
+ pair b;
+};
+
+layout(location = 0) uniform struct {
+ quadruple r;
+ quadruple g;
+ quadruple b;
+} parts;
+
+out vec4 color;
+
+void main()
+{
+ color = vec4(parts.r.a.a +
+ parts.r.a.b +
+ parts.r.b.a +
+ parts.r.b.b,
+ parts.g.a.a +
+ parts.g.a.b +
+ parts.g.b.a +
+ parts.g.b.b,
+ parts.b.a.a +
+ parts.b.a.b +
+ parts.b.b.a +
+ parts.b.b.b,
+ 1.0);
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform float 0 0.02
+uniform float 1 0.04
+uniform float 2 0.06
+uniform float 3 0.08
+uniform float 4 0.1
+uniform float 5 0.12
+uniform float 6 0.14
+uniform float 7 0.16
+uniform float 8 0.18
+uniform float 9 0.2
+uniform float 10 0.22
+uniform float 11 0.24
+
+draw rect -1 -1 2 2
+probe all rgba 0.2 0.52 0.84 1.0
--
2.14.1
More information about the Piglit
mailing list