[Piglit] [PATCH 08/63] arb_gl_spirv: add ubo tests with different matrix/array strides

Alejandro PiƱeiro apinheiro at igalia.com
Sat Feb 23 23:44:56 UTC 2019


ARB_gl_spirv requires that the SPIR-V includes the explicit matrix and
array stride. GLSL layouts are mapped in SPIR-V with explicit values
for offset, matrix stride and array stride, but as far as it respect
alignments and minimum offsets, the strides doesn't need to be exactly
what OpenGL GLSL computes for any of the allowed layouts, and in fact,
the rules are more similar to SPIR-V under Vulkan.

The tests defines two UBOs, with the same content (on type and data)
but that each one uses a different array/matrix stride. As they
contains the same content, you should be able to compare one and the
other on the code.

As you can't define different stride on GLSL, those are "SPIRV ONLY"
test. GLSL is there as a reference, as it was used to create the
SPIR-V shader, but then tweaked manually.

v2: no expected final substractions/additions value of content, but
    check for real values (Timothy)
---
 ...ray-different-array-stride-ubo.shader_test | 272 ++++++++++++++++++
 .../different-matrix-stride.shader_test       | 260 +++++++++++++++++
 2 files changed, 532 insertions(+)
 create mode 100644 tests/spec/arb_gl_spirv/execution/ubo/array-different-array-stride-ubo.shader_test
 create mode 100644 tests/spec/arb_gl_spirv/execution/ubo/matrix/different-matrix-stride.shader_test

diff --git a/tests/spec/arb_gl_spirv/execution/ubo/array-different-array-stride-ubo.shader_test b/tests/spec/arb_gl_spirv/execution/ubo/array-different-array-stride-ubo.shader_test
new file mode 100644
index 000000000..02e41af9b
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ubo/array-different-array-stride-ubo.shader_test
@@ -0,0 +1,272 @@
+# UBO test using two ubos, with an array with the same size and type,
+# but setting a different array stride for each one. Used to test that
+# the size is properly computed, and the content properly accessed in
+# both cases.
+
+[require]
+SPIRV ONLY
+GL >= 3.3
+GLSL >= 4.50
+GL_ARB_gl_spirv
+
+[vertex shader passthrough]
+
+[fragment shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py, and then edited by hand to set the proper array stride
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 123
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %color
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpName %_ ""
+               OpName %__0 ""
+               OpDecorate %color Location 0
+               OpDecorate %_arr_v4float_uint_3 ArrayStride 16
+               OpMemberDecorate %block16 0 Offset 0
+               OpDecorate %block16 Block
+               OpDecorate %_ DescriptorSet 0
+               OpDecorate %_ Binding 5
+               OpDecorate %_arr_v4float_uint_3_0 ArrayStride 32
+               OpMemberDecorate %block32 0 Offset 0
+               OpDecorate %block32 Block
+               OpDecorate %__0 DescriptorSet 0
+               OpDecorate %__0 Binding 6
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+    %float_1 = OpConstant %float 1
+    %float_0 = OpConstant %float 0
+         %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+      %color = OpVariable %_ptr_Output_v4float Output
+         %15 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
+       %bool = OpTypeBool
+       %uint = OpTypeInt 32 0
+     %uint_3 = OpConstant %uint 3
+%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3
+    %block16 = OpTypeStruct %_arr_v4float_uint_3
+%_ptr_Uniform_block16 = OpTypePointer Uniform %block16
+          %_ = OpVariable %_ptr_Uniform_block16 Uniform
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+%float_20530_7109 = OpConstant %float 20530.7109
+%float_n10508_5107 = OpConstant %float -10508.5107
+%float_n23051_9961 = OpConstant %float -23051.9961
+%float_n23564_0664 = OpConstant %float -23564.0664
+         %32 = OpConstantComposite %v4float %float_20530_7109 %float_n10508_5107 %float_n23051_9961 %float_n23564_0664
+     %v4bool = OpTypeVector %bool 4
+      %int_1 = OpConstant %int 1
+%float_n27681_2891 = OpConstant %float -27681.2891
+%float_9081_78711 = OpConstant %float 9081.78711
+%float_n12496_1973 = OpConstant %float -12496.1973
+%float_n5854_81055 = OpConstant %float -5854.81055
+         %46 = OpConstantComposite %v4float %float_n27681_2891 %float_9081_78711 %float_n12496_1973 %float_n5854_81055
+      %int_2 = OpConstant %int 2
+%float_5217_75732 = OpConstant %float 5217.75732
+%float_26363_8359 = OpConstant %float 26363.8359
+%float_n29557_3516 = OpConstant %float -29557.3516
+%float_30238_998 = OpConstant %float 30238.998
+         %60 = OpConstantComposite %v4float %float_5217_75732 %float_26363_8359 %float_n29557_3516 %float_30238_998
+%_arr_v4float_uint_3_0 = OpTypeArray %v4float %uint_3
+    %block32 = OpTypeStruct %_arr_v4float_uint_3_0
+%_ptr_Uniform_block32 = OpTypePointer Uniform %block32
+        %__0 = OpVariable %_ptr_Uniform_block32 Uniform
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+ %fail_color = OpVariable %_ptr_Function_v4float Function
+               OpStore %fail_color %12
+               OpStore %color %15
+         %26 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_0
+         %27 = OpLoad %v4float %26
+         %34 = OpFOrdNotEqual %v4bool %27 %32
+         %35 = OpAny %bool %34
+         %36 = OpLogicalNot %bool %35
+               OpSelectionMerge %38 None
+               OpBranchConditional %36 %37 %38
+         %37 = OpLabel
+         %40 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_1
+         %41 = OpLoad %v4float %40
+         %47 = OpFOrdNotEqual %v4bool %41 %46
+         %48 = OpAny %bool %47
+               OpBranch %38
+         %38 = OpLabel
+         %49 = OpPhi %bool %35 %5 %48 %37
+         %50 = OpLogicalNot %bool %49
+               OpSelectionMerge %52 None
+               OpBranchConditional %50 %51 %52
+         %51 = OpLabel
+         %54 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_2
+         %55 = OpLoad %v4float %54
+         %61 = OpFOrdNotEqual %v4bool %55 %60
+         %62 = OpAny %bool %61
+               OpBranch %52
+         %52 = OpLabel
+         %63 = OpPhi %bool %49 %38 %62 %51
+               OpSelectionMerge %65 None
+               OpBranchConditional %63 %64 %65
+         %64 = OpLabel
+         %66 = OpLoad %v4float %fail_color
+               OpStore %color %66
+               OpBranch %65
+         %65 = OpLabel
+         %71 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_0
+         %72 = OpLoad %v4float %71
+         %73 = OpFOrdNotEqual %v4bool %72 %32
+         %74 = OpAny %bool %73
+         %75 = OpLogicalNot %bool %74
+               OpSelectionMerge %77 None
+               OpBranchConditional %75 %76 %77
+         %76 = OpLabel
+         %78 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_1
+         %79 = OpLoad %v4float %78
+         %80 = OpFOrdNotEqual %v4bool %79 %46
+         %81 = OpAny %bool %80
+               OpBranch %77
+         %77 = OpLabel
+         %82 = OpPhi %bool %74 %65 %81 %76
+         %83 = OpLogicalNot %bool %82
+               OpSelectionMerge %85 None
+               OpBranchConditional %83 %84 %85
+         %84 = OpLabel
+         %86 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_2
+         %87 = OpLoad %v4float %86
+         %88 = OpFOrdNotEqual %v4bool %87 %60
+         %89 = OpAny %bool %88
+               OpBranch %85
+         %85 = OpLabel
+         %90 = OpPhi %bool %82 %77 %89 %84
+               OpSelectionMerge %92 None
+               OpBranchConditional %90 %91 %92
+         %91 = OpLabel
+         %93 = OpLoad %v4float %fail_color
+               OpStore %color %93
+               OpBranch %92
+         %92 = OpLabel
+         %94 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_0
+         %95 = OpLoad %v4float %94
+         %96 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_0
+         %97 = OpLoad %v4float %96
+         %98 = OpFOrdNotEqual %v4bool %95 %97
+         %99 = OpAny %bool %98
+        %100 = OpLogicalNot %bool %99
+               OpSelectionMerge %102 None
+               OpBranchConditional %100 %101 %102
+        %101 = OpLabel
+        %103 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_1
+        %104 = OpLoad %v4float %103
+        %105 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_1
+        %106 = OpLoad %v4float %105
+        %107 = OpFOrdNotEqual %v4bool %104 %106
+        %108 = OpAny %bool %107
+               OpBranch %102
+        %102 = OpLabel
+        %109 = OpPhi %bool %99 %92 %108 %101
+        %110 = OpLogicalNot %bool %109
+               OpSelectionMerge %112 None
+               OpBranchConditional %110 %111 %112
+        %111 = OpLabel
+        %113 = OpAccessChain %_ptr_Uniform_v4float %_ %int_0 %int_2
+        %114 = OpLoad %v4float %113
+        %115 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0 %int_2
+        %116 = OpLoad %v4float %115
+        %117 = OpFOrdNotEqual %v4bool %114 %116
+        %118 = OpAny %bool %117
+               OpBranch %112
+        %112 = OpLabel
+        %119 = OpPhi %bool %109 %102 %118 %111
+               OpSelectionMerge %121 None
+               OpBranchConditional %119 %120 %121
+        %120 = OpLabel
+        %122 = OpLoad %v4float %fail_color
+               OpStore %color %122
+               OpBranch %121
+        %121 = OpLabel
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+#version 450
+
+layout (location = 0) out vec4 color;
+
+layout (std140, binding = 5) uniform block16 {
+	vec4 arr16[3];
+};
+
+/*
+ * This array will have a array_stride of 32.
+ *
+ * Note that there is no way to set a explicit array_stride on GLSL. This GLSL
+ * was used initially to generate the SPIRV-V, and then array stride was tweaked.
+ * That's the reason this is a SPIRV ONLY test. GLSL here is just as reference.
+ */
+layout (std140, binding = 6) uniform block32 {
+	vec4 arr32[3];
+};
+
+
+void main()
+{
+	vec4 fail_color = vec4(1.0, 0.0, 0.0, 1.0);
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	if (arr16[0] != vec4(20530.7108263, -10508.5105669, -23051.9953613, -23564.0673228) ||
+            arr16[1] != vec4(-27681.288716, 9081.78673991, -12496.1967803, -5854.8105745) ||
+            arr16[2] != vec4(5217.75729, 26363.8367742, -29557.3508507, 30238.9989166)) {
+	    color = fail_color;
+	}
+
+	if (arr32[0] != vec4(20530.7108263, -10508.5105669, -23051.9953613, -23564.0673228) ||
+            arr32[1] != vec4(-27681.288716, 9081.78673991, -12496.1967803, -5854.8105745) ||
+            arr32[2] != vec4(5217.75729, 26363.8367742, -29557.3508507, 30238.9989166)) {
+	    color = fail_color;
+	}
+
+	if (arr16[0] != arr32[0] ||
+            arr16[1] != arr32[1] ||
+            arr16[2] != arr32[2]){
+	    color = fail_color;
+	}
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+block binding 5
+block offset 0
+uniform vec4 arr16[0] 20530.7108263 -10508.5105669 -23051.9953613 -23564.0673228
+block offset 16
+uniform vec4 arr16[1] -27681.288716 9081.78673991 -12496.1967803 -5854.8105745
+block offset 32
+uniform vec4 arr16[2] 5217.75729 26363.8367742 -29557.3508507 30238.9989166
+
+block binding 6
+block offset 0
+uniform vec4 arr32[0] 20530.7108263 -10508.5105669 -23051.9953613 -23564.0673228
+block offset 32
+uniform vec4 arr32[1] -27681.288716 9081.78673991 -12496.1967803 -5854.8105745
+block offset 64
+uniform vec4 arr32[2] 5217.75729 26363.8367742 -29557.3508507 30238.9989166
+
+block binding 5
+verify program_interface_query GL_UNIFORM_BLOCK block16 GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_UNIFORM_BLOCK block16 GL_BUFFER_DATA_SIZE 48
+
+block binding 6
+verify program_interface_query GL_UNIFORM_BLOCK block32 GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_UNIFORM_BLOCK block32 GL_BUFFER_DATA_SIZE 80
+
+verify program_query GL_ACTIVE_UNIFORMS 2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gl_spirv/execution/ubo/matrix/different-matrix-stride.shader_test b/tests/spec/arb_gl_spirv/execution/ubo/matrix/different-matrix-stride.shader_test
new file mode 100644
index 000000000..1df8f1c6a
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ubo/matrix/different-matrix-stride.shader_test
@@ -0,0 +1,260 @@
+# UBO test using two mat3x2. The content is the same, but the matrix
+# stride is different. Used to test that the size is properly
+# computed, and the content properly accessed in both cases.
+
+[require]
+SPIRV ONLY
+GL >= 3.3
+GLSL >= 4.50
+GL_ARB_gl_spirv
+
+[vertex shader passthrough]
+
+[fragment shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py, and then edited by hand to set the proper matrix stride
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 115
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %color
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpName %_ ""
+               OpName %__0 ""
+               OpDecorate %color Location 0
+               OpMemberDecorate %Block16 0 ColMajor
+               OpMemberDecorate %Block16 0 Offset 0
+               OpMemberDecorate %Block16 0 MatrixStride 16
+               OpDecorate %Block16 Block
+               OpDecorate %_ DescriptorSet 0
+               OpDecorate %_ Binding 5
+               OpMemberDecorate %Block32 0 ColMajor
+               OpMemberDecorate %Block32 0 Offset 0
+               OpMemberDecorate %Block32 0 MatrixStride 32
+               OpDecorate %Block32 Block
+               OpDecorate %__0 DescriptorSet 0
+               OpDecorate %__0 Binding 6
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+    %float_1 = OpConstant %float 1
+    %float_0 = OpConstant %float 0
+         %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+      %color = OpVariable %_ptr_Output_v4float Output
+         %15 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
+       %bool = OpTypeBool
+    %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+    %Block16 = OpTypeStruct %mat3v2float
+%_ptr_Uniform_Block16 = OpTypePointer Uniform %Block16
+          %_ = OpVariable %_ptr_Uniform_Block16 Uniform
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
+%float_31933_2734 = OpConstant %float 31933.2734
+%float_n11642_8975 = OpConstant %float -11642.8975
+         %29 = OpConstantComposite %v2float %float_31933_2734 %float_n11642_8975
+     %v2bool = OpTypeVector %bool 2
+      %int_1 = OpConstant %int 1
+%float_9012_23633 = OpConstant %float 9012.23633
+%float_n6150_84961 = OpConstant %float -6150.84961
+         %41 = OpConstantComposite %v2float %float_9012_23633 %float_n6150_84961
+      %int_2 = OpConstant %int 2
+%float_n10267_4893 = OpConstant %float -10267.4893
+%float_26495_5859 = OpConstant %float 26495.5859
+         %53 = OpConstantComposite %v2float %float_n10267_4893 %float_26495_5859
+    %Block32 = OpTypeStruct %mat3v2float
+%_ptr_Uniform_Block32 = OpTypePointer Uniform %Block32
+        %__0 = OpVariable %_ptr_Uniform_Block32 Uniform
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+ %fail_color = OpVariable %_ptr_Function_v4float Function
+               OpStore %fail_color %12
+               OpStore %color %15
+         %25 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_0
+         %26 = OpLoad %v2float %25
+         %31 = OpFOrdNotEqual %v2bool %26 %29
+         %32 = OpAny %bool %31
+         %33 = OpLogicalNot %bool %32
+               OpSelectionMerge %35 None
+               OpBranchConditional %33 %34 %35
+         %34 = OpLabel
+         %37 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_1
+         %38 = OpLoad %v2float %37
+         %42 = OpFOrdNotEqual %v2bool %38 %41
+         %43 = OpAny %bool %42
+               OpBranch %35
+         %35 = OpLabel
+         %44 = OpPhi %bool %32 %5 %43 %34
+         %45 = OpLogicalNot %bool %44
+               OpSelectionMerge %47 None
+               OpBranchConditional %45 %46 %47
+         %46 = OpLabel
+         %49 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_2
+         %50 = OpLoad %v2float %49
+         %54 = OpFOrdNotEqual %v2bool %50 %53
+         %55 = OpAny %bool %54
+               OpBranch %47
+         %47 = OpLabel
+         %56 = OpPhi %bool %44 %35 %55 %46
+               OpSelectionMerge %58 None
+               OpBranchConditional %56 %57 %58
+         %57 = OpLabel
+         %59 = OpLoad %v4float %fail_color
+               OpStore %color %59
+               OpBranch %58
+         %58 = OpLabel
+         %63 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %int_0
+         %64 = OpLoad %v2float %63
+         %65 = OpFOrdNotEqual %v2bool %64 %29
+         %66 = OpAny %bool %65
+         %67 = OpLogicalNot %bool %66
+               OpSelectionMerge %69 None
+               OpBranchConditional %67 %68 %69
+         %68 = OpLabel
+         %70 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %int_1
+         %71 = OpLoad %v2float %70
+         %72 = OpFOrdNotEqual %v2bool %71 %41
+         %73 = OpAny %bool %72
+               OpBranch %69
+         %69 = OpLabel
+         %74 = OpPhi %bool %66 %58 %73 %68
+         %75 = OpLogicalNot %bool %74
+               OpSelectionMerge %77 None
+               OpBranchConditional %75 %76 %77
+         %76 = OpLabel
+         %78 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %int_2
+         %79 = OpLoad %v2float %78
+         %80 = OpFOrdNotEqual %v2bool %79 %53
+         %81 = OpAny %bool %80
+               OpBranch %77
+         %77 = OpLabel
+         %82 = OpPhi %bool %74 %69 %81 %76
+               OpSelectionMerge %84 None
+               OpBranchConditional %82 %83 %84
+         %83 = OpLabel
+         %85 = OpLoad %v4float %fail_color
+               OpStore %color %85
+               OpBranch %84
+         %84 = OpLabel
+         %86 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_0
+         %87 = OpLoad %v2float %86
+         %88 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %int_0
+         %89 = OpLoad %v2float %88
+         %90 = OpFOrdNotEqual %v2bool %87 %89
+         %91 = OpAny %bool %90
+         %92 = OpLogicalNot %bool %91
+               OpSelectionMerge %94 None
+               OpBranchConditional %92 %93 %94
+         %93 = OpLabel
+         %95 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_1
+         %96 = OpLoad %v2float %95
+         %97 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %int_1
+         %98 = OpLoad %v2float %97
+         %99 = OpFOrdNotEqual %v2bool %96 %98
+        %100 = OpAny %bool %99
+               OpBranch %94
+         %94 = OpLabel
+        %101 = OpPhi %bool %91 %84 %100 %93
+        %102 = OpLogicalNot %bool %101
+               OpSelectionMerge %104 None
+               OpBranchConditional %102 %103 %104
+        %103 = OpLabel
+        %105 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0 %int_2
+        %106 = OpLoad %v2float %105
+        %107 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %int_2
+        %108 = OpLoad %v2float %107
+        %109 = OpFOrdNotEqual %v2bool %106 %108
+        %110 = OpAny %bool %109
+               OpBranch %104
+        %104 = OpLabel
+        %111 = OpPhi %bool %101 %94 %110 %103
+               OpSelectionMerge %113 None
+               OpBranchConditional %111 %112 %113
+        %112 = OpLabel
+        %114 = OpLoad %v4float %fail_color
+               OpStore %color %114
+               OpBranch %113
+        %113 = OpLabel
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 color;
+layout (std140, binding = 5, column_major) uniform Block16
+ {
+ mat3x2 m16;
+ };
+
+/* Note that there is no way to set the matrix_stride on GLSL. This GLSL was used
+ * initially to generate the SPIRV-V, and then matrix stride was tweaked.
+ * That's the reason this is a SPIRV ONLY test. GLSL here is just as reference.
+ */
+layout (std140, binding = 6, column_major) uniform Block32
+ {
+ mat3x2 m32;
+ };
+
+void main()
+
+{
+	vec4 fail_color = vec4(1.0, 0.0, 0.0, 1.0);
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	if (m16[0] != vec2(31933.27393, -11642.8972152) ||
+            m16[1] != vec2(9012.23624018, -6150.84975967) ||
+            m16[2] != vec2(-10267.4895552, 26495.5859007)) {
+	    color = fail_color;
+	}
+
+	if (m32[0] != vec2(31933.27393, -11642.8972152) ||
+            m32[1] != vec2(9012.23624018, -6150.84975967) ||
+            m32[2] != vec2(-10267.4895552, 26495.5859007)) {
+	    color = fail_color;
+	}
+
+	if (m16[0] != m32[0] ||
+            m16[1] != m32[1] ||
+            m16[2] != m32[2]){
+	    color = fail_color;
+	}
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+block binding 5
+block offset 0
+block matrix stride 16
+block row major 0
+uniform mat3x2 m16 31933.27393 -11642.8972152 9012.23624018 -6150.84975967 -10267.4895552 26495.5859007
+
+block binding 6
+block offset 0
+block matrix stride 32
+block row major 0
+uniform mat3x2 m32 31933.27393 -11642.8972152 9012.23624018 -6150.84975967 -10267.4895552 26495.5859007
+
+block binding 5
+verify program_interface_query GL_UNIFORM_BLOCK ComponentsBlock GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_UNIFORM_BLOCK ComponentsBlock GL_BUFFER_DATA_SIZE 48
+
+block binding 6
+verify program_interface_query GL_UNIFORM_BLOCK ComponentsBlock GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_UNIFORM_BLOCK ComponentsBlock GL_BUFFER_DATA_SIZE 80
+
+verify program_query GL_ACTIVE_UNIFORMS 2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.19.1



More information about the Piglit mailing list