47b48bc2be
This reverts commit289da86e37
. Reason for revert: relanding Original change's description: > Revert "Add support for uniforms and layout(key)s to DSLCPPCodeGenerator." > > This reverts commitf33b061e3b
. > > 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>
45 lines
1.2 KiB
GLSL
45 lines
1.2 KiB
GLSL
layout(key) in half one; // always equals 1.0
|
|
|
|
half4 main() {
|
|
half4 color = half4(0);
|
|
|
|
// Basic if statement. (00 == 00: true --> color=0001)
|
|
if (color.rg == color.ba) color.a = one;
|
|
|
|
// Basic if statement with Block. (00 == 01: false)
|
|
if (color.rg == color.ba) {
|
|
color.r = color.a;
|
|
}
|
|
|
|
// TODO(skia:11872): Add test for If statement with comma-expression statement instead of Block.
|
|
|
|
// Basic if-else statement. (0 == 0: true --> color=1011)
|
|
if (color.r == color.g) color = color.araa; else color = color.rrra;
|
|
|
|
// Chained if-else statements.
|
|
if (color.r + color.g + color.b + color.a == one) { // (3 == 1: false)
|
|
color = half4(-1);
|
|
} else if (color.r + color.g + color.b + color.a == 2) { // (3 == 2: false)
|
|
color = half4(-2);
|
|
} else {
|
|
color = color.ggaa; // (color=0011)
|
|
}
|
|
|
|
// Nested if-else statements.
|
|
if (color.r == one) { // (0 == 1: false)
|
|
if (color.r == 2) {
|
|
color = color.rrrr;
|
|
} else {
|
|
color = color.gggg;
|
|
}
|
|
} else {
|
|
if (color.b * color.a == one) { // (1*1 == 1: true)
|
|
color = color.rbga; // (color = 0101)
|
|
} else {
|
|
color = color.aaaa;
|
|
}
|
|
}
|
|
|
|
return color;
|
|
}
|