[Piglit] [PATCH] mesa_shader_integer_mix: Add tests for mix on integers and bools.

Matt Turner mattst88 at gmail.com
Mon Sep 9 11:42:24 PDT 2013


Reviewed-by: Paul Berry <stereotype441 at gmail.com>
---
 tests/all.tests                                    |  6 ++++
 .../execution/fs-mix-bvec4.shader_test             | 36 +++++++++++++++++++
 .../execution/fs-mix-ivec4.shader_test             | 36 +++++++++++++++++++
 .../execution/fs-mix-uvec4.shader_test             | 36 +++++++++++++++++++
 .../execution/vs-mix-bvec4.shader_test             | 41 ++++++++++++++++++++++
 .../execution/vs-mix-ivec4.shader_test             | 41 ++++++++++++++++++++++
 .../execution/vs-mix-uvec4.shader_test             | 41 ++++++++++++++++++++++
 7 files changed, 237 insertions(+)
 create mode 100644 tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test
 create mode 100644 tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test
 create mode 100644 tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test
 create mode 100644 tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test
 create mode 100644 tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test
 create mode 100644 tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test

diff --git a/tests/all.tests b/tests/all.tests
index 22c009c..d5b457b 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2344,6 +2344,12 @@ ext_fog_coord = Group()
 spec['EXT_fog_coord'] = ext_fog_coord
 add_plain_test(ext_fog_coord, 'ext_fog_coord-modes')
 
+mesa_shader_integer_mix = Group()
+spec['MESA_shader_integer_mix'] = mesa_shader_integer_mix
+add_shader_test_dir(spec['MESA_shader_integer_mix'],
+	            os.path.join(testsDir, 'spec', 'mesa_shader_integer_mix'),
+		    recursive=True)
+
 nv_texture_barrier = Group()
 spec['NV_texture_barrier'] = nv_texture_barrier
 add_plain_test(nv_texture_barrier, 'blending-in-shader')
diff --git a/tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test
new file mode 100644
index 0000000..febe0ad
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test
@@ -0,0 +1,36 @@
+# From the MESA_shader_integer_mix spec:
+#
+#     Selects which vector each returned component comes
+#     from. For a component of a that is false, the
+#     corresponding component of x is returned. For a
+#     component of a that is true, the corresponding
+#     component of y is returned.
+
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_mix
+
+[vertex shader]
+void main()
+{
+	gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+uniform bvec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_FragColor = vec4(mix(a, b, selector));
+}
+
+[test]
+uniform ivec4 a 1 1 0 1
+uniform ivec4 b 0 1 1 0
+uniform ivec4 selector 1 1 0 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test
new file mode 100644
index 0000000..7d7d553
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test
@@ -0,0 +1,36 @@
+# From the MESA_shader_integer_mix spec:
+#
+#     Selects which vector each returned component comes
+#     from. For a component of a that is false, the
+#     corresponding component of x is returned. For a
+#     component of a that is true, the corresponding
+#     component of y is returned.
+
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_mix
+
+[vertex shader]
+void main()
+{
+	gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+uniform ivec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_FragColor = vec4(mix(a, b, selector) / 4.0f);
+}
+
+[test]
+uniform ivec4 a 1 2 0 4
+uniform ivec4 b 0 3 1 0
+uniform ivec4 selector 1 1 0 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test
new file mode 100644
index 0000000..3063627
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test
@@ -0,0 +1,36 @@
+# From the MESA_shader_integer_mix spec:
+#
+#     Selects which vector each returned component comes
+#     from. For a component of a that is false, the
+#     corresponding component of x is returned. For a
+#     component of a that is true, the corresponding
+#     component of y is returned.
+
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_mix
+
+[vertex shader]
+void main()
+{
+	gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+uniform uvec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_FragColor = vec4(mix(a, b, selector) / 4.0f);
+}
+
+[test]
+uniform uvec4 a 1 2 0 4
+uniform uvec4 b 0 3 1 0
+uniform ivec4 selector 1 1 0 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test
new file mode 100644
index 0000000..fa3de5d
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test
@@ -0,0 +1,41 @@
+# From the MESA_shader_integer_mix spec:
+#
+#     Selects which vector each returned component comes
+#     from. For a component of a that is false, the
+#     corresponding component of x is returned. For a
+#     component of a that is true, the corresponding
+#     component of y is returned.
+
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_mix
+
+[vertex shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+out vec4 color;
+uniform bvec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+
+	color = vec4(mix(a, b, selector));
+}
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+	gl_FragColor = color;
+}
+
+[test]
+uniform ivec4 a 1 1 0 1
+uniform ivec4 b 0 1 1 0
+uniform ivec4 selector 1 1 0 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test
new file mode 100644
index 0000000..6100388
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test
@@ -0,0 +1,41 @@
+# From the MESA_shader_integer_mix spec:
+#
+#     Selects which vector each returned component comes
+#     from. For a component of a that is false, the
+#     corresponding component of x is returned. For a
+#     component of a that is true, the corresponding
+#     component of y is returned.
+
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_mix
+
+[vertex shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+out vec4 color;
+uniform ivec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+
+	color = vec4(mix(a, b, selector) / 4.0f);
+}
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+	gl_FragColor = color;
+}
+
+[test]
+uniform ivec4 a 1 2 0 4
+uniform ivec4 b 0 3 1 0
+uniform ivec4 selector 1 1 0 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test
new file mode 100644
index 0000000..bcd17ed
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test
@@ -0,0 +1,41 @@
+# From the MESA_shader_integer_mix spec:
+#
+#     Selects which vector each returned component comes
+#     from. For a component of a that is false, the
+#     corresponding component of x is returned. For a
+#     component of a that is true, the corresponding
+#     component of y is returned.
+
+[require]
+GLSL >= 1.30
+GL_MESA_shader_integer_mix
+
+[vertex shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+out vec4 color;
+uniform uvec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_Position = gl_Vertex;
+
+	color = vec4(mix(a, b, selector) / 4.0f);
+}
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+	gl_FragColor = color;
+}
+
+[test]
+uniform uvec4 a 1 2 0 4
+uniform uvec4 b 0 3 1 0
+uniform ivec4 selector 1 1 0 0
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 0.75 0.0 1.0
-- 
1.8.3.2



More information about the Piglit mailing list