1layout(key, ctype=SkPMColor4f) in half4 colorWhite; 2 3// (This test code was largely borrowed from shared/ForLoopControlFlow.sksl.) 4half4 main() { 5 half4 color = colorWhite; 6 7 // A basic for-loop with no block. 8 for (half a = 0; a <= 1; ++a) color.a = a; 9 10 // A for-loop with a block and a break inside. 11 for (half r = -5; r < 5; r += 1) { 12 color.r = r; 13 if (color.r == 0) break; 14 } 15 16 // A for-loop with a block and a continue inside. 17 for (half b = 5; b >= 0; b -= 1) { 18 color.b = b; 19 if (color.a == 1) continue; // should always happen 20 color.g = 0; 21 } 22 23 // A for-loop with two init-variables. 24 for (uint x = 0, y = 1; x <= y; ++x) { 25 color.a = half(x); 26 } 27 28 // color contains green. 29 return color; 30} 31