[Piglit] [PATCH 13/19] arb_gpu_shader5: Add a constant eval bitCount execution test.
Matt Turner
mattst88 at gmail.com
Sun Apr 28 15:37:26 PDT 2013
v2: Call nonexistent bad_constant_folding() function if test fails.
---
.../built-in-functions/const-bitCount.shader_test | 59 ++++++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 tests/spec/arb_gpu_shader5/execution/built-in-functions/const-bitCount.shader_test
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-bitCount.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-bitCount.shader_test
new file mode 100644
index 0000000..7ba0c91
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-bitCount.shader_test
@@ -0,0 +1,59 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+in vec4 vertex;
+
+void main() {
+ gl_Position = vertex;
+}
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+void bad_constant_folding();
+
+out vec4 color;
+
+void main()
+{
+ /* Green if both pass. */
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (ivec4(0) != bitCount(ivec4(0)))
+ bad_constant_folding();
+ else if (ivec4(0) != bitCount(uvec4(0u)))
+ bad_constant_folding();
+
+ if (ivec4(1) != bitCount(ivec4(1, 2, 4, 8)))
+ bad_constant_folding();
+ else if (ivec4(1) != bitCount(uvec4(1u, 2u, 4u, 8u)))
+ bad_constant_folding();
+
+ if (ivec4(1, 2, 3, 4) != bitCount(ivec4(1, 3, 7, 15)))
+ bad_constant_folding();
+ else if (ivec4(1, 2, 3, 4) != bitCount(uvec4(1u, 3u, 7u, 15u)))
+ bad_constant_folding();
+
+ if (ivec4(6, 6, 3, 5) != bitCount(ivec4(783, 111, 385, 484)))
+ bad_constant_folding();
+ else if (ivec4(6, 6, 3, 5) != bitCount(uvec4(783u, 111u, 385u, 484u)))
+ bad_constant_folding();
+
+ if (ivec4(32, 31, 31, 30) != bitCount(ivec4(-1, -2, -3, -4)))
+ bad_constant_folding();
+ else if (ivec4(32, 31, 31, 30) != bitCount(uvec4(0xFFFFFFFFu, 0xFFFFFFFEu, 0xFFFFFFFDu, 0xFFFFFFFCu)))
+ bad_constant_folding();
+}
+
+[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
--
1.8.1.5
More information about the Piglit
mailing list