[14/17] arb_gl_spirv: add simple ssbo tests with matrices

Submitted by apinheiro on Sept. 15, 2018, 4:22 p.m.

Details

Message ID 20180915162255.21591-16-apinheiro@igalia.com
State New
Headers show
Series "ARB_gl_spirv: ubo/ssbo tests" ( rev: 2 1 ) in Piglit

Not browsing as part of any series.

Commit Message

apinheiro Sept. 15, 2018, 4:22 p.m.
---
 .../execution/ssbo/matrix/column-major.shader_test | 109 ++++++++++++
 .../ssbo/matrix/column-vs-row.shader_test          | 196 +++++++++++++++++++++
 .../ssbo/matrix/indirect-column-major.shader_test  | 131 ++++++++++++++
 .../ssbo/matrix/indirect-row-major.shader_test     | 131 ++++++++++++++
 .../execution/ssbo/matrix/row-major.shader_test    | 109 ++++++++++++
 5 files changed, 676 insertions(+)
 create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/matrix/column-major.shader_test
 create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/matrix/column-vs-row.shader_test
 create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/matrix/indirect-column-major.shader_test
 create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/matrix/indirect-row-major.shader_test
 create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/matrix/row-major.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/matrix/column-major.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/column-major.shader_test
new file mode 100644
index 000000000..737c8ab05
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/column-major.shader_test
@@ -0,0 +1,109 @@ 
+# UBO test using a matrix. One stage
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_gl_spirv
+
+[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; 7
+; Bound: 32
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %outColor
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpDecorate %outColor Location 0
+               OpMemberDecorate %ssbo 0 ColMajor
+               OpMemberDecorate %ssbo 0 Offset 0
+               OpMemberDecorate %ssbo 0 MatrixStride 16
+               OpDecorate %ssbo BufferBlock
+               OpDecorate %components DescriptorSet 0
+               OpDecorate %components Binding 5
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+   %outColor = OpVariable %_ptr_Output_v4float Output
+%mat4v4float = OpTypeMatrix %v4float 4
+       %ssbo = OpTypeStruct %mat4v4float
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %components = OpVariable %_ptr_Uniform_ssbo Uniform
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+      %int_3 = OpConstant %int 3
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+     %uint_1 = OpConstant %uint 1
+     %uint_2 = OpConstant %uint 2
+     %uint_3 = OpConstant %uint 3
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+         %20 = OpAccessChain %_ptr_Uniform_float %components %int_0 %int_3 %uint_0
+         %21 = OpLoad %float %20
+         %23 = OpAccessChain %_ptr_Uniform_float %components %int_0 %int_3 %uint_1
+         %24 = OpLoad %float %23
+         %26 = OpAccessChain %_ptr_Uniform_float %components %int_0 %int_3 %uint_2
+         %27 = OpLoad %float %26
+         %29 = OpAccessChain %_ptr_Uniform_float %components %int_0 %int_3 %uint_3
+         %30 = OpLoad %float %29
+         %31 = OpCompositeConstruct %v4float %21 %24 %27 %30
+               OpStore %outColor %31
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 outColor;
+layout (std430, binding = 5, column_major) buffer ssbo
+ {
+    mat4 matrix;
+ } components;
+
+void main()
+{
+	outColor = vec4(components.matrix[3][0], components.matrix[3][1], components.matrix[3][2], components.matrix[3][3]);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+ssbo 5 64
+ssbo 5 subdata float 0  0.11
+ssbo 5 subdata float 4  0.12
+ssbo 5 subdata float 8  0.13
+ssbo 5 subdata float 12 0.14
+ssbo 5 subdata float 16 0.21
+ssbo 5 subdata float 20 0.22
+ssbo 5 subdata float 24 0.23
+ssbo 5 subdata float 28 0.24
+ssbo 5 subdata float 32 0.31
+ssbo 5 subdata float 36 0.32
+ssbo 5 subdata float 40 0.33
+ssbo 5 subdata float 44 0.34
+ssbo 5 subdata float 48 0.41
+ssbo 5 subdata float 52 0.42
+ssbo 5 subdata float 56 0.43
+ssbo 5 subdata float 60 0.44
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_BUFFER_DATA_SIZE 64
+
+verify program_query GL_ACTIVE_UNIFORMS 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.41 0.42 0.43 0.44
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/matrix/column-vs-row.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/column-vs-row.shader_test
new file mode 100644
index 000000000..3a391d860
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/column-vs-row.shader_test
@@ -0,0 +1,196 @@ 
+# SSBO test comparing a matrix using row_major layout and another
+# using column_major layout, when the data used for both is the same.
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 3.30
+
+[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; 7
+; Bound: 59
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %outColor
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpDecorate %outColor Location 0
+               OpMemberDecorate %column_ssbo 0 ColMajor
+               OpMemberDecorate %column_ssbo 0 Offset 0
+               OpMemberDecorate %column_ssbo 0 MatrixStride 16
+               OpDecorate %column_ssbo BufferBlock
+               OpDecorate %my_column_major DescriptorSet 0
+               OpDecorate %my_column_major Binding 5
+               OpMemberDecorate %row_ssbo 0 RowMajor
+               OpMemberDecorate %row_ssbo 0 Offset 0
+               OpMemberDecorate %row_ssbo 0 MatrixStride 16
+               OpDecorate %row_ssbo BufferBlock
+               OpDecorate %my_row_major DescriptorSet 0
+               OpDecorate %my_row_major Binding 7
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+   %outColor = OpVariable %_ptr_Output_v4float Output
+    %float_0 = OpConstant %float 0
+    %float_1 = OpConstant %float 1
+         %12 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_0
+        %int = OpTypeInt 32 1
+%_ptr_Function_int = OpTypePointer Function %int
+      %int_0 = OpConstant %int 0
+      %int_4 = OpConstant %int 4
+       %bool = OpTypeBool
+%mat4v4float = OpTypeMatrix %v4float 4
+%column_ssbo = OpTypeStruct %mat4v4float
+%_ptr_Uniform_column_ssbo = OpTypePointer Uniform %column_ssbo
+%my_column_major = OpVariable %_ptr_Uniform_column_ssbo Uniform
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+   %row_ssbo = OpTypeStruct %mat4v4float
+%_ptr_Uniform_row_ssbo = OpTypePointer Uniform %row_ssbo
+%my_row_major = OpVariable %_ptr_Uniform_row_ssbo Uniform
+         %53 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_0
+      %int_1 = OpConstant %int 1
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+     %column = OpVariable %_ptr_Function_int Function
+        %row = OpVariable %_ptr_Function_int Function
+               OpStore %outColor %12
+               OpStore %column %int_0
+               OpBranch %17
+         %17 = OpLabel
+               OpLoopMerge %19 %20 None
+               OpBranch %21
+         %21 = OpLabel
+         %22 = OpLoad %int %column
+         %25 = OpSLessThan %bool %22 %int_4
+               OpBranchConditional %25 %18 %19
+         %18 = OpLabel
+               OpStore %row %int_0
+               OpBranch %27
+         %27 = OpLabel
+               OpLoopMerge %29 %30 None
+               OpBranch %31
+         %31 = OpLabel
+         %32 = OpLoad %int %row
+         %33 = OpSLessThan %bool %32 %int_4
+               OpBranchConditional %33 %28 %29
+         %28 = OpLabel
+         %38 = OpLoad %int %column
+         %39 = OpLoad %int %row
+         %41 = OpAccessChain %_ptr_Uniform_float %my_column_major %int_0 %38 %39
+         %42 = OpLoad %float %41
+         %46 = OpLoad %int %row
+         %47 = OpLoad %int %column
+         %48 = OpAccessChain %_ptr_Uniform_float %my_row_major %int_0 %46 %47
+         %49 = OpLoad %float %48
+         %50 = OpFOrdNotEqual %bool %42 %49
+               OpSelectionMerge %52 None
+               OpBranchConditional %50 %51 %52
+         %51 = OpLabel
+               OpStore %outColor %53
+               OpBranch %52
+         %52 = OpLabel
+               OpBranch %30
+         %30 = OpLabel
+         %54 = OpLoad %int %row
+         %56 = OpIAdd %int %54 %int_1
+               OpStore %row %56
+               OpBranch %27
+         %29 = OpLabel
+               OpBranch %20
+         %20 = OpLabel
+         %57 = OpLoad %int %column
+         %58 = OpIAdd %int %57 %int_1
+               OpStore %column %58
+               OpBranch %17
+         %19 = OpLabel
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 outColor;
+layout (std430, binding = 5, column_major) buffer column_ssbo
+ {
+    mat4 matrix;
+ } my_column_major;
+
+layout (std430, binding = 7, row_major) buffer row_ssbo
+ {
+    mat4 matrix;
+ } my_row_major;
+
+void main()
+{
+   outColor = vec4(0.0, 1.0, 0.0, 0.0);
+
+   for (int column = 0; column < 4; column++)
+     for (int row = 0; row < 4; row++) {
+        if (my_column_major.matrix[column][row] != my_row_major.matrix[row][column])
+	   outColor = vec4(1.0, 0.0, 0.0, 0.0);
+     }
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+ssbo 5 64
+ssbo 5 subdata float 0  0.11
+ssbo 5 subdata float 4  0.12
+ssbo 5 subdata float 8  0.13
+ssbo 5 subdata float 12 0.14
+ssbo 5 subdata float 16 0.21
+ssbo 5 subdata float 20 0.22
+ssbo 5 subdata float 24 0.23
+ssbo 5 subdata float 28 0.24
+ssbo 5 subdata float 32 0.31
+ssbo 5 subdata float 36 0.32
+ssbo 5 subdata float 40 0.33
+ssbo 5 subdata float 44 0.34
+ssbo 5 subdata float 48 0.41
+ssbo 5 subdata float 52 0.42
+ssbo 5 subdata float 56 0.43
+ssbo 5 subdata float 60 0.44
+
+ssbo 7 64
+ssbo 7 subdata float 0  0.11
+ssbo 7 subdata float 4  0.12
+ssbo 7 subdata float 8  0.13
+ssbo 7 subdata float 12 0.14
+ssbo 7 subdata float 16 0.21
+ssbo 7 subdata float 20 0.22
+ssbo 7 subdata float 24 0.23
+ssbo 7 subdata float 28 0.24
+ssbo 7 subdata float 32 0.31
+ssbo 7 subdata float 36 0.32
+ssbo 7 subdata float 40 0.33
+ssbo 7 subdata float 44 0.34
+ssbo 7 subdata float 48 0.41
+ssbo 7 subdata float 52 0.42
+ssbo 7 subdata float 56 0.43
+ssbo 7 subdata float 60 0.44
+
+block binding 6
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK column_ssbo GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK column_ssbo GL_BUFFER_DATA_SIZE 64
+
+block binding 7
+verify program_interface_query GL_SHADER_STORAGE_BLOCK row_ssbo GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK row_ssbo GL_BUFFER_DATA_SIZE 64
+
+verify program_query GL_ACTIVE_UNIFORMS 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/matrix/indirect-column-major.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/indirect-column-major.shader_test
new file mode 100644
index 000000000..0f9546233
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/indirect-column-major.shader_test
@@ -0,0 +1,131 @@ 
+# SSBO test using a matrix. One stage. Using indirect indexing to
+# print all the rows.
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_gl_spirv
+
+[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; 7
+; Bound: 37
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %outColor
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpDecorate %outColor Location 0
+               OpMemberDecorate %ssbo 0 ColMajor
+               OpMemberDecorate %ssbo 0 Offset 0
+               OpMemberDecorate %ssbo 0 MatrixStride 16
+               OpDecorate %ssbo BufferBlock
+               OpDecorate %components DescriptorSet 0
+               OpDecorate %components Binding 5
+               OpDecorate %u_idx Location 10
+               OpDecorate %u_idx DescriptorSet 0
+               OpDecorate %u_idx Binding 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+   %outColor = OpVariable %_ptr_Output_v4float Output
+%mat4v4float = OpTypeMatrix %v4float 4
+       %ssbo = OpTypeStruct %mat4v4float
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %components = OpVariable %_ptr_Uniform_ssbo Uniform
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_UniformConstant_int = OpTypePointer UniformConstant %int
+      %u_idx = OpVariable %_ptr_UniformConstant_int UniformConstant
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+     %uint_1 = OpConstant %uint 1
+     %uint_2 = OpConstant %uint 2
+     %uint_3 = OpConstant %uint 3
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+         %18 = OpLoad %int %u_idx
+         %22 = OpAccessChain %_ptr_Uniform_float %components %int_0 %18 %uint_0
+         %23 = OpLoad %float %22
+         %24 = OpLoad %int %u_idx
+         %26 = OpAccessChain %_ptr_Uniform_float %components %int_0 %24 %uint_1
+         %27 = OpLoad %float %26
+         %28 = OpLoad %int %u_idx
+         %30 = OpAccessChain %_ptr_Uniform_float %components %int_0 %28 %uint_2
+         %31 = OpLoad %float %30
+         %32 = OpLoad %int %u_idx
+         %34 = OpAccessChain %_ptr_Uniform_float %components %int_0 %32 %uint_3
+         %35 = OpLoad %float %34
+         %36 = OpCompositeConstruct %v4float %23 %27 %31 %35
+               OpStore %outColor %36
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+layout (location = 10) uniform int u_idx;
+layout (location = 0) out vec4 outColor;
+layout (std430, binding = 5, column_major) buffer ssbo
+ {
+    mat4 matrix;
+ } components;
+
+void main()
+{
+	outColor = vec4(components.matrix[u_idx][0], components.matrix[u_idx][1], components.matrix[u_idx][2], components.matrix[u_idx][3]);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+ssbo 5 64
+ssbo 5 subdata float 0  0.11
+ssbo 5 subdata float 4  0.12
+ssbo 5 subdata float 8  0.13
+ssbo 5 subdata float 12 0.14
+ssbo 5 subdata float 16 0.21
+ssbo 5 subdata float 20 0.22
+ssbo 5 subdata float 24 0.23
+ssbo 5 subdata float 28 0.24
+ssbo 5 subdata float 32 0.31
+ssbo 5 subdata float 36 0.32
+ssbo 5 subdata float 40 0.33
+ssbo 5 subdata float 44 0.34
+ssbo 5 subdata float 48 0.41
+ssbo 5 subdata float 52 0.42
+ssbo 5 subdata float 56 0.43
+ssbo 5 subdata float 60 0.44
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_BUFFER_DATA_SIZE 64
+
+verify program_query GL_ACTIVE_UNIFORMS 1
+
+uniform int 10 0
+draw rect -1 -1 2 2
+probe all rgba 0.11 0.12 0.13 0.14
+
+uniform int 10 1
+draw rect -1 -1 2 2
+probe all rgba 0.21 0.22 0.23 0.24
+
+uniform int 10 2
+draw rect -1 -1 2 2
+probe all rgba 0.31 0.32 0.33 0.34
+
+uniform int 10 3
+draw rect -1 -1 2 2
+probe all rgba 0.41 0.42 0.43 0.44
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/matrix/indirect-row-major.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/indirect-row-major.shader_test
new file mode 100644
index 000000000..91dd2f1e5
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/indirect-row-major.shader_test
@@ -0,0 +1,131 @@ 
+# SSBO test using a matrix. One stage. Using indirect indexing to
+# print all the rows.
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_gl_spirv
+
+[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; 7
+; Bound: 37
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %outColor
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpDecorate %outColor Location 0
+               OpMemberDecorate %ssbo 0 RowMajor
+               OpMemberDecorate %ssbo 0 Offset 0
+               OpMemberDecorate %ssbo 0 MatrixStride 16
+               OpDecorate %ssbo BufferBlock
+               OpDecorate %components DescriptorSet 0
+               OpDecorate %components Binding 5
+               OpDecorate %u_idx Location 10
+               OpDecorate %u_idx DescriptorSet 0
+               OpDecorate %u_idx Binding 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+   %outColor = OpVariable %_ptr_Output_v4float Output
+%mat4v4float = OpTypeMatrix %v4float 4
+       %ssbo = OpTypeStruct %mat4v4float
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %components = OpVariable %_ptr_Uniform_ssbo Uniform
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+%_ptr_UniformConstant_int = OpTypePointer UniformConstant %int
+      %u_idx = OpVariable %_ptr_UniformConstant_int UniformConstant
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+     %uint_1 = OpConstant %uint 1
+     %uint_2 = OpConstant %uint 2
+     %uint_3 = OpConstant %uint 3
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+         %18 = OpLoad %int %u_idx
+         %22 = OpAccessChain %_ptr_Uniform_float %components %int_0 %18 %uint_0
+         %23 = OpLoad %float %22
+         %24 = OpLoad %int %u_idx
+         %26 = OpAccessChain %_ptr_Uniform_float %components %int_0 %24 %uint_1
+         %27 = OpLoad %float %26
+         %28 = OpLoad %int %u_idx
+         %30 = OpAccessChain %_ptr_Uniform_float %components %int_0 %28 %uint_2
+         %31 = OpLoad %float %30
+         %32 = OpLoad %int %u_idx
+         %34 = OpAccessChain %_ptr_Uniform_float %components %int_0 %32 %uint_3
+         %35 = OpLoad %float %34
+         %36 = OpCompositeConstruct %v4float %23 %27 %31 %35
+               OpStore %outColor %36
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+layout (location = 10) uniform int u_idx;
+layout (location = 0) out vec4 outColor;
+layout (std430, binding = 5, row_major) buffer ssbo
+ {
+    mat4 matrix;
+ } components;
+
+void main()
+{
+	outColor = vec4(components.matrix[u_idx][0], components.matrix[u_idx][1], components.matrix[u_idx][2], components.matrix[u_idx][3]);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+ssbo 5 64
+ssbo 5 subdata float 0  0.11
+ssbo 5 subdata float 4  0.12
+ssbo 5 subdata float 8  0.13
+ssbo 5 subdata float 12 0.14
+ssbo 5 subdata float 16 0.21
+ssbo 5 subdata float 20 0.22
+ssbo 5 subdata float 24 0.23
+ssbo 5 subdata float 28 0.24
+ssbo 5 subdata float 32 0.31
+ssbo 5 subdata float 36 0.32
+ssbo 5 subdata float 40 0.33
+ssbo 5 subdata float 44 0.34
+ssbo 5 subdata float 48 0.41
+ssbo 5 subdata float 52 0.42
+ssbo 5 subdata float 56 0.43
+ssbo 5 subdata float 60 0.44
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_BUFFER_DATA_SIZE 64
+
+verify program_query GL_ACTIVE_UNIFORMS 1
+
+uniform int 10 0
+draw rect -1 -1 2 2
+probe all rgba 0.11 0.21 0.31 0.41
+
+uniform int 10 1
+draw rect -1 -1 2 2
+probe all rgba 0.12 0.22 0.32 0.42
+
+uniform int 10 2
+draw rect -1 -1 2 2
+probe all rgba 0.13 0.23 0.33 0.43
+
+uniform int 10 3
+draw rect -1 -1 2 2
+probe all rgba 0.14 0.24 0.34 0.44
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/matrix/row-major.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/row-major.shader_test
new file mode 100644
index 000000000..48805d4ee
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/matrix/row-major.shader_test
@@ -0,0 +1,109 @@ 
+# SSBO test using a matrix. One stage
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_gl_spirv
+
+[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; 7
+; Bound: 32
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %outColor
+               OpExecutionMode %main OriginLowerLeft
+               OpSource GLSL 450
+               OpDecorate %outColor Location 0
+               OpMemberDecorate %ssbo 0 RowMajor
+               OpMemberDecorate %ssbo 0 Offset 0
+               OpMemberDecorate %ssbo 0 MatrixStride 16
+               OpDecorate %ssbo BufferBlock
+               OpDecorate %components DescriptorSet 0
+               OpDecorate %components Binding 5
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+      %float = OpTypeFloat 32
+    %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+   %outColor = OpVariable %_ptr_Output_v4float Output
+%mat4v4float = OpTypeMatrix %v4float 4
+       %ssbo = OpTypeStruct %mat4v4float
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %components = OpVariable %_ptr_Uniform_ssbo Uniform
+        %int = OpTypeInt 32 1
+      %int_0 = OpConstant %int 0
+      %int_3 = OpConstant %int 3
+       %uint = OpTypeInt 32 0
+     %uint_0 = OpConstant %uint 0
+%_ptr_Uniform_float = OpTypePointer Uniform %float
+     %uint_1 = OpConstant %uint 1
+     %uint_2 = OpConstant %uint 2
+     %uint_3 = OpConstant %uint 3
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+         %20 = OpAccessChain %_ptr_Uniform_float %components %int_0 %int_3 %uint_0
+         %21 = OpLoad %float %20
+         %23 = OpAccessChain %_ptr_Uniform_float %components %int_0 %int_3 %uint_1
+         %24 = OpLoad %float %23
+         %26 = OpAccessChain %_ptr_Uniform_float %components %int_0 %int_3 %uint_2
+         %27 = OpLoad %float %26
+         %29 = OpAccessChain %_ptr_Uniform_float %components %int_0 %int_3 %uint_3
+         %30 = OpLoad %float %29
+         %31 = OpCompositeConstruct %v4float %21 %24 %27 %30
+               OpStore %outColor %31
+               OpReturn
+               OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 outColor;
+layout (std430, binding = 5, row_major) buffer ssbo
+ {
+    mat4 matrix;
+ } components;
+
+void main()
+{
+	outColor = vec4(components.matrix[3][0], components.matrix[3][1], components.matrix[3][2], components.matrix[3][3]);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+
+ssbo 5 64
+ssbo 5 subdata float 0  0.11
+ssbo 5 subdata float 4  0.12
+ssbo 5 subdata float 8  0.13
+ssbo 5 subdata float 12 0.14
+ssbo 5 subdata float 16 0.21
+ssbo 5 subdata float 20 0.22
+ssbo 5 subdata float 24 0.23
+ssbo 5 subdata float 28 0.24
+ssbo 5 subdata float 32 0.31
+ssbo 5 subdata float 36 0.32
+ssbo 5 subdata float 40 0.33
+ssbo 5 subdata float 44 0.34
+ssbo 5 subdata float 48 0.41
+ssbo 5 subdata float 52 0.42
+ssbo 5 subdata float 56 0.43
+ssbo 5 subdata float 60 0.44
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_BUFFER_DATA_SIZE 64
+
+verify program_query GL_ACTIVE_UNIFORMS 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.14 0.24 0.34 0.44