3 GL_MESA_shader_integer_functions
4 GL_ARB_shader_bit_encoding
7 #extension GL_MESA_shader_integer_functions : enable
8 #extension GL_ARB_shader_bit_encoding : enable
10 in vec4 piglit_vertex;
13 uniform vec4 expected_float;
14 uniform vec4 given_float;
15 uniform ivec4 given_exponent;
19 gl_Position = piglit_vertex;
21 /* Green if both pass. */
22 color = vec4(0.0, 1.0, 0.0, 1.0);
24 /* Compare the results after going through floatBitsToInt() allows us
25 * to distinguish -0.0f from 0.0f.
27 if (floatBitsToInt(expected_float) !=
28 floatBitsToInt(ldexp(given_float, given_exponent))) {
43 # Basic tests with exponent = 0.
44 uniform vec4 expected_float 0.0 -0.0 0.5 -0.5
45 uniform vec4 given_float 0.0 -0.0 0.5 -0.5
46 uniform ivec4 given_exponent 0 0 0 0
48 probe all rgba 0.0 1.0 0.0 1.0
50 # Basic tests with x = 0.
51 uniform vec4 expected_float 0.0 0.0 0.0 0.0
52 uniform vec4 given_float 0.0 0.0 0.0 0.0
53 uniform ivec4 given_exponent 1 100 -1 -100
55 probe all rgba 0.0 1.0 0.0 1.0
58 uniform vec4 expected_float 0.49 1.0 25.0 100
59 uniform vec4 given_float 0.98 0.5 0.78125 0.78125
60 uniform ivec4 given_exponent -1 1 5 7
62 probe all rgba 0.0 1.0 0.0 1.0
64 # Test generating FLT_MIN (1.1754944e-38) and FLT_MAX (3.40282347e38).
65 uniform vec4 expected_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
66 uniform vec4 given_float 0.5 -0.5 0.999999940 -0.999999940
67 uniform ivec4 given_exponent -125 -125 128 128
69 probe all rgba 0.0 1.0 0.0 1.0
71 # Test FLT_MIN (1.1754944e-38) and FLT_MAX (3.40282347e38) as inputs.
72 uniform vec4 expected_float 0.5 -0.5 0.999999940 -0.999999940
73 uniform vec4 given_float 1.1754944e-38 -1.1754944e-38 3.40282347e38 -3.40282347e38
74 uniform ivec4 given_exponent 125 125 -128 -128
76 probe all rgba 0.0 1.0 0.0 1.0
78 # Test underflow generates zero with sign of x.
79 uniform vec4 expected_float 0.0 -0.0 0.0 -0.0
80 uniform vec4 given_float 0.0 -0.0 0.5 -0.5
81 uniform ivec4 given_exponent -127 -127 -127 -127
83 probe all rgba 0.0 1.0 0.0 1.0
85 # Overflow is undefined according to the GLSL spec, so nothing to test.