perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.10 / execution / fs-frontfacing-ternary-neg-1.0-1.0-alt.shader_test
blobc8b0222f3e1c1130e2d0ff88f87aad9d05c9904f
1 [require]
2 GLSL >= 1.10
4 [vertex shader passthrough]
6 [fragment shader]
7 uniform vec2 u;
9 void main()
11         float f = gl_FrontFacing ? -1.0 : 1.0;
13         // This non-obvious arithmetic is carefully crafted to try to avoid
14         // some NIR optimizations that hid a bug in the Intel compiler backend
15         // for Gfx12+ (Tigerlake and newer) GPUs.  Basically, when NIR sees
16         //
17         //    x = (gl_FrontFacing ? -1.0 : 1.0) * a;
18         //
19         // it converts it to
20         //
21         //    x = gl_FrontFacing ? -a : a;
22         //
23         // This avoids the bad code generation for the (gl_FrontFacing ? -1.0
24         // : 1.0) case.
25         f = (f + u.x) * u.y; // Remap (-1.0, 1.0) -> (0.75, 0.25)
27         gl_FragColor = vec4(0.0, f, 0.0, 1.0);
30 [test]
31 uniform vec2 u -2.0 -0.25
33 draw rect -1 -1 2 1
34 draw rect 1 0 -2 1
35 relative probe rgba (0, 0) (0.0, 0.75, 0.0, 1.0)
36 relative probe rgba (1, 0) (0.0, 0.75, 0.0, 1.0)
37 relative probe rgba (0, 1) (0.0, 0.25, 0.0, 1.0)
38 relative probe rgba (1, 1) (0.0, 0.25, 0.0, 1.0)