perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.10 / execution / vs-loop-complex-unroll.shader_test
blob425394c0466207efe1ecdcf4fd16bb41914baaf9
1 # This tests unrolling of a loop with two exit point where the trip count
2 # of one of the exits is known and the other unknown (loop_count uniform).
4 # Here we test all possible outcomes for the loop and also add some
5 # unreachable code to make sure it is not accessible after unrolling.
6 [require]
7 GLSL >= 1.10
9 [vertex shader]
10 uniform int loop_count;
12 void main()
14   gl_Position = gl_Vertex;
16   vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
17   vec4 colour2 = vec4(0.0, 0.0, 0.0, 1.0);
18   for (int i = 0; i < loop_count; i++) {
20      if (i > 1) {
21         colour = vec4(1.0, 0.0, 0.0, 1.0);
22      }
24      if (i > 1) {
25         break;
26      }
28      colour = vec4(0.0, 1.0, 0.0, 1.0);
30      /* This should be unreachable */
31      if (i >= 2) {
32         colour2 = vec4(0.0, 1.0, 0.0, 1.0);
33      }
34   }
36   gl_FrontColor = colour + colour2;
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 loop_count 4
49 draw rect -1 -1 2 2
50 probe all rgba 1.0 0.0 0.0 1.0
52 uniform int loop_count 3
53 draw rect -1 -1 2 2
54 probe all rgba 1.0 0.0 0.0 1.0
56 uniform int loop_count 2
57 draw rect -1 -1 2 2
58 probe all rgba 0.0 1.0 0.0 1.0
60 uniform int loop_count 1
61 draw rect -1 -1 2 2
62 probe all rgba 0.0 1.0 0.0 1.0
64 uniform int loop_count 0
65 draw rect -1 -1 2 2
66 probe all rgba 1.0 1.0 1.0 1.0