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

Matt Turner mattst88 at gmail.com
Mon Sep 9 15:58:44 PDT 2013


Reviewed-by: Paul Berry <stereotype441 at gmail.com>
---
Is there a way to have these tests run under Desktop GL and ES
without duplicating the whole test except for the [require]?

 tests/all.tests                                    |  6 +++
 .../execution/fs-mix-bvec4.shader_test             | 33 +++++++++++++++++
 .../execution/fs-mix-ivec4.shader_test             | 33 +++++++++++++++++
 .../execution/fs-mix-uvec4.shader_test             | 33 +++++++++++++++++
 .../execution/vs-mix-bvec4.shader_test             | 43 ++++++++++++++++++++++
 .../execution/vs-mix-ivec4.shader_test             | 43 ++++++++++++++++++++++
 .../execution/vs-mix-uvec4.shader_test             | 43 ++++++++++++++++++++++
 7 files changed, 234 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..7767476
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-bvec4.shader_test
@@ -0,0 +1,33 @@
+# 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 passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+out vec4 frag_color;
+uniform bvec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	frag_color = 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..aa7859c
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-ivec4.shader_test
@@ -0,0 +1,33 @@
+# 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 passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+out vec4 frag_color;
+uniform ivec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	frag_color = 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..9337a3e
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/fs-mix-uvec4.shader_test
@@ -0,0 +1,33 @@
+# 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 passthrough]
+
+[fragment shader]
+#extension GL_MESA_shader_integer_mix: enable
+
+out vec4 frag_color;
+uniform uvec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	frag_color = 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..215b70a
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-bvec4.shader_test
@@ -0,0 +1,43 @@
+# 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
+
+in vec4 piglit_vertex;
+out vec4 color;
+uniform bvec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+
+	color = vec4(mix(a, b, selector));
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+	frag_color = 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..6fbfbc6
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-ivec4.shader_test
@@ -0,0 +1,43 @@
+# 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
+
+in vec4 piglit_vertex;
+out vec4 color;
+uniform ivec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+
+	color = vec4(mix(a, b, selector) / 4.0f);
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+	frag_color = 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..a1e2e5d
--- /dev/null
+++ b/tests/spec/mesa_shader_integer_mix/execution/vs-mix-uvec4.shader_test
@@ -0,0 +1,43 @@
+# 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
+
+in vec4 piglit_vertex;
+out vec4 color;
+uniform uvec4 a, b;
+uniform bvec4 selector;
+
+void main()
+{
+	gl_Position = piglit_vertex;
+
+	color = vec4(mix(a, b, selector) / 4.0f);
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 frag_color;
+
+void main()
+{
+	frag_color = 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