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