1 # This tests unrolling of a loop with a single exit point but where the
2 # exact trip count is unknown, only the max iteration count (4) is known.
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.
10 uniform int loop_count;
14 gl_Position = gl_Vertex;
16 vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
20 while (x < loop_count && i < 4) {
22 colour = vec4(0.0, 0.25, 0.0, 1.0);
25 colour = vec4(0.0, 0.5, 0.0, 1.0);
28 colour = vec4(0.0, 0.75, 0.0, 1.0);
31 colour = vec4(0.0, 1.0, 0.0, 1.0);
33 /* This should be unreachable */
35 colour = vec4(1.0, 0.0, 0.0, 1.0);
41 gl_FrontColor = colour;
47 gl_FragColor = gl_Color;
51 clear color 0.5 0.5 0.5 0.5
53 uniform int loop_count 0
55 probe all rgba 1.0 1.0 1.0 1.0
57 uniform int loop_count 2
59 probe all rgba 0.0 0.25 0.0 1.0
61 uniform int loop_count 4
63 probe all rgba 0.0 0.5 0.0 1.0
65 uniform int loop_count 6
67 probe all rgba 0.0 0.75 0.0 1.0
69 uniform int loop_count 8
71 probe all rgba 0.0 1.0 0.0 1.0
73 uniform int loop_count 10
75 probe all rgba 0.0 1.0 0.0 1.0