be056f4f62
This allows us to write SKSL_TEST_ES3 tests in SkSLTest and have them run properly. Previously, such a test would assert inside the pipeline- stage generator. In ES2 mode, we will rewrite switches as chained ifs, but in ES3 mode we will want to continue emitting them as-is (they will be faster than chained ifs on a modern GPU). `writeSwitchStatement` is adapted from GLSLCodeGenerator. Change-Id: I532ea5ed49869e7cdffced0cdcd0e353af8d4d79 Bug: skia:12450 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450478 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>
16 lines
272 B
Plaintext
16 lines
272 B
Plaintext
uniform half4 colorGreen, colorRed;
|
|
|
|
half4 main(float2 coords) {
|
|
// Basic switch test.
|
|
switch (int(colorGreen.g)) {
|
|
case 0:
|
|
return colorRed;
|
|
|
|
case 1:
|
|
return colorGreen;
|
|
|
|
default:
|
|
return colorRed;
|
|
}
|
|
}
|