--- .../execution/ubo/matrix/column-major.shader_test | 96 +++++++++++ .../execution/ubo/matrix/column-vs-row.shader_test | 176 +++++++++++++++++++++ .../ubo/matrix/indirect-column-major.shader_test | 119 ++++++++++++++ .../ubo/matrix/indirect-row-major.shader_test | 119 ++++++++++++++ .../execution/ubo/matrix/row-major.shader_test | 96 +++++++++++ 5 files changed, 606 insertions(+) create mode 100644 tests/spec/arb_gl_spirv/execution/ubo/matrix/column-major.shader_test create mode 100644 tests/spec/arb_gl_spirv/execution/ubo/matrix/column-vs-row.shader_test create mode 100644 tests/spec/arb_gl_spirv/execution/ubo/matrix/indirect-column-major.shader_test create mode 100644 tests/spec/arb_gl_spirv/execution/ubo/matrix/indirect-row-major.shader_test create mode 100644 tests/spec/arb_gl_spirv/execution/ubo/matrix/row-major.shader_test
diff --git a/tests/spec/arb_gl_spirv/execution/ubo/matrix/column-major.shader_test b/tests/spec/arb_gl_spirv/execution/ubo/matrix/column-major.shader_test new file mode 100644 index 000000000..5928bd2ec --- /dev/null +++ b/tests/spec/arb_gl_spirv/execution/ubo/matrix/column-major.shader_test @@ -0,0 +1,96 @@ +# 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 %ComponentsBlock 0 ColMajor + OpMemberDecorate %ComponentsBlock 0 Offset 0 + OpMemberDecorate %ComponentsBlock 0 MatrixStride 16 + OpDecorate %ComponentsBlock Block + 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 +%ComponentsBlock = OpTypeStruct %mat4v4float +%_ptr_Uniform_ComponentsBlock = OpTypePointer Uniform %ComponentsBlock + %components = OpVariable %_ptr_Uniform_ComponentsBlock 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 (std140, binding = 5, column_major) uniform ComponentsBlock + { + 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 + +block binding 5 +block offset 0 +block matrix stride 16 +block row major 0 +uniform mat4 ComponentsBlock.matrix 0.11 0.12 0.13 0.14 0.21 0.22 0.23 0.24 0.31 0.32 0.33 0.34 0.41 0.42 0.43 0.44 + +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 64 + +verify program_query GL_ACTIVE_UNIFORMS 1 + +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/ubo/matrix/column-vs-row.shader_test b/tests/spec/arb_gl_spirv/execution/ubo/matrix/column-vs-row.shader_test new file mode 100644 index 000000000..338221b48 --- /dev/null +++ b/tests/spec/arb_gl_spirv/execution/ubo/matrix/column-vs-row.shader_test @@ -0,0 +1,176 @@ +# UBO 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 %ColumnBlock 0 ColMajor + OpMemberDecorate %ColumnBlock 0 Offset 0 + OpMemberDecorate %ColumnBlock 0 MatrixStride 16 + OpDecorate %ColumnBlock Block + OpDecorate %my_column_major DescriptorSet 0 + OpDecorate %my_column_major Binding 5 + OpMemberDecorate %RowBlock 0 RowMajor + OpMemberDecorate %RowBlock 0 Offset 0 + OpMemberDecorate %RowBlock 0 MatrixStride 16 + OpDecorate %RowBlock Block + 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 +%ColumnBlock = OpTypeStruct %mat4v4float +%_ptr_Uniform_ColumnBlock = OpTypePointer Uniform %ColumnBlock +%my_column_major = OpVariable %_ptr_Uniform_ColumnBlock Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float + %RowBlock = OpTypeStruct %mat4v4float +%_ptr_Uniform_RowBlock = OpTypePointer Uniform %RowBlock +%my_row_major = OpVariable %_ptr_Uniform_RowBlock 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 %column + %47 = OpLoad %int %row + %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 (std140, binding = 5, column_major) uniform ColumnBlock + { + mat4 matrix; + } my_column_major; + +layout (std140, binding = 7, row_major) uniform RowBlock + { + 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++) { + + //Note that here we compare exactly the same position because + // shader_runner already re-layout the data below if the matrix is in + // row_major layout + if (my_column_major.matrix[column][row] != my_row_major.matrix[column][row]) + outColor = vec4(1.0, 0.0, 0.0, 0.0); + } +} + +[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 mat4 ColumnBlock.matrix 0.11 0.12 0.13 0.14 0.21 0.22 0.23 0.24 0.31 0.32 0.33 0.34 0.41 0.42 0.43 0.44 + +block binding 7 +block offset 0 +block matrix stride 16 +block row major 1 +uniform mat4 RowBlock.matrix 0.11 0.12 0.13 0.14 0.21 0.22 0.23 0.24 0.31 0.32 0.33 0.34 0.41 0.42 0.43 0.44 + +block binding 5 +verify program_interface_query GL_UNIFORM_BLOCK ColumnBlock GL_NUM_ACTIVE_VARIABLES 1 +verify program_interface_query GL_UNIFORM_BLOCK ColumnBlock GL_BUFFER_DATA_SIZE 64 + +block binding 7 +verify program_interface_query GL_UNIFORM_BLOCK RowBlock GL_NUM_ACTIVE_VARIABLES 1 +verify program_interface_query GL_UNIFORM_BLOCK RowBlock GL_BUFFER_DATA_SIZE 64 + +verify program_query GL_ACTIVE_UNIFORMS 2 + +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/ubo/matrix/indirect-column-major.shader_test b/tests/spec/arb_gl_spirv/execution/ubo/matrix/indirect-column-major.shader_test new file mode 100644 index 000000000..f0fff29c0 --- /dev/null +++ b/tests/spec/arb_gl_spirv/execution/ubo/matrix/indirect-column-major.shader_test @@ -0,0 +1,119 @@ +# UBO test using a matrix. One stage. Using indirect indexing. + +[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 %ComponentsBlock 0 ColMajor + OpMemberDecorate %ComponentsBlock 0 Offset 0 + OpMemberDecorate %ComponentsBlock 0 MatrixStride 16 + OpDecorate %ComponentsBlock Block + 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 +%ComponentsBlock = OpTypeStruct %mat4v4float +%_ptr_Uniform_ComponentsBlock = OpTypePointer Uniform %ComponentsBlock + %components = OpVariable %_ptr_Uniform_ComponentsBlock 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 = 0) out vec4 outColor; +layout (location = 10) uniform int u_idx; +layout (std140, binding = 5, column_major) uniform ComponentsBlock + { + 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 + +block binding 5 +block offset 0 +block matrix stride 16 +block row major 0 +uniform mat4 ComponentsBlock.matrix 0.11 0.12 0.13 0.14 0.21 0.22 0.23 0.24 0.31 0.32 0.33 0.34 0.41 0.42 0.43 0.44 + +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 64 + +verify program_query GL_ACTIVE_UNIFORMS 2 + +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/ubo/matrix/indirect-row-major.shader_test b/tests/spec/arb_gl_spirv/execution/ubo/matrix/indirect-row-major.shader_test new file mode 100644 index 000000000..650419ef0 --- /dev/null +++ b/tests/spec/arb_gl_spirv/execution/ubo/matrix/indirect-row-major.shader_test @@ -0,0 +1,119 @@ +# UBO test using a matrix. One stage. Using indirect indexing. + +[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 %ComponentsBlock 0 RowMajor + OpMemberDecorate %ComponentsBlock 0 Offset 0 + OpMemberDecorate %ComponentsBlock 0 MatrixStride 16 + OpDecorate %ComponentsBlock Block + 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 +%ComponentsBlock = OpTypeStruct %mat4v4float +%_ptr_Uniform_ComponentsBlock = OpTypePointer Uniform %ComponentsBlock + %components = OpVariable %_ptr_Uniform_ComponentsBlock 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 = 0) out vec4 outColor; +layout (location = 10) uniform int u_idx; +layout (std140, binding = 5, row_major) uniform ComponentsBlock + { + 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 + +block binding 5 +block offset 0 +block matrix stride 16 +block row major 1 +uniform mat4 ComponentsBlock.matrix 0.11 0.12 0.13 0.14 0.21 0.22 0.23 0.24 0.31 0.32 0.33 0.34 0.41 0.42 0.43 0.44 + +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 64 + +verify program_query GL_ACTIVE_UNIFORMS 2 + +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/ubo/matrix/row-major.shader_test b/tests/spec/arb_gl_spirv/execution/ubo/matrix/row-major.shader_test new file mode 100644 index 000000000..7ba9e61e1 --- /dev/null +++ b/tests/spec/arb_gl_spirv/execution/ubo/matrix/row-major.shader_test @@ -0,0 +1,96 @@ +# 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 %ComponentsBlock 0 RowMajor + OpMemberDecorate %ComponentsBlock 0 Offset 0 + OpMemberDecorate %ComponentsBlock 0 MatrixStride 16 + OpDecorate %ComponentsBlock Block + 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 +%ComponentsBlock = OpTypeStruct %mat4v4float +%_ptr_Uniform_ComponentsBlock = OpTypePointer Uniform %ComponentsBlock + %components = OpVariable %_ptr_Uniform_ComponentsBlock 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 (std140, binding = 5, row_major) uniform ComponentsBlock + { + 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 + +block binding 5 +block offset 0 +block matrix stride 16 +block row major 1 +uniform mat4 ComponentsBlock.matrix 0.11 0.12 0.13 0.14 0.21 0.22 0.23 0.24 0.31 0.32 0.33 0.34 0.41 0.42 0.43 0.44 + +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 64 + +verify program_query GL_ACTIVE_UNIFORMS 1 + +draw rect -1 -1 2 2 +probe all rgba 0.41 0.42 0.43 0.44 -- 2.14.1 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit