perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.10 / execution / vs-loop-array-index-unroll.shader_test
blobf123ab664ece54bd66a0a32181e243096493f1d8
1 # This tests unrolling of a loop with a single exit point where the exact trip
2 # count is unknown, but the max iteration count can be guessed using the size
3 # of an array indexed via the induction variable.
5 # Here we test all possible (defined) outcomes for the loop.
6 [require]
7 GLSL >= 1.10
9 [vertex shader]
10 uniform int loop_count;
12 void main()
14   vec4 colour_array[4];
16   colour_array[0] = vec4(0.0, 0.25, 0.0, 1.0);
17   colour_array[1] = vec4(0.0, 0.5, 0.0, 1.0);
18   colour_array[2] = vec4(0.0, 0.75, 0.0, 1.0);
19   colour_array[3] = vec4(0.0, 1.0, 0.0, 1.0);
21   gl_Position = gl_Vertex;
23   vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
24   for (int i = 0; i < loop_count; i++) {
25     colour = colour_array[i];
26   }
28   gl_FrontColor = colour;
31 [fragment shader]
32 void main()
34   gl_FragColor = gl_Color;
37 [test]
38 clear color 0.5 0.5 0.5 0.5
40 uniform int loop_count 0
41 draw rect -1 -1 2 2
42 probe all rgba 1.0 1.0 1.0 1.0
44 uniform int loop_count 1
45 draw rect -1 -1 2 2
46 probe all rgba 0.0 0.25 0.0 1.0
48 uniform int loop_count 2
49 draw rect -1 -1 2 2
50 probe all rgba 0.0 0.5 0.0 1.0
52 uniform int loop_count 3
53 draw rect -1 -1 2 2
54 probe all rgba 0.0 0.75 0.0 1.0
56 uniform int loop_count 4
57 draw rect -1 -1 2 2
58 probe all rgba 0.0 1.0 0.0 1.0