You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
600 B
24 lines
600 B
// (This test code was largely borrowed from shared/WhileLoopControlFlow.sksl.)
|
|
half4 main() {
|
|
half4 color = half4(1);
|
|
|
|
// Basic while loop without a block.
|
|
while (color.r > 0.5) color.r -= 0.25;
|
|
|
|
// While loop with a block and a break statement.
|
|
while (color.a == 1) {
|
|
color.r -= 0.25;
|
|
if (color.r <= 0) break;
|
|
}
|
|
|
|
// While loop with a block and a continue statement.
|
|
while (color.b > 0) {
|
|
color.b -= 0.25;
|
|
if (color.a == 1) continue; // should always happen
|
|
color.g = 0;
|
|
}
|
|
|
|
// color contains green.
|
|
return color;
|
|
}
|