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.
10 uniform int loop_count;
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++) {
21 colour = vec4(1.0, 0.0, 0.0, 1.0);
25 colour = vec4(0.0, 1.0, 0.0, 1.0);
30 /* Unreachable break */
35 /* This should be unreachable */
37 colour2 = vec4(0.0, 1.0, 0.0, 1.0);
41 gl_FrontColor = colour + colour2;
47 gl_FragColor = gl_Color;
51 clear color 0.5 0.5 0.5 0.5
53 uniform int loop_count 4
55 probe all rgba 1.0 0.0 0.0 1.0
57 uniform int loop_count 3
59 probe all rgba 1.0 0.0 0.0 1.0
61 uniform int loop_count 2
63 probe all rgba 0.0 1.0 0.0 1.0
65 uniform int loop_count 1
67 probe all rgba 0.0 1.0 0.0 1.0
69 uniform int loop_count 0
71 probe all rgba 1.0 1.0 1.0 1.0