skia2/resources/sksl/shared/ArrayNarrowingConversions.sksl
John Stiles 9fdcc517b2 Write test demonstrating bug with array narrowing conversions.
We don't currently support this. There's no explicit syntax to cast an
array's type, but it can be implicitly required in some situations, like
`halfArray == floatArray` (when fAllowNarrowingConversions is on).

Change-Id: I00fe0ddd4f2682b2950e828dd78bb941d5f0430e
Bug: skia:12248
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436560
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-08-04 18:34:18 +00:00

14 lines
309 B
Plaintext

/*#pragma settings AllowNarrowingConversions*/
uniform half4 colorGreen, colorRed;
half4 main(float2 coords) {
int i2[2] = int[2](1, 2);
short s2[2] = short[2](1, 2);
float f2[2] = float[2](1, 2);
half h2[2] = half[2](1, 2);
return (i2 == s2 && f2 == h2) ? colorGreen : colorRed;
}