arb_program_interface_query: set vs_input2[1][0] as valid name
[piglit.git] / tests / spec / glsl-1.30 / execution / fs-logic-joined-comparisons-with-nan2.shader_test
blobd0b64231968537c7bff9b052a2e3a3d421836ca9
1 [require]
2 GLSL >= 1.30
4 [vertex shader passthrough]
6 [fragment shader]
7 #version 130
9 uniform float zero = 0.0;
10 uniform float also_zero = 0.0;
11 uniform float billion = 1000000000.0;
12 uniform float flt_max = 3.40282347E+38;
14 out vec4 piglit_fragcolor;
16 void main()
18     float inf = flt_max * flt_max;
19     float also_inf = flt_max * billion;
21     /* Trying very hard to trigger a potential sequence of
22      * optimizations in Mesa's compiler.  Specifically, MR !10012
23      * had a pattern
24      *
25      *    (('ior', ('ior(is_used_once)', ('flt(is_used_once)', a, b), d), ('flt', a, c)),
26      *     ('ior', ('flt', a, ('fmax', b, c)), d)),
27      *
28      * Since this did not mark the replacement fmin as exact, it could
29      * allow another pattern like
30      *
31      *    (('~fmax', ('fmin', a, 1.0), 0.0),
32      *     ('fsat', a), '!options->lower_fsat'),
33      *
34      * This would produce a different result when `c` (in the first
35      * pattern) is NaN.  The original max-of-min produces 1, but fsat
36      * produces 0.  If 0 < a < 1, then the comparison will produce a
37      * different result.
38      */
39     float a = gl_FragCoord.x * 0.0001 + 0.0001;  /* Always < 1.0 and > 0.0. */
40     const float b = 0.0;
41     float c = min((zero / also_zero) + (inf - also_inf), 1.0);
42     bool d = gl_FragCoord.y > billion;           /* Always false. */
44     if ((a < b || d) || (a < c))
45         piglit_fragcolor = vec4(0.0, 1.0, 0.0, 1.0);
46     else
47         piglit_fragcolor = vec4(1.0, 0.0, 0.0, 1.0);
50 [test]
51 draw rect -1 -1 2 2
52 probe all rgba 0.0 1.0 0.0 1.0