[Piglit] [PATCH 18/25] arb_gl_spirv: add two linking tests for uniform multisample images

Alejandro Piñeiro apinheiro at igalia.com
Tue Apr 17 14:37:24 UTC 2018


Use a uniform image2DMS and image2DMSArray. The latter related with
SpvCapabilityImageMSArray.

Note that those are linking tests, because although the specific
extensions are supported, in the practice multisampling is not allowed
as GL_MAX_IMAGE_SAMPLES is zero for most mesa drivers.

Signed-off-by: Alejandro Piñeiro <apinheiro at igalia.com>
Signed-off-by: Antia Puentes <apuentes at igalia.com>
---
 .../linker/uniform/multisampler-array.shader_test  | 68 ++++++++++++++++++++++
 .../linker/uniform/multisampler.shader_test        | 67 +++++++++++++++++++++
 2 files changed, 135 insertions(+)
 create mode 100644 tests/spec/arb_gl_spirv/linker/uniform/multisampler-array.shader_test
 create mode 100644 tests/spec/arb_gl_spirv/linker/uniform/multisampler.shader_test

diff --git a/tests/spec/arb_gl_spirv/linker/uniform/multisampler-array.shader_test b/tests/spec/arb_gl_spirv/linker/uniform/multisampler-array.shader_test
new file mode 100644
index 000000000..8d79aca43
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/linker/uniform/multisampler-array.shader_test
@@ -0,0 +1,68 @@
+# Test for SpvCapabilityImageMSArray
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 4.50
+
+[compute shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 4
+; Bound: 23
+; Schema: 0
+               OpCapability Shader
+               OpCapability StorageImageMultisample
+               OpCapability ImageMSArray
+               OpCapability ImageQuery
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %main "main"
+               OpExecutionMode %main LocalSize 1 1 1
+               OpSource GLSL 450
+               OpName %main "main"
+               OpName %samp "samp"
+               OpName %rimg2DMSArray "rimg2DMSArray"
+               OpDecorate %rimg2DMSArray Location 2
+               OpDecorate %rimg2DMSArray DescriptorSet 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+%_ptr_Function_int = OpTypePointer Function %int
+       %uint = OpTypeInt 32 0
+         %10 = OpTypeImage %uint 2D 0 1 1 2 Rgba8ui
+%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10
+%rimg2DMSArray = OpVariable %_ptr_UniformConstant_10 UniformConstant
+      %v3int = OpTypeVector %int 3
+      %int_0 = OpConstant %int 0
+         %18 = OpConstantComposite %v3int %int_0 %int_0 %int_0
+      %int_2 = OpConstant %int 2
+     %v4uint = OpTypeVector %uint 4
+   %uint_255 = OpConstant %uint 255
+         %22 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+       %samp = OpVariable %_ptr_Function_int Function
+         %13 = OpLoad %10 %rimg2DMSArray
+         %14 = OpImageQuerySamples %int %13
+               OpStore %samp %14
+         %15 = OpLoad %10 %rimg2DMSArray
+               OpImageWrite %15 %18 %22 Sample %int_2
+               OpReturn
+               OpFunctionEnd
+
+[compute shader]
+#version 450
+
+layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+
+layout (location = 2, rgba8ui) uniform uimage2DMSArray rimg2DMSArray;
+
+void main()
+{
+    int samp = imageSamples(rimg2DMSArray);
+    imageStore(rimg2DMSArray, ivec3(0), 2, uvec4(255));
+}
+
+[test]
+link success
diff --git a/tests/spec/arb_gl_spirv/linker/uniform/multisampler.shader_test b/tests/spec/arb_gl_spirv/linker/uniform/multisampler.shader_test
new file mode 100644
index 000000000..5cf00192f
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/linker/uniform/multisampler.shader_test
@@ -0,0 +1,67 @@
+#Test using an uniform of type uimage2DMS
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 4.50
+
+[compute shader spirv]
+; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 4
+; Bound: 23
+; Schema: 0
+               OpCapability Shader
+               OpCapability StorageImageMultisample
+               OpCapability ImageQuery
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %main "main"
+               OpExecutionMode %main LocalSize 1 1 1
+               OpSource GLSL 450
+               OpName %main "main"
+               OpName %samp "samp"
+               OpName %rimg2DMS "rimg2DMS"
+               OpDecorate %rimg2DMS Location 2
+               OpDecorate %rimg2DMS DescriptorSet 0
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+        %int = OpTypeInt 32 1
+%_ptr_Function_int = OpTypePointer Function %int
+       %uint = OpTypeInt 32 0
+         %10 = OpTypeImage %uint 2D 0 0 1 2 Rgba8ui
+%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10
+   %rimg2DMS = OpVariable %_ptr_UniformConstant_10 UniformConstant
+      %v2int = OpTypeVector %int 2
+      %int_0 = OpConstant %int 0
+         %18 = OpConstantComposite %v2int %int_0 %int_0
+      %int_2 = OpConstant %int 2
+     %v4uint = OpTypeVector %uint 4
+   %uint_255 = OpConstant %uint 255
+         %22 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255
+       %main = OpFunction %void None %3
+          %5 = OpLabel
+       %samp = OpVariable %_ptr_Function_int Function
+         %13 = OpLoad %10 %rimg2DMS
+         %14 = OpImageQuerySamples %int %13
+               OpStore %samp %14
+         %15 = OpLoad %10 %rimg2DMS
+               OpImageWrite %15 %18 %22 Sample %int_2
+               OpReturn
+               OpFunctionEnd
+
+[compute shader]
+#version 450
+
+layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+
+layout (location = 2, rgba8ui) uniform uimage2DMS rimg2DMS;
+
+void main()
+{
+    int samp = imageSamples(rimg2DMS);
+    imageStore(rimg2DMS, ivec2(0), 2, uvec4(255));
+}
+
+[test]
+link success
-- 
2.14.1



More information about the Piglit mailing list