[Piglit] [PATCH] arb_gpu_shader_fp64: add glsl algebraic tests

Tapani Pälli tapani.palli at intel.com
Fri Feb 13 04:32:40 PST 2015


add tests for add, csel, div, mul, neg operations

v2: correct alpha values (Chris Forbes),
    + changes to use distance and tolerance in the tests and
    making sure that all calculation and comparison happens in doubles

All tests pass on Nvidia GeForce 660 (binary driver version 331.38)

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
 .../glsl-algebraic-add-double.shader_test          | 29 ++++++++++++++++++++++
 .../glsl-algebraic-csel-double.shader_test         | 20 +++++++++++++++
 .../glsl-algebraic-div-double.shader_test          | 29 ++++++++++++++++++++++
 .../glsl-algebraic-mul-double.shader_test          | 29 ++++++++++++++++++++++
 .../glsl-algebraic-neg-double.shader_test          | 20 +++++++++++++++
 .../glsl-algebraic-sub-double.shader_test          | 29 ++++++++++++++++++++++
 6 files changed, 156 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-add-double.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-csel-double.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-div-double.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-mul-double.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-neg-double.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-sub-double.shader_test

diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-add-double.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-add-double.shader_test
new file mode 100644
index 0000000..19d3af4
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-add-double.shader_test
@@ -0,0 +1,29 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+uniform dvec4 a;
+uniform dvec4 b;
+uniform dvec4 expected;
+const double tolerance = 1.0000000000000002e-05;
+void main()
+{
+	dvec4 result = dvec4(a + b);
+
+	if (distance(expected, result) < tolerance)
+		gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 a 0.2 0.8 0.1 0.0
+uniform dvec4 b 0.3 0.2 0.7 1.0
+uniform dvec4 expected 0.5 1.0 0.8 1.0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-csel-double.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-csel-double.shader_test
new file mode 100644
index 0000000..e8bf9f8
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-csel-double.shader_test
@@ -0,0 +1,20 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+void main()
+{
+	const double small = 1.0lf;
+	const double big = 2.0lf;
+	double val = (big > small) ? 1.0lf : 0.0lf;
+	gl_FragColor = vec4(val, 0.0, val, 1.0);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgb 1.0 0 1.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-div-double.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-div-double.shader_test
new file mode 100644
index 0000000..df27a8c
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-div-double.shader_test
@@ -0,0 +1,29 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+uniform dvec4 a;
+uniform dvec4 b;
+uniform dvec4 expected;
+const double tolerance = 1.0000000000000002e-05;
+void main()
+{
+	dvec4 result = dvec4(a / b);
+
+	if (distance(expected, result) < tolerance)
+		gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 a 1.0 0.6 1.0 1.0
+uniform dvec4 b 2.0 3.0 4.0 1.0
+uniform dvec4 expected 0.5 0.2 0.25 1.0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-mul-double.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-mul-double.shader_test
new file mode 100644
index 0000000..d425670
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-mul-double.shader_test
@@ -0,0 +1,29 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+uniform dvec4 a;
+uniform dvec4 b;
+uniform dvec4 expected;
+const double tolerance = 1.0000000000000002e-05;
+void main()
+{
+	dvec4 result = dvec4(a * b);
+
+	if (distance(expected, result) < tolerance)
+		gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 a 2.0 1.0 1.0 1.0
+uniform dvec4 b 0.5 0.2 0.7 1.0
+uniform dvec4 expected 1.0 0.2 0.7 1.0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-neg-double.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-neg-double.shader_test
new file mode 100644
index 0000000..3dc6c13
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-neg-double.shader_test
@@ -0,0 +1,20 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+uniform vec4 color;
+void main()
+{
+	dvec4 dcolor = color;
+	gl_FragColor = vec4(-dcolor);
+}
+
+[test]
+uniform vec4 color 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/glsl-algebraic-sub-double.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-sub-double.shader_test
new file mode 100644
index 0000000..e9c5ffb
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/glsl-algebraic-sub-double.shader_test
@@ -0,0 +1,29 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : enable
+uniform dvec4 a;
+uniform dvec4 b;
+uniform dvec4 expected;
+const double tolerance = 1.0000000000000002e-05;
+void main()
+{
+	dvec4 result = dvec4(a - b);
+
+	if (distance(expected, result) < tolerance)
+		gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+uniform dvec4 a 0.3 0.8 0.9 1.0
+uniform dvec4 b 0.2 0.2 0.1 0.0
+uniform dvec4 expected 0.1 0.6 0.8 1.0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.1.0



More information about the Piglit mailing list