skia2/resources/sksl/inliner/ForInitializerExpressionsCanBeInlined.sksl
John Stiles 65d7ab2c07 Loosen ES3 restrictions in Runtime Effects for debugging.
This CL adds a RuntimeEffect option flag which skips over the various
`strictES2Mode` checks sprinkled throughout IR generation.

Runtime Effects still won't allow a lot of ES3 things (the Pipeline
stage will reject unsupported statement types, SkVM doesn't support most
non-ES2 constructs, etc). However, this change will give us the ability
to test many more features involving arrays and structs that previously
were off-limits due to ES2 restrictions, and will shore up some
legitimate gaps in our testing. This is a useful starting point to allow
for improved test coverage.

Change-Id: I4a5bc43914e65fc7e59f1cecb76a0ec5a7f05f2f
Bug: skia:11209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402157
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-04-28 19:59:36 +00:00

20 lines
340 B
Plaintext

uniform half4 colorGreen;
inline half4 initLoopVar() {
return half4(0.0625);
}
inline bool shouldLoop(half4 v) {
return v.x < 0.5;
}
inline half4 grow(half4 v) {
return v + half4(0.125);
}
half4 main(float2 coords) {
for (half4 color = initLoopVar(); shouldLoop(color); color = grow(color)) {}
return colorGreen;
}