[Piglit] [PATCH] arb_gpu_shader_fp64: Test the sign() function with abs() and negation of its argument
Ian Romanick
idr at freedesktop.org
Wed Jun 27 07:28:40 UTC 2018
From: Ian Romanick <ian.d.romanick at intel.com>
The saturate version hits an assertion failure in the Mesa i965 driver:
src/intel/compiler/brw_fs.cpp:2377: bool fs_visitor::opt_algebraic(): Assertion `!"unimplemented: saturate mixed types"' failed.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
.../built-in-functions/fs-sign-neg-abs.shader_test | 33 +++++++++++++++++
.../built-in-functions/fs-sign-neg.shader_test | 31 ++++++++++++++++
.../fs-sign-sat-neg-abs.shader_test | 27 ++++++++++++++
.../built-in-functions/vs-sign-neg-abs.shader_test | 43 ++++++++++++++++++++++
.../built-in-functions/vs-sign-neg.shader_test | 41 +++++++++++++++++++++
.../vs-sign-sat-neg-abs.shader_test | 37 +++++++++++++++++++
6 files changed, 212 insertions(+)
create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg-abs.shader_test
create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg.shader_test
create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-sat-neg-abs.shader_test
create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg-abs.shader_test
create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg.shader_test
create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-sat-neg-abs.shader_test
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg-abs.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg-abs.shader_test
new file mode 100644
index 000000000..642bf3d78
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg-abs.shader_test
@@ -0,0 +1,33 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 arg1;
+uniform dvec4 expect;
+
+out vec4 piglit_fragcolor;
+
+void main()
+{
+ if (sign(-abs(arg0)) != -sign(abs(arg1)))
+ piglit_fragcolor = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (sign(-abs(arg0)) != -abs(sign(arg1)))
+ piglit_fragcolor = vec4(0.5, 0.0, 0.5, 1.0);
+ else if (sign(-abs(arg0)) != expect)
+ piglit_fragcolor = vec4(0.0, 0.0, 1.0, 1.0);
+ else
+ piglit_fragcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 arg1 -2.0 2.0 0.0 0.0
+uniform dvec4 expect -1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg.shader_test
new file mode 100644
index 000000000..a8f49874e
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-neg.shader_test
@@ -0,0 +1,31 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 arg1;
+uniform dvec4 expect;
+
+out vec4 piglit_fragcolor;
+
+void main()
+{
+ if (sign(-arg0) != -sign(arg1))
+ piglit_fragcolor = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (sign(-arg0) != expect)
+ piglit_fragcolor = vec4(0.0, 0.0, 1.0, 1.0);
+ else
+ piglit_fragcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 arg1 -2.0 2.0 0.0 0.0
+uniform dvec4 expect 1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-sat-neg-abs.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-sat-neg-abs.shader_test
new file mode 100644
index 000000000..81ae2d441
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-sign-sat-neg-abs.shader_test
@@ -0,0 +1,27 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 expect;
+
+out vec4 piglit_fragcolor;
+
+void main()
+{
+ if (clamp(sign(-abs(arg0)), 0.0, 1.0) != expect)
+ piglit_fragcolor = vec4(1.0, 0.0, 0.0, 1.0);
+ else
+ piglit_fragcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 expect 0.0 0.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg-abs.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg-abs.shader_test
new file mode 100644
index 000000000..a292f2621
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg-abs.shader_test
@@ -0,0 +1,43 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 arg1;
+uniform dvec4 expect;
+
+out vec4 color;
+in vec4 piglit_vertex;
+
+void main()
+{
+ if (sign(-abs(arg0)) != -sign(abs(arg1)))
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (sign(-abs(arg0)) != -abs(sign(arg1)))
+ color = vec4(0.5, 0.0, 0.5, 1.0);
+ else if (sign(-abs(arg0)) != expect)
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+ else
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 piglit_fragcolor;
+
+void main()
+{
+ piglit_fragcolor = color;
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 arg1 -2.0 2.0 0.0 0.0
+uniform dvec4 expect -1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg.shader_test
new file mode 100644
index 000000000..fdf87ea1a
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-neg.shader_test
@@ -0,0 +1,41 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 arg1;
+uniform dvec4 expect;
+
+out vec4 color;
+in vec4 piglit_vertex;
+
+void main()
+{
+ if (sign(-arg0) != -sign(arg1))
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else if (sign(-arg0) != expect)
+ color = vec4(0.0, 0.0, 1.0, 1.0);
+ else
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 piglit_fragcolor;
+
+void main()
+{
+ piglit_fragcolor = color;
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 arg1 -2.0 2.0 0.0 0.0
+uniform dvec4 expect 1.0 -1.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-sat-neg-abs.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-sat-neg-abs.shader_test
new file mode 100644
index 000000000..b70afdd94
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-sign-sat-neg-abs.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#extension GL_ARB_gpu_shader_fp64: require
+
+uniform dvec4 arg0;
+uniform dvec4 expect;
+
+out vec4 color;
+in vec4 piglit_vertex;
+
+void main()
+{
+
+ if (clamp(sign(-abs(arg0)), 0.0, 1.0) != expect)
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ else
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+in vec4 color;
+out vec4 piglit_fragcolor;
+
+void main()
+{
+ piglit_fragcolor = color;
+}
+
+[test]
+uniform dvec4 arg0 -5.0 5.0 0.0 0.0
+uniform dvec4 expect 0.0 0.0 0.0 0.0
+draw rect -1 -1 2 2
+probe rgb 1 1 0.0 1.0 0.0
--
2.14.4
More information about the Piglit
mailing list