skia2/resources/sksl/dslfp/GrDSLFPTest_DoStatement.fp
John Stiles f33b061e3b Add support for uniforms and layout(key)s to DSLCPPCodeGenerator.
Change-Id: I77c386e3d72fb4a5986e5efb8bc9d409200534d1
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398457
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-21 20:18:07 +00:00

26 lines
686 B
GLSL

layout(key) in bool shouldLoop; // always equals false
// (This test code was largely borrowed from shared/DoWhileControlFlow.sksl.)
half4 main() {
half4 color = half4(1, 1, 1, 1);
// Simple do-while loop, with no Block.
do color.r -= 0.25; while (shouldLoop);
// Do-while loop with a Block and Break in the middle.
do {
color.r -= 0.25;
if (color.r <= 0) break;
} while (color.a == 1);
// Do-while loop with a Block and Continue in the middle.
do {
color.b -= 0.25;
if (color.a == 1) continue; // should always happen
color.g = 0;
} while (color.b > 0);
// color contains green.
return color;
}