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;
11 uniform int loop_count2;
15 gl_Position = gl_Vertex;
17 vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
23 /* Here we add a second && and put the known limit i < 4 in parentheses in
24 * order to trigger a Mesa bug seen in a Assasins Creed Odyssey shader
26 while (x < loop_count && (i < 4 && j < loop_count2)) {
28 colour = vec4(0.0, 0.25, 0.0, 1.0);
30 if (x == 2 && i == 1 && j == 4)
31 colour = vec4(0.0, 0.5, 0.0, 1.0);
33 if (x == 4 && i == 2 && j == 8)
34 colour = vec4(0.0, 0.75, 0.0, 1.0);
36 if (x == 6 && i == 3 && j == 12)
37 colour = vec4(0.0, 1.0, 0.0, 1.0);
39 /* This should be unreachable */
41 colour = vec4(1.0, 0.0, 0.0, 1.0);
48 gl_FrontColor = colour;
54 gl_FragColor = gl_Color;
58 clear color 0.5 0.5 0.5 0.5
60 uniform int loop_count 0
61 uniform int loop_count2 16
63 probe all rgba 1.0 1.0 1.0 1.0
65 uniform int loop_count 2
66 uniform int loop_count2 16
68 probe all rgba 0.0 0.25 0.0 1.0
70 uniform int loop_count 4
71 uniform int loop_count2 16
73 probe all rgba 0.0 0.5 0.0 1.0
75 uniform int loop_count 6
76 uniform int loop_count2 16
78 probe all rgba 0.0 0.75 0.0 1.0
80 uniform int loop_count 8
81 uniform int loop_count2 16
83 probe all rgba 0.0 1.0 0.0 1.0
85 uniform int loop_count 10
86 uniform int loop_count2 16
88 probe all rgba 0.0 1.0 0.0 1.0