perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.10 / execution / vs-loop-partial-unroll-multiple-breaks-loop-phi.shader_test
blob3d342df88ecf1d3127f6964c9e9e8f0fc955d244
1 # This test unrolling of a loop with two exit points where the trip count
2 # of both exits is unknown but we can estimate loop length via array access.
3 # Here the exits have a phi between them via the results of "x" this tests
4 # loop unrolling skip unrolling or handles this phi correctly when unrolled.
5 [require]
6 GLSL >= 1.10
8 [vertex shader]
9 uniform int loop_count;
11 uniform int n_stop;
12 uniform float stops[18];
14 void main()
16   gl_Position = gl_Vertex;
18   vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
20   int x = 0;
21   int i;
22   for (i = 0; i < n_stop - 1; i++) {
23     x++;
25     if (0.0 < stops[i])
26         break;
27   }
29   if (i == 0 && x == 0)
30      colour = vec4(0.0, 1.0, 0.0, 1.0);
31   else if (i == 1)
32      colour = vec4(1.0, 0.0, 0.0, 1.0);
33   else if (i == 2)
34      colour = vec4(0.0, 0.0, 1.0, 1.0);
36   gl_FrontColor = colour;
39 [fragment shader]
40 void main()
42   gl_FragColor = gl_Color;
45 [test]
46 clear color 0.5 0.5 0.5 0.5
48 uniform int n_stop 1
49 uniform float stops[0] 1.0
50 draw rect -1 -1 2 2
51 probe all rgba 0.0 1.0 0.0 1.0
53 uniform int n_stop 2
54 uniform float stops[0] 0.0
55 uniform float stops[1] 1.0
56 draw rect -1 -1 2 2
57 probe all rgba 1.0 0.0 0.0 1.0
59 uniform int n_stop 3
60 uniform float stops[0] 0.0
61 uniform float stops[1] 1.0
62 draw rect -1 -1 2 2
63 probe all rgba 1.0 0.0 0.0 1.0
65 uniform int n_stop 3
66 uniform float stops[0] 0.0
67 uniform float stops[1] 0.0
68 uniform float stops[2] 1.0
69 draw rect -1 -1 2 2
70 probe all rgba 0.0 0.0 1.0 1.0
72 uniform int n_stop 3
73 uniform float stops[0] 0.0
74 uniform float stops[1] 0.0
75 uniform float stops[2] 0.0
76 draw rect -1 -1 2 2
77 probe all rgba 0.0 0.0 1.0 1.0
79 uniform int n_stop 4
80 uniform float stops[0] 0.0
81 uniform float stops[1] 0.0
82 uniform float stops[2] 0.0
83 uniform float stops[2] 0.0
84 draw rect -1 -1 2 2
85 probe all rgba 1.0 1.0 1.0 1.0