[Piglit] [PATCH 4/4] glsl-1.30: Add some specific tests for mix(, genbtype) with inf/nan.
Eric Anholt
eric at anholt.net
Thu Mar 15 14:07:55 PDT 2012
---
.../execution/fs-mix-bvec4-infnan.shader_test | 45 +++++++++++++++++
.../execution/vs-mix-bvec4-infnan.shader_test | 52 ++++++++++++++++++++
2 files changed, 97 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/glsl-1.30/execution/fs-mix-bvec4-infnan.shader_test
create mode 100644 tests/spec/glsl-1.30/execution/vs-mix-bvec4-infnan.shader_test
diff --git a/tests/spec/glsl-1.30/execution/fs-mix-bvec4-infnan.shader_test b/tests/spec/glsl-1.30/execution/fs-mix-bvec4-infnan.shader_test
new file mode 100644
index 0000000..58512a4
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-mix-bvec4-infnan.shader_test
@@ -0,0 +1,45 @@
+# From the GLSL 1.30 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. Components of x and y that
+# are not selected are allowed to be invalid floating point
+# values and will have no effect on the results.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main()
+{
+ gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 130
+uniform float a, b, zero, one;
+uniform bvec4 selector;
+
+void main()
+{
+ float inf = one / zero;
+ float nan = zero / zero;
+
+ vec4 arg0 = vec4(a, b, inf, nan);
+ vec4 arg1 = vec4(inf, nan, a, b);
+
+ gl_FragColor = mix(arg0, arg1, selector);
+}
+
+[test]
+uniform float a 0.25
+uniform float b 0.75;
+uniform float zero 0.0
+uniform float one 1.0
+uniform ivec4 selector 0 0 1 1
+
+draw rect -1 -1 2 2
+probe all rgba 0.25 0.75 0.25 0.75
diff --git a/tests/spec/glsl-1.30/execution/vs-mix-bvec4-infnan.shader_test b/tests/spec/glsl-1.30/execution/vs-mix-bvec4-infnan.shader_test
new file mode 100644
index 0000000..d4ad62a
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-mix-bvec4-infnan.shader_test
@@ -0,0 +1,52 @@
+# From the GLSL 1.30 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. Components of x and y that
+# are not selected are allowed to be invalid floating point
+# values and will have no effect on the results.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+
+out vec4 color;
+uniform float a, b, zero, one;
+uniform bvec4 selector;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+
+ float inf = one / zero;
+ float nan = zero / zero;
+
+ vec4 arg0 = vec4(a, b, inf, nan);
+ vec4 arg1 = vec4(inf, nan, a, b);
+
+ color = mix(arg0, arg1, selector);
+}
+
+[fragment shader]
+#version 130
+
+in vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+uniform float a 0.25
+uniform float b 0.75;
+uniform float zero 0.0
+uniform float one 1.0
+uniform ivec4 selector 0 0 1 1
+
+draw rect -1 -1 2 2
+probe all rgba 0.25 0.75 0.25 0.75
--
1.7.9.1
More information about the Piglit
mailing list