[Piglit] [PATCH] Try all negative powers of two with findMSB

Ian Romanick idr at freedesktop.org
Wed Jul 13 21:19:10 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Sugggested-by: Matt Turner <mattst88 at gmail.com>
---
 .../built-in-functions/const-findMSB.shader_test   | 12 ++++++
 .../built-in-functions/fs-findMSB.shader_test      | 44 ++++++++++++++++++++++
 .../built-in-functions/vs-findMSB.shader_test      | 44 ++++++++++++++++++++++
 .../built-in-functions/const-findMSB.shader_test   | 12 ++++++
 .../built-in-functions/fs-findMSB.shader_test      | 44 ++++++++++++++++++++++
 .../built-in-functions/vs-findMSB.shader_test      | 44 ++++++++++++++++++++++
 6 files changed, 200 insertions(+)

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 bdb3a0c..37455bd 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 f451299..ac1f99c 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 b146376..b27658f 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 b792dd8..cccfb15 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 6a9c7d2..0d23b64 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 0ef77e9..b406032 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
-- 
2.5.5



More information about the Piglit mailing list