[Piglit] [PATCH] arb_gpu_shader_fp64: add packDouble2x32 and unpackDouble2x32 tests for vertex shader

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Dec 13 08:50:18 UTC 2016


Simple tests to make sure the packing is correct, along with constant
tests.

They are based on 04d7b02a.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
 .../vs-const-packDouble2x32.shader_test            | 45 +++++++++++++++++
 .../vs-const-unpackDouble2x32.shader_test          | 45 +++++++++++++++++
 .../vs-packDouble2x32.shader_test                  | 59 ++++++++++++++++++++++
 .../vs-unpackDouble2x32-2.shader_test              | 57 +++++++++++++++++++++
 .../vs-unpackDouble2x32.shader_test                | 54 ++++++++++++++++++++
 5 files changed, 260 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-const-packDouble2x32.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-const-unpackDouble2x32.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-packDouble2x32.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-unpackDouble2x32-2.shader_test
 create mode 100644 tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-unpackDouble2x32.shader_test

diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-const-packDouble2x32.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-const-packDouble2x32.shader_test
new file mode 100644
index 0000000..9198cc9
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-const-packDouble2x32.shader_test
@@ -0,0 +1,45 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+in vec4 vertex;
+out vec4 color;
+
+void main()
+{
+	gl_Position = vertex;
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	/* Compare the results after going through unpackDouble2x32() allows us
+	 * to distinguish -0.0f from 0.0f.
+	 */
+	STATIC_ASSERT((packDouble2x32(uvec2(0, 0)) != 0.0lf));
+	STATIC_ASSERT((packDouble2x32(uvec2(0, 1073217536)) != 1.5lf));
+	STATIC_ASSERT((packDouble2x32(uvec2(1, 1000)) != 2.1219957909657664e-311lf));
+}
+
+[fragment shader]
+
+in vec4 color;
+out vec4 fs_color;
+
+void main()
+{
+	fs_color = color;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-const-unpackDouble2x32.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-const-unpackDouble2x32.shader_test
new file mode 100644
index 0000000..67221be
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-const-unpackDouble2x32.shader_test
@@ -0,0 +1,45 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+#define STATIC_ASSERT(cond) { float array[(cond) ? -1 : 1]; }
+
+in vec4 vertex;
+out vec4 color;
+
+void main()
+{
+	gl_Position = vertex;
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	/* Compare the results after going through unpackDouble2x32() allows us
+	 * to distinguish -0.0f from 0.0f.
+	 */
+	STATIC_ASSERT((unpackDouble2x32(0.0lf) != uvec2(0, 0)));
+	STATIC_ASSERT((unpackDouble2x32(1.5lf) != uvec2(0, 1073217536)));
+	STATIC_ASSERT((unpackDouble2x32(2.1219957909657664e-311lf) != uvec2(1, 1000)));
+}
+
+[fragment shader]
+
+in vec4 color;
+out vec4 fs_color;
+
+void main()
+{
+	fs_color = color;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+draw arrays GL_TRIANGLE_FAN 0 4
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-packDouble2x32.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-packDouble2x32.shader_test
new file mode 100644
index 0000000..c888773
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-packDouble2x32.shader_test
@@ -0,0 +1,59 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+in vec4 vertex;
+out vec4 color;
+
+uniform double expected_doub;
+uniform uvec2 given_uval;
+
+void main() {
+	gl_Position = vertex;
+	/* Green if both pass. */
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	double packval;
+
+	packval = packDouble2x32(given_uval);
+
+	if (packval != expected_doub) {
+		color.r = 1.0;
+	}
+}
+
+[fragment shader]
+
+in vec4 color;
+out vec4 fs_color;
+
+void main()
+{
+	fs_color = color;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform double expected_doub 0.0
+uniform uvec2 given_uval 0 0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 0 0 0.0 1.0 0.0 1.0
+
+uniform double expected_doub 1.5
+uniform uvec2 given_uval 0 1073217536
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 1 0 0.0 1.0 0.0 1.0
+
+uniform double expected_doub 2.122e-311
+uniform uvec2 given_uval 8519181 1000
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 2 0 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-unpackDouble2x32-2.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-unpackDouble2x32-2.shader_test
new file mode 100644
index 0000000..aa2a565
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-unpackDouble2x32-2.shader_test
@@ -0,0 +1,57 @@
+# test unpack with a single channel specified
+# to demonstrate a bug in glsl->tgsi dead-code elimination
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#extension GL_ARB_gpu_shader_fp64 : enable
+
+in vec4 vertex;
+out vec4 color;
+
+uniform double given_doub;
+uniform uint expected_uval;
+
+void main()
+{
+	gl_Position = vertex;
+	/* Green if both pass. */
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	uint packval;
+
+	packval = unpackDouble2x32(abs(given_doub)).y;
+
+	if (packval != expected_uval) {
+		color.r = 1.0;
+	}
+}
+
+[fragment shader]
+
+in vec4 color;
+out vec4 fs_color;
+
+void main()
+{
+	fs_color = color;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform double given_doub 0.0
+uniform uint expected_uval 0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 0 0 0.0 1.0 0.0 1.0
+
+uniform double given_doub 1.5
+uniform uint expected_uval 1073217536
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 1 0 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-unpackDouble2x32.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-unpackDouble2x32.shader_test
new file mode 100644
index 0000000..f6156cf
--- /dev/null
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/vs-unpackDouble2x32.shader_test
@@ -0,0 +1,54 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+
+[vertex shader]
+#extension GL_ARB_gpu_shader_fp64 : enable
+in vec4 vertex;
+
+uniform double given_doub;
+uniform uvec2 expected_uval;
+
+out vec4 color;
+
+void main() {
+	gl_Position = vertex;
+	/* Green if both pass. */
+	color = vec4(0.0, 1.0, 0.0, 1.0);
+
+	uvec2 packval;
+
+	packval = unpackDouble2x32(given_doub);
+
+	if (packval != expected_uval) {
+		color.r = 1.0;
+	}
+}
+
+[fragment shader]
+
+in vec4 color;
+out vec4 fs_color;
+
+void main()
+{
+   fs_color = color;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+ 1.0  1.0
+-1.0  1.0
+
+[test]
+uniform double given_doub 0.0
+uniform uvec2 expected_uval 0 0
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 0 0 0.0 1.0 0.0 1.0
+
+uniform double given_doub 1.5
+uniform uvec2 expected_uval 0 1073217536
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 1 0 0.0 1.0 0.0 1.0
-- 
2.7.4



More information about the Piglit mailing list