skia2/resources/sksl/dslfp/GrDSLFPTest_DoStatement.fp
John Stiles 1dcf46359c Fix sk_Caps support in DSL C++ code generator.
This was almost right, but was missing the trailing () to make a
function call.

Change-Id: I1215a97bb0ac39aceca8ff6bea70af8ff572ef84
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400541
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-04-23 22:20:13 +00:00

26 lines
715 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 || sk_Caps.builtinFMASupport) continue; // should always happen
color.g = 0;
} while (color.b > 0);
// color contains green.
return color;
}