perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.30 / execution / fs-shift-left-of-shift-left.shader_test
blob4e863b4941bf1addb71066ad6feca256c9e86767
1 # Test proper behavior of (a << b) << c where b+c >= 32
3 [require]
4 GLSL >= 1.30
6 [vertex shader passthrough]
8 [fragment shader]
9 #version 130
11 uniform int a = 0xffffffff;
13 void main()
15    /* Section 5.9 (Expressions) of the GLSL 1.30 spec says:
16     *
17     *    The result is undefined if the right operand is negative, or greater
18     *    than or equal to the number of bits in the left expression's base
19     *    type.
20     *
21     * Both 7 and 25 are less than the number of bits in the left expression's
22     * base type, but (7+25) is not.  Check for compilers that try to do a
23     * clever optimization here.
24     *
25     * Compilers that use the SM5 rules of (x << y) == (x << (y & 31)) will
26     * treat this as a shift by zero.  Produce purple for those, and red for
27     * any other kind of failure.
28     */
29    int x = (a << 7) << 25;
31    if (x == a) {
32       gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
33    } else {
34      gl_FragColor = x == 0
35          ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
36    }
39 [test]
40 draw rect -1 -1 2 2
41 probe all rgba 0.0 1.0 0.0 1.0