[Piglit] [PATCH 13/17] arb_gl_spirv: add some simple ssbo tests
Alejandro PiƱeiro
apinheiro at igalia.com
Sat Sep 15 16:22:51 UTC 2018
Equivalent to the ubo tests added with the commit "arb_gl_spirv: add
some simple ubo tests", but without the linker tests and the
regression-check test.
---
.../execution/ssbo/array-indirect.shader_test | 121 ++++++++++++
.../execution/ssbo/array-inside-ssbo.shader_test | 104 ++++++++++
.../ssbo/array-of-arrays-inside-ssbo.shader_test | 210 +++++++++++++++++++++
.../arb_gl_spirv/execution/ssbo/array.shader_test | 111 +++++++++++
.../arb_gl_spirv/execution/ssbo/simple.shader_test | 97 ++++++++++
.../execution/ssbo/two-ssbo.shader_test | 106 +++++++++++
.../execution/ssbo/two-stages.shader_test | 196 +++++++++++++++++++
7 files changed, 945 insertions(+)
create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/array-indirect.shader_test
create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/array-inside-ssbo.shader_test
create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/array-of-arrays-inside-ssbo.shader_test
create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/array.shader_test
create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/simple.shader_test
create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/two-ssbo.shader_test
create mode 100644 tests/spec/arb_gl_spirv/execution/ssbo/two-stages.shader_test
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/array-indirect.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/array-indirect.shader_test
new file mode 100644
index 000000000..616f1a2ac
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/array-indirect.shader_test
@@ -0,0 +1,121 @@
+# SSBO test using an array of ssbo and indirect(dynamically uniform)
+# indexing. Just uses 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: 24
+; 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 Offset 0
+ 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
+ %ssbo = OpTypeStruct %v4float
+ %uint = OpTypeInt 32 0
+ %uint_3 = OpConstant %uint 3
+%_arr_ssbo_uint_3 = OpTypeArray %ssbo %uint_3
+%_ptr_Uniform__arr_ssbo_uint_3 = OpTypePointer Uniform %_arr_ssbo_uint_3
+ %components = OpVariable %_ptr_Uniform__arr_ssbo_uint_3 Uniform
+ %int = OpTypeInt 32 1
+%_ptr_UniformConstant_int = OpTypePointer UniformConstant %int
+ %u_idx = OpVariable %_ptr_UniformConstant_int UniformConstant
+ %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %19 = OpLoad %int %u_idx
+ %22 = OpAccessChain %_ptr_Uniform_v4float %components %19 %int_0
+ %23 = OpLoad %v4float %22
+ OpStore %outColor %23
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 outColor;
+layout (location = 10) uniform int u_idx;
+
+layout (std430, binding = 5) buffer ssbo
+ {
+ vec4 c1;
+ } components[3];
+
+void main()
+{
+ outColor = components[u_idx].c1;
+}
+
+[test]
+clear color 1.0 0.0 0.0 0.0
+clear
+
+ssbo 5 32 # size, aligned to 16
+#c1
+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 6 32
+#c1
+ssbo 6 subdata float 0 0.21
+ssbo 6 subdata float 4 0.22
+ssbo 6 subdata float 8 0.23
+ssbo 6 subdata float 12 0.24
+
+ssbo 7 32
+#c1
+ssbo 7 subdata float 0 0.31
+ssbo 7 subdata float 4 0.32
+ssbo 7 subdata float 8 0.33
+ssbo 7 subdata float 12 0.34
+
+uniform int 10 0 # location 10, uniform u_idx
+draw rect -1 -1 2 2
+probe all rgba 0.11 0.12 0.13 0.14
+
+uniform int 10 1 # location 10, uniform u_idx
+draw rect -1 -1 2 2
+probe all rgba 0.21 0.22 0.23 0.24
+
+uniform int 10 2 # location 10, uniform u_idx
+draw rect -1 -1 2 2
+probe all rgba 0.31 0.32 0.33 0.34
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo[0] GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo[0] GL_BUFFER_DATA_SIZE 16
+
+block binding 6
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo[1] GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo[1] GL_BUFFER_DATA_SIZE 16
+
+verify program_query GL_ACTIVE_UNIFORMS 1
\ No newline at end of file
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/array-inside-ssbo.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/array-inside-ssbo.shader_test
new file mode 100644
index 000000000..d91471a0d
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/array-inside-ssbo.shader_test
@@ -0,0 +1,104 @@
+# Using a array of arrays inside a ssbo, instead of a aoa of ssbo.
+
+[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: 25
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %color
+ OpExecutionMode %main OriginLowerLeft
+ OpSource GLSL 450
+ OpDecorate %color Location 0
+ OpDecorate %_arr_v4float_uint_4 ArrayStride 16
+ OpMemberDecorate %ssbo 0 Offset 0
+ OpDecorate %ssbo BufferBlock
+ OpDecorate %arr DescriptorSet 0
+ OpDecorate %arr Binding 5
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %color = OpVariable %_ptr_Output_v4float Output
+ %uint = OpTypeInt 32 0
+ %uint_4 = OpConstant %uint 4
+%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4
+ %ssbo = OpTypeStruct %_arr_v4float_uint_4
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %arr = OpVariable %_ptr_Uniform_ssbo Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+ %int_1 = OpConstant %int 1
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %19 = OpAccessChain %_ptr_Uniform_v4float %arr %int_0 %int_0
+ %20 = OpLoad %v4float %19
+ %22 = OpAccessChain %_ptr_Uniform_v4float %arr %int_0 %int_1
+ %23 = OpLoad %v4float %22
+ %24 = OpFAdd %v4float %20 %23
+ OpStore %color %24
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+#version 450
+
+layout (location = 0) out vec4 color;
+
+layout (std430, binding = 5) buffer ssbo {
+ vec4 color[4];
+} arr;
+
+
+
+void main()
+{
+ color = arr.color[0] + arr.color[1];
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+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
+
+draw rect -1 -1 2 2
+probe all rgba 0.32 0.34 0.36 0.38
+
+verify program_query GL_ACTIVE_UNIFORMS 0
\ No newline at end of file
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/array-of-arrays-inside-ssbo.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/array-of-arrays-inside-ssbo.shader_test
new file mode 100644
index 000000000..f0f00edc3
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/array-of-arrays-inside-ssbo.shader_test
@@ -0,0 +1,210 @@
+# Using a array of arrays inside a ssbo, instead of a aoa of ssbo.
+
+[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: 84
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %color
+ OpExecutionMode %main OriginLowerLeft
+ OpSource GLSL 450
+ OpDecorate %color Location 0
+ OpDecorate %_arr_v4float_uint_4 ArrayStride 16
+ OpDecorate %_arr__arr_v4float_uint_4_uint_3 ArrayStride 64
+ OpDecorate %_arr__arr__arr_v4float_uint_4_uint_3_uint_2 ArrayStride 192
+ OpDecorate %_arr_v4float_uint_2 ArrayStride 16
+ OpDecorate %_arr__arr_v4float_uint_2_uint_2 ArrayStride 32
+ OpMemberDecorate %ssbo 0 Offset 0
+ OpMemberDecorate %ssbo 1 Offset 384
+ OpDecorate %ssbo BufferBlock
+ OpDecorate %arr DescriptorSet 0
+ OpDecorate %arr Binding 5
+ %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
+ %uint = OpTypeInt 32 0
+ %uint_4 = OpConstant %uint 4
+%_arr_v4float_uint_4 = OpTypeArray %v4float %uint_4
+ %uint_3 = OpConstant %uint 3
+%_arr__arr_v4float_uint_4_uint_3 = OpTypeArray %_arr_v4float_uint_4 %uint_3
+ %uint_2 = OpConstant %uint 2
+%_arr__arr__arr_v4float_uint_4_uint_3_uint_2 = OpTypeArray %_arr__arr_v4float_uint_4_uint_3 %uint_2
+%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2
+%_arr__arr_v4float_uint_2_uint_2 = OpTypeArray %_arr_v4float_uint_2 %uint_2
+ %ssbo = OpTypeStruct %_arr__arr__arr_v4float_uint_4_uint_3_uint_2 %_arr__arr_v4float_uint_2_uint_2
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %arr = OpVariable %_ptr_Uniform_ssbo Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+%float_0_109999999 = OpConstant %float 0.109999999
+%float_0_119999997 = OpConstant %float 0.119999997
+%float_0_129999995 = OpConstant %float 0.129999995
+%float_0_140000001 = OpConstant %float 0.140000001
+ %37 = OpConstantComposite %v4float %float_0_109999999 %float_0_119999997 %float_0_129999995 %float_0_140000001
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %int_1 = OpConstant %int 1
+%float_0_209999993 = OpConstant %float 0.209999993
+%float_0_219999999 = OpConstant %float 0.219999999
+%float_0_230000004 = OpConstant %float 0.230000004
+%float_0_239999995 = OpConstant %float 0.239999995
+ %52 = OpConstantComposite %v4float %float_0_209999993 %float_0_219999999 %float_0_230000004 %float_0_239999995
+ %int_2 = OpConstant %int 2
+ %int_3 = OpConstant %int 3
+%float_0_310000002 = OpConstant %float 0.310000002
+%float_0_319999993 = OpConstant %float 0.319999993
+%float_0_330000013 = OpConstant %float 0.330000013
+%float_0_340000004 = OpConstant %float 0.340000004
+ %66 = OpConstantComposite %v4float %float_0_310000002 %float_0_319999993 %float_0_330000013 %float_0_340000004
+%float_0_409999996 = OpConstant %float 0.409999996
+%float_0_419999987 = OpConstant %float 0.419999987
+%float_0_430000007 = OpConstant %float 0.430000007
+%float_0_439999998 = OpConstant %float 0.439999998
+ %78 = OpConstantComposite %v4float %float_0_409999996 %float_0_419999987 %float_0_430000007 %float_0_439999998
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %fail_color = OpVariable %_ptr_Function_v4float Function
+ OpStore %fail_color %12
+ OpStore %color %15
+ %31 = OpAccessChain %_ptr_Uniform_v4float %arr %int_0 %int_0 %int_0 %int_0
+ %32 = OpLoad %v4float %31
+ %40 = OpFOrdNotEqual %v4bool %32 %37
+ %41 = OpAny %bool %40
+ OpSelectionMerge %43 None
+ OpBranchConditional %41 %42 %43
+ %42 = OpLabel
+ %44 = OpLoad %v4float %fail_color
+ OpStore %color %44
+ OpBranch %43
+ %43 = OpLabel
+ %46 = OpAccessChain %_ptr_Uniform_v4float %arr %int_0 %int_1 %int_1 %int_1
+ %47 = OpLoad %v4float %46
+ %53 = OpFOrdNotEqual %v4bool %47 %52
+ %54 = OpAny %bool %53
+ OpSelectionMerge %56 None
+ OpBranchConditional %54 %55 %56
+ %55 = OpLabel
+ %57 = OpLoad %v4float %fail_color
+ OpStore %color %57
+ OpBranch %56
+ %56 = OpLabel
+ %60 = OpAccessChain %_ptr_Uniform_v4float %arr %int_0 %int_1 %int_2 %int_3
+ %61 = OpLoad %v4float %60
+ %67 = OpFOrdNotEqual %v4bool %61 %66
+ %68 = OpAny %bool %67
+ OpSelectionMerge %70 None
+ OpBranchConditional %68 %69 %70
+ %69 = OpLabel
+ %71 = OpLoad %v4float %fail_color
+ OpStore %color %71
+ OpBranch %70
+ %70 = OpLabel
+ %72 = OpAccessChain %_ptr_Uniform_v4float %arr %int_1 %int_1 %int_1
+ %73 = OpLoad %v4float %72
+ %79 = OpFOrdNotEqual %v4bool %73 %78
+ %80 = OpAny %bool %79
+ OpSelectionMerge %82 None
+ OpBranchConditional %80 %81 %82
+ %81 = OpLabel
+ %83 = OpLoad %v4float %fail_color
+ OpStore %color %83
+ OpBranch %82
+ %82 = OpLabel
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+#version 450
+
+layout (location = 0) out vec4 color;
+
+layout (std430, binding = 5) buffer ssbo {
+ vec4 color[2][3][4];
+ vec4 position[2][2];
+} arr;
+
+
+
+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 (arr.color[0][0][0] != vec4(0.11, 0.12, 0.13, 0.14))
+ color = fail_color;
+
+ if (arr.color[1][1][1] != vec4(0.21, 0.22, 0.23, 0.24))
+ color = fail_color;
+
+ if (arr.color[1][2][3] != vec4(0.31, 0.32, 0.33, 0.34))
+ color = fail_color;
+
+ if (arr.position[1][1] != vec4(0.41, 0.42, 0.43, 0.44))
+ color = fail_color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+ssbo 5 448
+#arr.color[0][0][0]
+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
+
+#arr.color[1][1][1]
+ssbo 5 subdata float 272 0.21
+ssbo 5 subdata float 276 0.22
+ssbo 5 subdata float 280 0.23
+ssbo 5 subdata float 284 0.24
+
+#arr.color[1][2][3]
+ssbo 5 subdata float 368 0.31
+ssbo 5 subdata float 372 0.32
+ssbo 5 subdata float 376 0.33
+ssbo 5 subdata float 380 0.34
+
+#arr.position[1][1]
+ssbo 5 subdata float 432 0.41
+ssbo 5 subdata float 436 0.42
+ssbo 5 subdata float 440 0.43
+ssbo 5 subdata float 444 0.44
+
+block binding 5
+
+# FIXME: next query is commented out as it is not working
+# properly. ubo and ssbo has different rules for resources (see
+# ARB_program_interface_query issue 7), and that difference it is
+# still not implemented
+
+# verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_NUM_ACTIVE_VARIABLES 4
+
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_BUFFER_DATA_SIZE 448
+verify program_query GL_ACTIVE_UNIFORMS 0
+
+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/ssbo/array.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/array.shader_test
new file mode 100644
index 000000000..19b540d13
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/array.shader_test
@@ -0,0 +1,111 @@
+# SSBO test using an array of ssbo
+
+[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: 29
+; 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 %ComponentsSSBO 0 Offset 0
+ OpDecorate %ComponentsSSBO 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
+%ComponentsSSBO = OpTypeStruct %v4float
+ %uint = OpTypeInt 32 0
+ %uint_3 = OpConstant %uint 3
+%_arr_ComponentsSSBO_uint_3 = OpTypeArray %ComponentsSSBO %uint_3
+%_ptr_Uniform__arr_ComponentsSSBO_uint_3 = OpTypePointer Uniform %_arr_ComponentsSSBO_uint_3
+ %components = OpVariable %_ptr_Uniform__arr_ComponentsSSBO_uint_3 Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+ %int_1 = OpConstant %int 1
+ %int_2 = OpConstant %int 2
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %19 = OpAccessChain %_ptr_Uniform_v4float %components %int_0 %int_0
+ %20 = OpLoad %v4float %19
+ %22 = OpAccessChain %_ptr_Uniform_v4float %components %int_1 %int_0
+ %23 = OpLoad %v4float %22
+ %24 = OpFAdd %v4float %20 %23
+ %26 = OpAccessChain %_ptr_Uniform_v4float %components %int_2 %int_0
+ %27 = OpLoad %v4float %26
+ %28 = OpFAdd %v4float %24 %27
+ OpStore %outColor %28
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 outColor;
+layout (std430, binding = 5) buffer ComponentsSSBO
+ {
+ vec4 c1;
+ } components[3];
+
+void main()
+{
+ outColor = components[0].c1 + components[1].c1 + components[2].c1;
+}
+
+[test]
+clear color 1.0 0.0 0.0 0.0
+clear
+
+ssbo 5 32 # size, aligned to 16
+#c1
+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 6 32
+#c1
+ssbo 6 subdata float 0 0.21
+ssbo 6 subdata float 4 0.22
+ssbo 6 subdata float 8 0.23
+ssbo 6 subdata float 12 0.24
+
+ssbo 7 32
+#c1
+ssbo 7 subdata float 0 0.31
+ssbo 7 subdata float 4 0.32
+ssbo 7 subdata float 8 0.33
+ssbo 7 subdata float 12 0.34
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ComponentsSSBO[0] GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ComponentsSSBO[0] GL_BUFFER_DATA_SIZE 16
+
+block binding 6
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ComponentsSSBO[1] GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ComponentsSSBO[1] GL_BUFFER_DATA_SIZE 16
+
+verify program_query GL_ACTIVE_UNIFORMS 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.63 0.66 0.69 0.72
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/simple.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/simple.shader_test
new file mode 100644
index 000000000..2a9797ce3
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/simple.shader_test
@@ -0,0 +1,97 @@
+# Simple SSBO test: just one stage. No arrays.
+
+[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: 28
+; 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 Offset 0
+ OpMemberDecorate %ssbo 1 Offset 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
+ %v2float = OpTypeVector %float 2
+ %ssbo = OpTypeStruct %v4float %v2float
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %components = OpVariable %_ptr_Uniform_ssbo Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+ %int_1 = OpConstant %int 1
+%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
+ %float_0 = OpConstant %float 0
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %17 = OpAccessChain %_ptr_Uniform_v4float %components %int_0
+ %18 = OpLoad %v4float %17
+ %21 = OpAccessChain %_ptr_Uniform_v2float %components %int_1
+ %22 = OpLoad %v2float %21
+ %24 = OpCompositeExtract %float %22 0
+ %25 = OpCompositeExtract %float %22 1
+ %26 = OpCompositeConstruct %v4float %24 %25 %float_0 %float_0
+ %27 = OpFAdd %v4float %18 %26
+ OpStore %outColor %27
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 outColor;
+layout (std430, binding = 5) buffer ssbo
+ {
+ vec4 c1;
+ vec2 c2;
+ } components;
+
+void main()
+{
+ outColor = components.c1 + vec4(components.c2, 0.0, 0.0);
+}
+
+[test]
+ssbo 5 32 # size, aligned to 16
+#c1
+ssbo 5 subdata float 0 0.1
+ssbo 5 subdata float 4 0.2
+ssbo 5 subdata float 8 0.3
+ssbo 5 subdata float 12 0.4
+#c2
+ssbo 5 subdata float 16 0.1
+ssbo 5 subdata float 20 0.2
+
+clear color 1.0 0.0 0.0 0.0
+clear
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_NUM_ACTIVE_VARIABLES 2
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_BUFFER_DATA_SIZE 32
+
+verify program_query GL_ACTIVE_UNIFORMS 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.2 0.4 0.3 0.4
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/two-ssbo.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/two-ssbo.shader_test
new file mode 100644
index 000000000..0fb280b15
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/two-ssbo.shader_test
@@ -0,0 +1,106 @@
+# SSBO test with two ssbos. Just 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: 24
+; 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 %ssbo1 0 Offset 0
+ OpDecorate %ssbo1 BufferBlock
+ OpDecorate %components DescriptorSet 0
+ OpDecorate %components Binding 5
+ OpMemberDecorate %ssbo2 0 Offset 0
+ OpDecorate %ssbo2 BufferBlock
+ OpDecorate %components2 DescriptorSet 0
+ OpDecorate %components2 Binding 8
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+ %ssbo1 = OpTypeStruct %v4float
+%_ptr_Uniform_ssbo1 = OpTypePointer Uniform %ssbo1
+ %components = OpVariable %_ptr_Uniform_ssbo1 Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+ %ssbo2 = OpTypeStruct %v4float
+%_ptr_Uniform_ssbo2 = OpTypePointer Uniform %ssbo2
+%components2 = OpVariable %_ptr_Uniform_ssbo2 Uniform
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %16 = OpAccessChain %_ptr_Uniform_v4float %components %int_0
+ %17 = OpLoad %v4float %16
+ %21 = OpAccessChain %_ptr_Uniform_v4float %components2 %int_0
+ %22 = OpLoad %v4float %21
+ %23 = OpFAdd %v4float %17 %22
+ OpStore %outColor %23
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 outColor;
+layout (std430, binding = 5) buffer ssbo1
+ {
+ vec4 c1;
+ } components;
+
+layout (std430, binding = 8) buffer ssbo2
+ {
+ vec4 c2;
+ } components2;
+
+void main()
+{
+ outColor = components.c1 + components2.c2;
+}
+
+[test]
+clear color 1.0 0.0 0.0 0.0
+clear
+
+ssbo 5 32
+ssbo 5 subdata float 0 0.1
+ssbo 5 subdata float 4 0.2
+ssbo 5 subdata float 8 0.3
+ssbo 5 subdata float 12 0.4
+
+ssbo 8 32
+ssbo 8 subdata float 0 0.2
+ssbo 8 subdata float 4 0.3
+ssbo 8 subdata float 8 0.4
+ssbo 8 subdata float 12 0.5
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo1 GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo1 GL_BUFFER_DATA_SIZE 16
+
+block binding 8
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo2 GL_NUM_ACTIVE_VARIABLES 1
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo2 GL_BUFFER_DATA_SIZE 16
+
+verify program_query GL_ACTIVE_UNIFORMS 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.3 0.5 0.7 0.9
diff --git a/tests/spec/arb_gl_spirv/execution/ssbo/two-stages.shader_test b/tests/spec/arb_gl_spirv/execution/ssbo/two-stages.shader_test
new file mode 100644
index 000000000..a1c8852f5
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/ssbo/two-stages.shader_test
@@ -0,0 +1,196 @@
+# Simple SSBO test with two stages using the same ssbo
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_gl_spirv
+
+[vertex 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: 41
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %main "main" %vertexColor %_ %piglit_vertex %gl_VertexID %gl_InstanceID
+ OpSource GLSL 450
+ OpName %_ ""
+ OpDecorate %vertexColor Location 1
+ OpMemberDecorate %ssbo 0 Offset 0
+ OpMemberDecorate %ssbo 1 Offset 16
+ OpDecorate %ssbo BufferBlock
+ OpDecorate %components DescriptorSet 0
+ OpDecorate %components Binding 5
+ OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
+ OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
+ OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
+ OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
+ OpDecorate %gl_PerVertex Block
+ OpDecorate %piglit_vertex Location 0
+ OpDecorate %gl_VertexID BuiltIn VertexId
+ OpDecorate %gl_InstanceID BuiltIn InstanceId
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+%vertexColor = OpVariable %_ptr_Output_v4float Output
+ %v2float = OpTypeVector %float 2
+ %ssbo = OpTypeStruct %v4float %v2float
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %components = OpVariable %_ptr_Uniform_ssbo Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+ %int_1 = OpConstant %int 1
+%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
+ %float_0 = OpConstant %float 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_arr_float_uint_1 = OpTypeArray %float %uint_1
+%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
+%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
+ %_ = OpVariable %_ptr_Output_gl_PerVertex Output
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%piglit_vertex = OpVariable %_ptr_Input_v4float Input
+%_ptr_Input_int = OpTypePointer Input %int
+%gl_VertexID = OpVariable %_ptr_Input_int Input
+%gl_InstanceID = OpVariable %_ptr_Input_int Input
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %17 = OpAccessChain %_ptr_Uniform_v4float %components %int_0
+ %18 = OpLoad %v4float %17
+ %21 = OpAccessChain %_ptr_Uniform_v2float %components %int_1
+ %22 = OpLoad %v2float %21
+ %24 = OpCompositeExtract %float %22 0
+ %25 = OpCompositeExtract %float %22 1
+ %26 = OpCompositeConstruct %v4float %24 %25 %float_0 %float_0
+ %27 = OpFAdd %v4float %18 %26
+ OpStore %vertexColor %27
+ %36 = OpLoad %v4float %piglit_vertex
+ %37 = OpAccessChain %_ptr_Output_v4float %_ %int_0
+ OpStore %37 %36
+ OpReturn
+ OpFunctionEnd
+
+[vertex shader]
+
+#version 450
+
+layout (location = 0) in vec4 piglit_vertex;
+layout (location = 1) out vec4 vertexColor;
+layout (std430, binding = 5) buffer ssbo
+ {
+ vec4 c1;
+ vec2 c2;
+ } components;
+
+void main()
+{
+ vertexColor = components.c1 + vec4(components.c2, 0.0, 0.0);
+ gl_Position = piglit_vertex;
+}
+
+
+[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: 35
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %outColor %vertexColor
+ OpExecutionMode %main OriginLowerLeft
+ OpSource GLSL 450
+ OpMemberDecorate %ssbo 0 Offset 0
+ OpMemberDecorate %ssbo 1 Offset 16
+ OpDecorate %ssbo BufferBlock
+ OpDecorate %components DescriptorSet 0
+ OpDecorate %components Binding 5
+ OpDecorate %outColor Location 0
+ OpDecorate %vertexColor Location 1
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v2float = OpTypeVector %float 2
+ %ssbo = OpTypeStruct %v4float %v2float
+%_ptr_Uniform_ssbo = OpTypePointer Uniform %ssbo
+ %components = OpVariable %_ptr_Uniform_ssbo Uniform
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
+ %int_1 = OpConstant %int 1
+%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
+ %float_0 = OpConstant %float 0
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %outColor = OpVariable %_ptr_Output_v4float Output
+%_ptr_Input_v4float = OpTypePointer Input %v4float
+%vertexColor = OpVariable %_ptr_Input_v4float Input
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %color = OpVariable %_ptr_Function_v4float Function
+ %17 = OpAccessChain %_ptr_Uniform_v4float %components %int_0
+ %18 = OpLoad %v4float %17
+ %21 = OpAccessChain %_ptr_Uniform_v2float %components %int_1
+ %22 = OpLoad %v2float %21
+ %24 = OpCompositeExtract %float %22 0
+ %25 = OpCompositeExtract %float %22 1
+ %26 = OpCompositeConstruct %v4float %24 %25 %float_0 %float_0
+ %27 = OpFAdd %v4float %18 %26
+ OpStore %color %27
+ %30 = OpLoad %v4float %color
+ %33 = OpLoad %v4float %vertexColor
+ %34 = OpFAdd %v4float %30 %33
+ OpStore %outColor %34
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 outColor;
+layout (location = 1) in vec4 vertexColor;
+layout (std430, binding = 5) buffer ssbo
+ {
+ vec4 c1;
+ vec2 c2;
+ } components;
+
+void main()
+{
+ vec4 color = components.c1 + vec4(components.c2, 0.0, 0.0);
+ outColor = color + vertexColor;
+}
+
+[test]
+clear color 1.0 0.0 0.0 0.0
+clear
+
+ssbo 5 32 # size, aligned to 16
+#c1
+ssbo 5 subdata float 0 0.0
+ssbo 5 subdata float 4 0.0
+ssbo 5 subdata float 8 0.3
+ssbo 5 subdata float 12 0.4
+#c2
+ssbo 5 subdata float 16 0.1
+ssbo 5 subdata float 20 0.2
+
+block binding 5
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_NUM_ACTIVE_VARIABLES 2
+verify program_interface_query GL_SHADER_STORAGE_BLOCK ssbo GL_BUFFER_DATA_SIZE 32
+
+verify program_query GL_ACTIVE_UNIFORMS 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.2 0.4 0.6 0.8
--
2.14.1
More information about the Piglit
mailing list