skia2/resources/sksl/dslfp/GrDSLFPTest_ForStatement.fp
John Stiles 47b48bc2be Reland "Add support for uniforms and layout(key)s to DSLCPPCodeGenerator."
This reverts commit 289da86e37.

Reason for revert: relanding

Original change's description:
> Revert "Add support for uniforms and layout(key)s to DSLCPPCodeGenerator."
>
> This reverts commit f33b061e3b.
>
> Reason for revert: Google3 roll and wasm build
>
> Original change's description:
> > 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>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: I006ece639fa6051ff6ef1c496e648db9d5d0b30a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11854
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399498
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>


Bug: skia:11854
Change-Id: I1a4a4db471e2ad0b169b2b77784ca17e6286fbd2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400036
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-22 20:04:32 +00:00

31 lines
835 B
GLSL

layout(key, ctype=SkPMColor4f) in half4 colorWhite;
// (This test code was largely borrowed from shared/ForLoopControlFlow.sksl.)
half4 main() {
half4 color = colorWhite;
// A basic for-loop with no block.
for (half a = 0; a <= 1; ++a) color.a = a;
// A for-loop with a block and a break inside.
for (half r = -5; r < 5; r += 1) {
color.r = r;
if (color.r == 0) break;
}
// A for-loop with a block and a continue inside.
for (half b = 5; b >= 0; b -= 1) {
color.b = b;
if (color.a == 1) continue; // should always happen
color.g = 0;
}
// // A for-loop with two init-variables. TODO(skia:11868): currently unsupported in DSL
// for (half x = 0, y = 1; x <= y; ++x) {
// color.a = x;
// }
// color contains green.
return color;
}