summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2013-04-21 13:31:36 -0700
committerMatt Turner <mattst88@gmail.com>2013-04-30 15:44:58 -0700
commitb92c0774decaaf5fa37f4b4c1578d4e3d5f215eb (patch)
treeb799fd238aee8a393a52872448ffaacc6ebbd3f4
parent1f5ed0acc7f5a00ad0c08db250564db624d67bbb (diff)
arb_gpu_shader5: Add a constant eval findLSB execution test.
v2: Call nonexistent bad_constant_folding() function if test fails.
-rw-r--r--tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findLSB.shader_test59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findLSB.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findLSB.shader_test
new file mode 100644
index 000000000..b62df921d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findLSB.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(-1) != findLSB(ivec4(0)))
+ bad_constant_folding();
+ else if (ivec4(-1) != findLSB(uvec4(0u)))
+ bad_constant_folding();
+
+ if (ivec4(0, 1, 0, 2) != findLSB(ivec4(1, 2, 3, 4)))
+ bad_constant_folding();
+ else if (ivec4(0, 1, 0, 2) != findLSB(uvec4(1u, 2u, 3u, 4u)))
+ bad_constant_folding();
+
+ if (ivec4(10, 9, 8, 7) != findLSB(ivec4(1024, 512, 256, 128)))
+ bad_constant_folding();
+ else if (ivec4(10, 9, 8, 7) != findLSB(uvec4(1024u, 512u, 256u, 128u)))
+ bad_constant_folding();
+
+ if (ivec4(0, 1, 0, 2) != findLSB(ivec4(-1, -2, -3, -4)))
+ bad_constant_folding();
+ else if (ivec4(0, 1, 0, 2) != findLSB(uvec4(0xFFFFFFFFu, 0xFFFFFFFEu, 0xFFFFFFFDu, 0xFFFFFFFCu)))
+ bad_constant_folding();
+
+ if (ivec4(31, 30, 29, 28) != findLSB(ivec4(-2147483648, 1073741824, 536870912, 268435456)))
+ bad_constant_folding();
+ else if (ivec4(31, 30, 29, 28) != findLSB(uvec4(0x80000000u, 0x40000000u, 0x20000000u, 0x10000000u)))
+ 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