[Piglit] [PATCH] arb_arrays_of_arrays: test struct member offset calculation

Timothy Arceri tarceri at itsqueeze.com
Tue Aug 1 05:43:13 UTC 2017


Simple test to make sure we calculate struct member offsets
correctly when the array contains an opaque member that maybe
not have any backing storage.

This triggers a recent regression in radeonsi.
---
 ...-struct-nonconst-non-opaque-members.shader_test | 68 ++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test

diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test
new file mode 100644
index 000000000..19538026e
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test
@@ -0,0 +1,68 @@
+# This test verifies that dynamically uniform indexing of sampler arrays
+# in the vertex shader behaves correctly, and the offests for the
+# non-opaque members are calculated correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_gpu_shader5
+
+[vertex shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+#extension GL_ARB_gpu_shader5: require
+
+struct S {
+   float a;
+   sampler2D tex;
+   float b;
+   float c;
+};
+
+uniform S s[2][2];
+
+uniform int n;
+uniform int m;
+
+in vec4 piglit_vertex;
+out vec4 color;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+	vec4 texcolor = texture(s[n][m].tex, vec2(0.75, 0.25));
+    color = vec4(s[n][m].a, s[n][m].b, s[n][m].c, texcolor.x);
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec4 color;
+out vec4 out_color;
+
+void main()
+{
+	out_color = color;
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[1][0].tex 3
+uniform float s[1][0].a 0.25
+uniform float s[1][0].b 0.5
+uniform float s[1][0].c 0.75
+
+
+texture checkerboard 3 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (1.0, 0.0, 0.0, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+uniform int n 1
+uniform int m 0
+draw rect -1 -1 1 1
+
+relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (0.25, 0.5, 0.75, 1.0)
+
-- 
2.13.3



More information about the Piglit mailing list