3 GL_MESA_shader_integer_functions
6 #extension GL_MESA_shader_integer_functions : enable
11 uniform bool test_signed;
17 gl_Position = piglit_vertex;
19 /* Green if both pass. */
20 color = vec4(0.0, 1.0, 0.0, 1.0);
22 if (test_signed && msb != findMSB(iinput))
23 /* Red if findMSB(ivec4) fails. */
24 color = vec4(1.0, 0.0, 0.0, 1.0);
25 else if (!test_signed && msb != findMSB(uinput))
26 /* Blue if findMSB(uvec4) fails. */
27 color = vec4(0.0, 0.0, 1.0, 1.0);
40 # For a value of zero or negative one, -1 will be returned.
41 uniform int test_signed 1
42 uniform ivec4 msb -1 -1 -1 -1
43 uniform ivec4 iinput 0 -1 -1 0
45 probe all rgba 0.0 1.0 0.0 1.0
47 uniform int test_signed 0
48 uniform ivec4 msb -1 -1 -1 -1
49 uniform uvec4 uinput 0 0 0 0
51 probe all rgba 0.0 1.0 0.0 1.0
54 uniform int test_signed 1
56 uniform ivec4 msb 0 1 1 2
57 uniform ivec4 iinput 1 2 3 4
59 probe all rgba 0.0 1.0 0.0 1.0
61 uniform ivec4 msb 30 29 28 27
62 uniform ivec4 iinput 2147483647 1073741823 536870911 268435455
64 probe all rgba 0.0 1.0 0.0 1.0
66 # Most significant bit in negative signed integers is actually a zero.
67 uniform ivec4 msb 0 1 2 3
68 uniform ivec4 iinput -2 -3 -5 -9
70 probe all rgba 0.0 1.0 0.0 1.0
72 uniform ivec4 msb 30 30 29 28
73 uniform ivec4 iinput -2147483648 -1879048192 -1073741824 -536870912
75 probe all rgba 0.0 1.0 0.0 1.0
78 uniform int test_signed 0
80 uniform ivec4 msb 0 1 1 2
81 uniform uvec4 uinput 1 2 3 4
83 probe all rgba 0.0 1.0 0.0 1.0
85 uniform ivec4 msb 31 30 29 28
86 uniform uvec4 uinput 0xFFFFFFFF 0x7FFFFFFF 0x3FFFFFFF 0x1FFFFFFF
88 probe all rgba 0.0 1.0 0.0 1.0
90 # Some implementations may handle negative powers of 2 incorrectly (giving an
91 # off-by-one result. Try them all just to be sure.
92 uniform int test_signed 1
94 uniform ivec4 msb 30 29 28 27
95 uniform ivec4 iinput 0x80000000 -0x40000000 -0x20000000 -0x10000000
97 probe all rgba 0.0 1.0 0.0 1.0
99 uniform ivec4 msb 26 25 24 23
100 uniform ivec4 iinput -0x08000000 -0x04000000 -0x02000000 -0x01000000
102 probe all rgba 0.0 1.0 0.0 1.0
104 uniform ivec4 msb 22 21 20 19
105 uniform ivec4 iinput -0x00800000 -0x00400000 -0x00200000 -0x00100000
107 probe all rgba 0.0 1.0 0.0 1.0
109 uniform ivec4 msb 18 17 16 15
110 uniform ivec4 iinput -0x00080000 -0x00040000 -0x00020000 -0x00010000
112 probe all rgba 0.0 1.0 0.0 1.0
114 uniform ivec4 msb 14 13 12 11
115 uniform ivec4 iinput -0x00008000 -0x00004000 -0x00002000 -0x00001000
117 probe all rgba 0.0 1.0 0.0 1.0
119 uniform ivec4 msb 10 9 8 7
120 uniform ivec4 iinput -0x00000800 -0x00000400 -0x00000200 -0x00000100
122 probe all rgba 0.0 1.0 0.0 1.0
124 uniform ivec4 msb 6 5 4 3
125 uniform ivec4 iinput -0x00000080 -0x00000040 -0x00000020 -0x00000010
127 probe all rgba 0.0 1.0 0.0 1.0
129 uniform ivec4 msb 2 1 0 -1
130 uniform ivec4 iinput -0x00000008 -0x00000004 -0x00000002 -0x00000001
132 probe all rgba 0.0 1.0 0.0 1.0