[Piglit] [PATCH 3/5] GLSL 1.40: New tests for rendering using UBO aggregate assignment.

Eric Anholt eric at anholt.net
Thu Jul 26 16:23:46 PDT 2012


---
 .../uniform_buffer/fs-array-copy.shader_test       |   43 ++++++++++++++++++
 .../uniform_buffer/fs-struct-copy.shader_test      |   43 ++++++++++++++++++
 .../uniform_buffer/vs-array-copy.shader_test       |   47 +++++++++++++++++++
 .../uniform_buffer/vs-struct-copy.shader_test      |   48 ++++++++++++++++++++
 4 files changed, 181 insertions(+)
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-array-copy.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/fs-struct-copy.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-array-copy.shader_test
 create mode 100644 tests/spec/glsl-1.40/uniform_buffer/vs-struct-copy.shader_test

diff --git a/tests/spec/glsl-1.40/uniform_buffer/fs-array-copy.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-array-copy.shader_test
new file mode 100644
index 0000000..bf3c972
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-array-copy.shader_test
@@ -0,0 +1,43 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform int i;
+uniform ubo1 {
+	vec4 colors[4];
+};
+
+void main()
+{
+	vec4 temp[4] = colors;
+	temp[0] = vec4(1.0, 0.0, 0.0, 0.0);
+	gl_FragColor = temp[i];
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform int i 1
+uniform vec4 colors[0] 0.0 0.0 0.0 0.0
+uniform vec4 colors[1] 0.0 1.0 0.0 0.0
+uniform vec4 colors[2] 0.0 1.0 1.0 0.0
+uniform vec4 colors[3] 1.0 0.0 1.0 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/fs-struct-copy.shader_test b/tests/spec/glsl-1.40/uniform_buffer/fs-struct-copy.shader_test
new file mode 100644
index 0000000..2ed1d8e
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/fs-struct-copy.shader_test
@@ -0,0 +1,43 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+[fragment shader]
+#version 140
+
+uniform ubo1 {
+	struct S {
+		vec4 a, b, c, d;
+	} colors;
+};
+
+void main()
+{
+	S temp = colors;
+	temp.c = vec4(0.0); /* try, but fail, to prevent copy prop */
+	gl_FragColor = temp.a + temp.b + temp.c + temp.d;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform vec4 colors.a 0.0 0.0 0.0 0.0
+uniform vec4 colors.b 0.0 1.0 0.0 0.0
+uniform vec4 colors.c 1.0 0.0 0.0 0.0
+uniform vec4 colors.d 0.0 0.0 0.0 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-array-copy.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-array-copy.shader_test
new file mode 100644
index 0000000..f7f235d
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-array-copy.shader_test
@@ -0,0 +1,47 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform int i;
+uniform ubo1 {
+	vec4 colors[4];
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+	vec4 temp[4] = colors;
+	temp[0] = vec4(1.0, 0.0, 0.0, 0.0);
+	v = temp[i];
+}
+
+[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 int i 1
+uniform vec4 colors[0] 0.0 0.0 0.0 0.0
+uniform vec4 colors[1] 0.0 1.0 0.0 0.0
+uniform vec4 colors[2] 0.0 1.0 1.0 0.0
+uniform vec4 colors[3] 1.0 0.0 1.0 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-copy.shader_test b/tests/spec/glsl-1.40/uniform_buffer/vs-struct-copy.shader_test
new file mode 100644
index 0000000..8a261ab
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/vs-struct-copy.shader_test
@@ -0,0 +1,48 @@
+[require]
+GLSL >= 1.40
+
+[vertex shader]
+#version 140
+
+uniform ubo1 {
+	struct S {
+		vec4 a, b, c, d;
+	} colors;
+};
+
+in vec4 vertex;
+out vec4 v;
+
+void main()
+{
+	gl_Position = vertex;
+
+	S temp = colors;
+	temp.c = vec4(0.0); /* try, but fail, to prevent copy prop */
+	v = temp.a + temp.b + temp.c + temp.d;
+}
+
+[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 vec4 colors.a 0.0 0.0 0.0 0.0
+uniform vec4 colors.b 0.0 1.0 0.0 0.0
+uniform vec4 colors.c 1.0 0.0 0.0 0.0
+uniform vec4 colors.d 0.0 0.0 0.0 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