[Piglit] [PATCH 16/35] arb_gl_spirv: Add a test for a sampler within a struct
Alejandro PiƱeiro
apinheiro at igalia.com
Thu Aug 9 11:35:55 UTC 2018
From: Neil Roberts <nroberts at igalia.com>
---
.../execution/uniform/sampler2d-struct.shader_test | 98 ++++++++++++++++++++++
1 file changed, 98 insertions(+)
create mode 100644 tests/spec/arb_gl_spirv/execution/uniform/sampler2d-struct.shader_test
diff --git a/tests/spec/arb_gl_spirv/execution/uniform/sampler2d-struct.shader_test b/tests/spec/arb_gl_spirv/execution/uniform/sampler2d-struct.shader_test
new file mode 100644
index 000000000..8e440543e
--- /dev/null
+++ b/tests/spec/arb_gl_spirv/execution/uniform/sampler2d-struct.shader_test
@@ -0,0 +1,98 @@
+# Test a texture sampler array within a struct. This is not allowed by
+# Vulkan so it needs special handling for GL_ARB_gl_spirv.
+
+[require]
+SPIRV YES
+GL >= 3.3
+GLSL >= 4.50
+
+[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; 4
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %1 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %main "main" %color
+ OpExecutionMode %main OriginLowerLeft
+ OpSource GLSL 450
+ OpName %main "main"
+ OpName %color "color"
+ OpName %Samp "Samp"
+ OpMemberName %Samp 0 "tex"
+ OpMemberName %Samp 1 "green_offset"
+ OpName %s "s"
+ OpDecorate %color Location 0
+ OpDecorate %s Location 0
+ %void = OpTypeVoid
+ %3 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %color = OpVariable %_ptr_Output_v4float Output
+ %10 = OpTypeImage %float 2D 0 0 0 1 Unknown
+ %11 = OpTypeSampledImage %10
+ %Samp = OpTypeStruct %11 %float
+%_ptr_UniformConstant_Samp = OpTypePointer UniformConstant %Samp
+ %s = OpVariable %_ptr_UniformConstant_Samp UniformConstant
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %v2float = OpTypeVector %float 2
+ %float_0_25 = OpConstant %float 0.25
+ %22 = OpConstantComposite %v2float %float_0_25 %float_0_25
+ %int_1 = OpConstant %int 1
+%_ptr_UniformConstant_float = OpTypePointer UniformConstant %float
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Output_float = OpTypePointer Output %float
+ %main = OpFunction %void None %3
+ %5 = OpLabel
+ %18 = OpAccessChain %_ptr_UniformConstant_11 %s %int_0
+ %19 = OpLoad %11 %18
+ %23 = OpImageSampleImplicitLod %v4float %19 %22
+ OpStore %color %23
+ %26 = OpAccessChain %_ptr_UniformConstant_float %s %int_1
+ %27 = OpLoad %float %26
+ %31 = OpAccessChain %_ptr_Output_float %color %uint_1
+ %32 = OpLoad %float %31
+ %33 = OpFAdd %float %32 %27
+ %34 = OpAccessChain %_ptr_Output_float %color %uint_1
+ OpStore %34 %33
+ OpReturn
+ OpFunctionEnd
+
+[fragment shader]
+#version 450
+
+layout (location = 0) out vec4 color;
+
+struct Samp {
+ sampler2D tex;
+ float green_offset;
+};
+
+layout (location = 0) uniform Samp s;
+
+void main()
+{
+ color = texture(s.tex, vec2(0.25));
+ color.g += s.green_offset;
+}
+
+[test]
+clear color 1.0 0.0 0.0 1.0
+clear
+
+uniform int 0 3
+uniform float 1 0.45
+
+texture checkerboard 3 0 (32, 32) (0.0, 0.5, 0.0, 0.0) (0.8, 0.0, 0.0, 1.0)
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.95 0.0 0.0
--
2.14.1
More information about the Piglit
mailing list