[Piglit] [PATCH 5/5] GLSL 1.40: Add tests for UBO structure padding bug in link_uniforms.cpp.
Eric Anholt
eric at anholt.net
Thu Jul 26 16:23:48 PDT 2012
---
.../uniform_buffer/fs-struct-pad.shader_test | 49 ++++++++++++++++++
.../uniform_buffer/vs-struct-pad.shader_test | 53 ++++++++++++++++++++
2 files changed, 102 insertions(+)
create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-struct-pad.shader_test
create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-struct-pad.shader_test
diff --git a/tests/spec/glsl-1.40/uniform_buffer/fs-struct-pad.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-struct-pad.shader_test
new file mode 100644
index 0000000..a2202ff
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-struct-pad.shader_test
@@ -0,0 +1,49 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+ gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+ struct S {
+ struct S1 {
+ float r;
+ } s1;
+
+ struct S2 {
+ float g;
+ float b;
+ float a;
+ } s2;
+ } s;
+};
+
+void main()
+{
+ gl_FragColor = vec4(s.s1.r, s.s2.g, s.s2.b, s.s2.a);
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0 1.0
+-1.0 1.0
+
+[test]
+uniform float s.s1.r 0.0
+uniform float s.s2.g 1.0
+uniform float s.s2.b 0.0
+uniform float s.s2.a 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.40/uniform_buffer/vs-struct-pad.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-struct-pad.shader_test
new file mode 100644
index 0000000..7390ea8
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-struct-pad.shader_test
@@ -0,0 +1,53 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+ struct S {
+ struct S1 {
+ float r;
+ } s1;
+
+ struct S2 {
+ float g;
+ float b;
+ float a;
+ } s2;
+ } s;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+ gl_Position = vertex;
+ v = vec4(s.s1.r, s.s2.g, s.s2.b, s.s2.a);
+}
+
+[fragment shader]
+#version 140
+
+in vec4 v;
+
+void main()
+{
+ gl_FragColor = v;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0 1.0
+-1.0 1.0
+
+[test]
+uniform float s.s1.r 0.0
+uniform float s.s2.g 1.0
+uniform float s.s2.b 0.0
+uniform float s.s2.a 0.0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 0.0
--
1.7.10.4
More information about the Piglit
mailing list