Changes in v2:
- Specify the values for the uniforms in the shader source
- Rename to "fs-signed-div-by-imm" because I ended up adding
  non-power-of-two tests

Signed-off-by: Rhys Perry <pendingchao...@gmail.com>
---
 .../execution/fs-signed-div-by-imm.shader_test     | 68 ++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 
tests/spec/glsl-1.30/execution/fs-signed-div-by-imm.shader_test

diff --git a/tests/spec/glsl-1.30/execution/fs-signed-div-by-imm.shader_test 
b/tests/spec/glsl-1.30/execution/fs-signed-div-by-imm.shader_test
new file mode 100644
index 000000000..f73ae7d10
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-signed-div-by-imm.shader_test
@@ -0,0 +1,68 @@
+# Test signed division by constant powers of two
+
+[require]
+GLSL >= 1.30
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 130
+uniform int one = 1;
+uniform int neg1 = -1;
+uniform int fifteen = 15;
+uniform int negfifteen = -15;
+uniform int intmax = 2147483647;
+uniform int intmin = -2147483648;
+
+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]
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0
-- 
2.14.4

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to