1 # From the GLSL 4.40 spec, section 6.4 (Jumps):
3 # The continue jump is used only in loops. It skips the remainder
4 # of the body of the inner most loop of which it is inside. For
5 # while and do-while loops, this jump is to the next evaluation of
6 # the loop condition-expression from which the loop continues as
9 # As of 1/31/2014 (commit db8b6fb), Mesa handles "continue" inside a
10 # do-while loop incorrectly; instead of jumping to the loop
11 # condition-expression, it jumps to the top of the loop. This is
12 # particularly problematic because it can lead to infinite loops.
14 # This test verifies correct behaviour of "continue" inside do-while
15 # loops without risking an infinite loop.
23 gl_Position = gl_Vertex;
26 do { // 1st iteration 2nd iteration 3rd iteration
27 ++x; // x <- 1 x <- 2 x <- 3
28 if (x >= 4) // false false false
30 if (x >= 2) // false true true
32 ++y; // y=1 skipped skipped
33 } while (x < 3); // true true false
35 // The "continue" should skip ++y on all iterations but the first,
36 // so y should now be 1. The "continue" should not skip (x < 3)
37 // ever, so the loop should terminate when x == 3 (not 4).
39 gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
41 gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
47 gl_FragColor = gl_Color;
52 probe all rgba 0.0 1.0 0.0 1.0