summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2016-07-13 14:15:00 -0700
committerIan Romanick <ian.d.romanick@intel.com>2016-07-19 10:10:00 -0700
commitf32941307160438a58d324b2eda39c7f3f38643e (patch)
treec56efa5de69cb4175a44747c1373cf04b2bd326c
parent85f1a9f965c87d485b4a4a230294ece7e214904a (diff)
Try all negative powers of two with findMSB
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Sugggested-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test12
-rw-r--r--tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-findMSB.shader_test44
-rw-r--r--tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-findMSB.shader_test44
-rw-r--r--tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test12
-rw-r--r--tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test44
-rw-r--r--tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test44
6 files changed, 200 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test
index bdb3a0cac..37455bd37 100644
--- a/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/const-findMSB.shader_test
@@ -31,6 +31,18 @@ void main()
STATIC_ASSERT(ivec4(0, 1, 1, 2) != findMSB(uvec4(1u, 2u, 3u, 4u)));
STATIC_ASSERT(ivec4(31, 30, 29, 28) != findMSB(uvec4(0xFFFFFFFFu, 0x7FFFFFFFu, 0x3FFFFFFFu, 0x1FFFFFFFu)));
+
+ /* Some implementations may handle negative powers of 2 incorrectly
+ * (giving an off-by-one result. Try them all just to be sure.
+ */
+ STATIC_ASSERT(ivec4(30, 29, 28, 27) != findMSB(ivec4( 0x80000000, -0x40000000, -0x20000000, -0x10000000)));
+ STATIC_ASSERT(ivec4(26, 25, 24, 23) != findMSB(ivec4(-0x08000000, -0x04000000, -0x02000000, -0x01000000)));
+ STATIC_ASSERT(ivec4(22, 21, 20, 19) != findMSB(ivec4(-0x00800000, -0x00400000, -0x00200000, -0x00100000)));
+ STATIC_ASSERT(ivec4(18, 17, 16, 15) != findMSB(ivec4(-0x00080000, -0x00040000, -0x00020000, -0x00010000)));
+ STATIC_ASSERT(ivec4(14, 13, 12, 11) != findMSB(ivec4(-0x00008000, -0x00004000, -0x00002000, -0x00001000)));
+ STATIC_ASSERT(ivec4(10, 9, 8, 7) != findMSB(ivec4(-0x00000800, -0x00000400, -0x00000200, -0x00000100)));
+ STATIC_ASSERT(ivec4( 6, 5, 4, 3) != findMSB(ivec4(-0x00000080, -0x00000040, -0x00000020, -0x00000010)));
+ STATIC_ASSERT(ivec4( 2, 1, 0, -1) != findMSB(ivec4(-0x00000008, -0x00000004, -0x00000002, -0x00000001)));
}
[test]
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-findMSB.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-findMSB.shader_test
index f451299a0..ac1f99c1e 100644
--- a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-findMSB.shader_test
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-findMSB.shader_test
@@ -76,3 +76,47 @@ uniform ivec4 msb 31 30 29 28
uniform uvec4 uinput 0xFFFFFFFF 0x7FFFFFFF 0x3FFFFFFF 0x1FFFFFFF
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
+
+# Some implementations may handle negative powers of 2 incorrectly (giving an
+# off-by-one result. Try them all just to be sure.
+uniform int test_signed 1
+
+uniform ivec4 msb 30 29 28 27
+uniform ivec4 iinput 0x80000000 -0x40000000 -0x20000000 -0x10000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 26 25 24 23
+uniform ivec4 iinput -0x08000000 -0x04000000 -0x02000000 -0x01000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 22 21 20 19
+uniform ivec4 iinput -0x00800000 -0x00400000 -0x00200000 -0x00100000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 18 17 16 15
+uniform ivec4 iinput -0x00080000 -0x00040000 -0x00020000 -0x00010000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 14 13 12 11
+uniform ivec4 iinput -0x00008000 -0x00004000 -0x00002000 -0x00001000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 10 9 8 7
+uniform ivec4 iinput -0x00000800 -0x00000400 -0x00000200 -0x00000100
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 6 5 4 3
+uniform ivec4 iinput -0x00000080 -0x00000040 -0x00000020 -0x00000010
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 2 1 0 -1
+uniform ivec4 iinput -0x00000008 -0x00000004 -0x00000002 -0x00000001
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-findMSB.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-findMSB.shader_test
index b146376be..b27658fba 100644
--- a/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-findMSB.shader_test
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-findMSB.shader_test
@@ -86,3 +86,47 @@ uniform ivec4 msb 31 30 29 28
uniform uvec4 uinput 0xFFFFFFFF 0x7FFFFFFF 0x3FFFFFFF 0x1FFFFFFF
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
+
+# Some implementations may handle negative powers of 2 incorrectly (giving an
+# off-by-one result. Try them all just to be sure.
+uniform int test_signed 1
+
+uniform ivec4 msb 30 29 28 27
+uniform ivec4 iinput 0x80000000 -0x40000000 -0x20000000 -0x10000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 26 25 24 23
+uniform ivec4 iinput -0x08000000 -0x04000000 -0x02000000 -0x01000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 22 21 20 19
+uniform ivec4 iinput -0x00800000 -0x00400000 -0x00200000 -0x00100000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 18 17 16 15
+uniform ivec4 iinput -0x00080000 -0x00040000 -0x00020000 -0x00010000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 14 13 12 11
+uniform ivec4 iinput -0x00008000 -0x00004000 -0x00002000 -0x00001000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 10 9 8 7
+uniform ivec4 iinput -0x00000800 -0x00000400 -0x00000200 -0x00000100
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 6 5 4 3
+uniform ivec4 iinput -0x00000080 -0x00000040 -0x00000020 -0x00000010
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 2 1 0 -1
+uniform ivec4 iinput -0x00000008 -0x00000004 -0x00000002 -0x00000001
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test
index b792dd8f4..cccfb15d3 100644
--- a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/const-findMSB.shader_test
@@ -31,6 +31,18 @@ void main()
STATIC_ASSERT(ivec4(0, 1, 1, 2) != findMSB(uvec4(1u, 2u, 3u, 4u)));
STATIC_ASSERT(ivec4(31, 30, 29, 28) != findMSB(uvec4(0xFFFFFFFFu, 0x7FFFFFFFu, 0x3FFFFFFFu, 0x1FFFFFFFu)));
+
+ /* Some implementations may handle negative powers of 2 incorrectly
+ * (giving an off-by-one result. Try them all just to be sure.
+ */
+ STATIC_ASSERT(ivec4(30, 29, 28, 27) != findMSB(ivec4( 0x80000000, -0x40000000, -0x20000000, -0x10000000)));
+ STATIC_ASSERT(ivec4(26, 25, 24, 23) != findMSB(ivec4(-0x08000000, -0x04000000, -0x02000000, -0x01000000)));
+ STATIC_ASSERT(ivec4(22, 21, 20, 19) != findMSB(ivec4(-0x00800000, -0x00400000, -0x00200000, -0x00100000)));
+ STATIC_ASSERT(ivec4(18, 17, 16, 15) != findMSB(ivec4(-0x00080000, -0x00040000, -0x00020000, -0x00010000)));
+ STATIC_ASSERT(ivec4(14, 13, 12, 11) != findMSB(ivec4(-0x00008000, -0x00004000, -0x00002000, -0x00001000)));
+ STATIC_ASSERT(ivec4(10, 9, 8, 7) != findMSB(ivec4(-0x00000800, -0x00000400, -0x00000200, -0x00000100)));
+ STATIC_ASSERT(ivec4( 6, 5, 4, 3) != findMSB(ivec4(-0x00000080, -0x00000040, -0x00000020, -0x00000010)));
+ STATIC_ASSERT(ivec4( 2, 1, 0, -1) != findMSB(ivec4(-0x00000008, -0x00000004, -0x00000002, -0x00000001)));
}
[test]
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test
index 6a9c7d2d1..0d23b6429 100644
--- a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-findMSB.shader_test
@@ -76,3 +76,47 @@ uniform ivec4 msb 31 30 29 28
uniform uvec4 uinput 0xFFFFFFFF 0x7FFFFFFF 0x3FFFFFFF 0x1FFFFFFF
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
+
+# Some implementations may handle negative powers of 2 incorrectly (giving an
+# off-by-one result. Try them all just to be sure.
+uniform int test_signed 1
+
+uniform ivec4 msb 30 29 28 27
+uniform ivec4 iinput 0x80000000 -0x40000000 -0x20000000 -0x10000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 26 25 24 23
+uniform ivec4 iinput -0x08000000 -0x04000000 -0x02000000 -0x01000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 22 21 20 19
+uniform ivec4 iinput -0x00800000 -0x00400000 -0x00200000 -0x00100000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 18 17 16 15
+uniform ivec4 iinput -0x00080000 -0x00040000 -0x00020000 -0x00010000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 14 13 12 11
+uniform ivec4 iinput -0x00008000 -0x00004000 -0x00002000 -0x00001000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 10 9 8 7
+uniform ivec4 iinput -0x00000800 -0x00000400 -0x00000200 -0x00000100
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 6 5 4 3
+uniform ivec4 iinput -0x00000080 -0x00000040 -0x00000020 -0x00000010
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 2 1 0 -1
+uniform ivec4 iinput -0x00000008 -0x00000004 -0x00000002 -0x00000001
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test
index 0ef77e927..b406032e1 100644
--- a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-findMSB.shader_test
@@ -86,3 +86,47 @@ uniform ivec4 msb 31 30 29 28
uniform uvec4 uinput 0xFFFFFFFF 0x7FFFFFFF 0x3FFFFFFF 0x1FFFFFFF
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
+
+# Some implementations may handle negative powers of 2 incorrectly (giving an
+# off-by-one result. Try them all just to be sure.
+uniform int test_signed 1
+
+uniform ivec4 msb 30 29 28 27
+uniform ivec4 iinput 0x80000000 -0x40000000 -0x20000000 -0x10000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 26 25 24 23
+uniform ivec4 iinput -0x08000000 -0x04000000 -0x02000000 -0x01000000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 22 21 20 19
+uniform ivec4 iinput -0x00800000 -0x00400000 -0x00200000 -0x00100000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 18 17 16 15
+uniform ivec4 iinput -0x00080000 -0x00040000 -0x00020000 -0x00010000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 14 13 12 11
+uniform ivec4 iinput -0x00008000 -0x00004000 -0x00002000 -0x00001000
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 10 9 8 7
+uniform ivec4 iinput -0x00000800 -0x00000400 -0x00000200 -0x00000100
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 6 5 4 3
+uniform ivec4 iinput -0x00000080 -0x00000040 -0x00000020 -0x00000010
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform ivec4 msb 2 1 0 -1
+uniform ivec4 iinput -0x00000008 -0x00000004 -0x00000002 -0x00000001
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0