skia2/resources/sksl/shared/DoWhileControlFlow.sksl
John Stiles 798021ada3 Add unit test for control statements in do-while loop.
Change-Id: I8309940f8e40d0e84847ae272830896d010c39de
Bug: skia:11219
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359138
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-26 16:20:31 +00:00

20 lines
416 B
Plaintext

half4 main() {
half4 x = half4(1, 1, 1, 1);
// Verify that break is allowed in a do-while loop.
do {
x.r -= 0.25;
if (x.r <= 0) break;
} while (x.a == 1);
// Verify that continue is allowed in a do-while loop.
do {
x.b -= 0.25;
if (x.a == 1) continue; // should always happen
x.g = 0;
} while (x.b > 0);
// x contains green.
return x;
}