[Piglit] [PATCH] arb_gl_spirv: add test for uniform blocks with the same structure

Józef Kucia joseph.kucia at gmail.com
Wed Nov 21 15:23:29 UTC 2018


This test reproduces a bug in Nvidia drivers:

error: binding mismatch between shaders for UBO (named __defaultname)
error: struct type mismatch between shaders for uniform (named __defaultname)
error: binding mismatch between shaders for UBO (named __defaultname)
error: struct type mismatch between shaders for uniform (named __defaultname)
error: binding mismatch between shaders for UBO (named __defaultname)
error: struct type mismatch between shaders for uniform (named __defaultname)
error: binding mismatch between shaders for UBO (named __defaultname)
error: struct type mismatch between shaders for uniform (named __defaultname)

The same issue is also present when SPIR-V debug names for uniform
blocks are the same.
---
 .../unnamed-uniform-blocks.shader_test        | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test

diff --git a/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test
new file mode 100644
index 000000000000..9dba7d44c37d
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test
@@ -0,0 +1,67 @@
+# Test unnamed uniform blocks with the same structure
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 4.50
+
+[compute shader spirv]
+; SPIR-V
+; Version: 1.0
+; Generator: Khronos Glslang Reference Front End; 7
+; Bound: 33
+; Schema: 0
+               OpCapability Shader
+          %1 = OpExtInstImport "GLSL.std.450"
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %4 "main"
+               OpExecutionMode %4 LocalSize 1 1 1
+               OpDecorate %9 Location 2
+               OpDecorate %9 DescriptorSet 0
+               OpDecorate %_arr_v4uint_uint_4 ArrayStride 16
+               OpMemberDecorate %_struct_18 0 Offset 0
+               OpDecorate %_struct_18 Block
+               OpDecorate %20 DescriptorSet 0
+               OpDecorate %20 Binding 0
+               OpDecorate %_arr_v4uint_uint_4_0 ArrayStride 16
+               OpMemberDecorate %_struct_26 0 Offset 0
+               OpDecorate %_struct_26 Block
+               OpDecorate %28 DescriptorSet 0
+               OpDecorate %28 Binding 1
+       %void = OpTypeVoid
+          %3 = OpTypeFunction %void
+       %uint = OpTypeInt 32 0
+          %7 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+          %9 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+        %int = OpTypeInt 32 1
+      %v2int = OpTypeVector %int 2
+      %int_0 = OpConstant %int 0
+         %14 = OpConstantComposite %v2int %int_0 %int_0
+     %v4uint = OpTypeVector %uint 4
+     %uint_4 = OpConstant %uint 4
+%_arr_v4uint_uint_4 = OpTypeArray %v4uint %uint_4
+ %_struct_18 = OpTypeStruct %_arr_v4uint_uint_4
+%_ptr_Uniform__struct_18 = OpTypePointer Uniform %_struct_18
+         %20 = OpVariable %_ptr_Uniform__struct_18 Uniform
+     %uint_0 = OpConstant %uint 0
+%_ptr_Uniform_uint = OpTypePointer Uniform %uint
+%_arr_v4uint_uint_4_0 = OpTypeArray %v4uint %uint_4
+ %_struct_26 = OpTypeStruct %_arr_v4uint_uint_4_0
+%_ptr_Uniform__struct_26 = OpTypePointer Uniform %_struct_26
+         %28 = OpVariable %_ptr_Uniform__struct_26 Uniform
+          %4 = OpFunction %void None %3
+          %5 = OpLabel
+         %10 = OpLoad %7 %9
+         %23 = OpAccessChain %_ptr_Uniform_uint %20 %int_0 %int_0 %uint_0
+         %24 = OpLoad %uint %23
+         %29 = OpAccessChain %_ptr_Uniform_uint %28 %int_0 %int_0 %uint_0
+         %30 = OpLoad %uint %29
+         %31 = OpIAdd %uint %24 %30
+         %32 = OpCompositeConstruct %v4uint %31 %31 %31 %31
+               OpImageWrite %10 %14 %32
+               OpReturn
+               OpFunctionEnd
+
+[test]
+link success
-- 
2.18.1



More information about the Piglit mailing list