[Piglit] [PATCH] glsl-1.30: add a new test for signed division by powers of two

Rhys Perry pendingchaos02 at gmail.com
Sat Jun 9 16:00:01 UTC 2018


Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
---
 .../execution/fs-po2-division-int.shader_test      | 74 ++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 tests/spec/glsl-1.30/execution/fs-po2-division-int.shader_test

diff --git a/tests/spec/glsl-1.30/execution/fs-po2-division-int.shader_test b/tests/spec/glsl-1.30/execution/fs-po2-division-int.shader_test
new file mode 100644
index 000000000..44075f74c
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-po2-division-int.shader_test
@@ -0,0 +1,74 @@
+# Test signed division by constant powers of two
+
+[require]
+GLSL >= 1.30
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 130
+uniform int one;
+uniform int neg1;
+uniform int fifteen;
+uniform int negfifteen;
+uniform int intmax;
+uniform int intmin;
+
+void main()
+{
+	gl_FragColor = vec4(1.0);
+
+	if (one / 2 != 0)
+		gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0);
+
+	if (one / -2 != 0)
+		gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
+
+	if (neg1 / 2 != 0)
+		gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0);
+
+	if (neg1 / -2 != 0)
+		gl_FragColor = vec4(1.0, 1.0, 0.0, 0.0);
+
+	if (fifteen / 8 != 1)
+		gl_FragColor = vec4(0.0, 1.0, 1.0, 0.0);
+
+	if (fifteen / -8 != -1)
+		gl_FragColor = vec4(1.0, 0.0, 1.0, 0.0);
+
+	if (negfifteen / 8 != -1)
+		gl_FragColor = vec4(0.25, 0.0, 0.0, 0.0);
+
+	if (negfifteen / -8 != 1)
+		gl_FragColor = vec4(0.0, 0.25, 0.0, 0.0);
+
+	/* really high numbers from here on */
+
+	if (intmin / 8 != -268435456)
+		gl_FragColor = vec4(0.5, 0.0, 0.0, 0.0);
+
+	if (intmax / 8 != 268435455)
+		gl_FragColor = vec4(0.0, 0.5, 0.0, 0.0);
+
+	if (intmin / -2147483648 != 1)
+		gl_FragColor = vec4(0.0, 0.0, 0.5, 0.0);
+
+	if (intmax / 2147483647 != 1)
+		gl_FragColor = vec4(0.5, 0.5, 0.0, 0.0);
+
+	if (intmin / 2147483647 != -1)
+		gl_FragColor = vec4(0.0, 0.5, 0.5, 0.0);
+
+	if (intmax / -2147483648 != 0)
+		gl_FragColor = vec4(0.5, 0.0, 0.5, 0.0);
+}
+
+[test]
+uniform int one 1
+uniform int neg1 -1
+uniform int fifteen 15
+uniform int negfifteen -15
+uniform int intmax 2147483647
+uniform int intmin -2147483648
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0
-- 
2.14.4



More information about the Piglit mailing list