skia2/tests/sksl/shared/SwizzleOpt.sksl
John Stiles 3d921f1b2c Add unit test to demonstrate lack of SkSL swizzle optimization.
The right side of assignments will collapse redundant swizzles, but the
left side does not. Code like this can actually cause the ByteCode-
Generator to assert if it is run (it asserts in `swizzle_is_simple`
during code generation).

Change-Id: I891912fe0b5de2670dfa95f6702a86d5c42bb2ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320296
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>
2020-09-28 19:02:03 +00:00

17 lines
544 B
Plaintext

void main() {
half v = half(sqrt(1));
sk_FragColor = half4(v).rgba;
sk_FragColor = half4(v).rgb0.abgr;
sk_FragColor = half4(v).rgba.00ra;
sk_FragColor = half4(v).rgba.rrra.00ra.11ab;
sk_FragColor = half4(v).abga.gb11;
sk_FragColor = half4(v).abgr.abgr;
sk_FragColor = half4(half4(v).rrrr.bb, 1, 1);
sk_FragColor = half4(half4(v).ba.grgr);
sk_FragColor.rgba = sk_FragColor;
sk_FragColor.abgr = sk_FragColor;
sk_FragColor.rgba.ra = sk_FragColor.gb;
sk_FragColor.abgr.gba = sk_FragColor.aa1;
}