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>
This commit is contained in:
parent
fdb13e954c
commit
9fdcc517b2
@ -273,6 +273,7 @@ sksl_shared_tests = [
|
||||
"/sksl/shared/ArrayComparison.sksl",
|
||||
"/sksl/shared/ArrayConstructors.sksl",
|
||||
"/sksl/shared/ArrayIndexTypes.sksl",
|
||||
"/sksl/shared/ArrayNarrowingConversions.sksl",
|
||||
"/sksl/shared/ArrayTypes.sksl",
|
||||
"/sksl/shared/Assignment.sksl",
|
||||
"/sksl/shared/Caps.sksl",
|
||||
|
13
resources/sksl/shared/ArrayNarrowingConversions.sksl
Normal file
13
resources/sksl/shared/ArrayNarrowingConversions.sksl
Normal file
@ -0,0 +1,13 @@
|
||||
/*#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;
|
||||
}
|
@ -208,6 +208,9 @@ static bool detect_shader_settings(const SkSL::String& text,
|
||||
static auto s_version450CoreCaps = Factory::Version450Core();
|
||||
*caps = s_version450CoreCaps.get();
|
||||
}
|
||||
if (settingsText.consumeSuffix(" AllowNarrowingConversions")) {
|
||||
settings->fAllowNarrowingConversions = true;
|
||||
}
|
||||
if (settingsText.consumeSuffix(" ForceHighPrecision")) {
|
||||
settings->fForceHighPrecision = true;
|
||||
}
|
||||
|
4
tests/sksl/shared/ArrayNarrowingConversions.asm.frag
Normal file
4
tests/sksl/shared/ArrayNarrowingConversions.asm.frag
Normal file
@ -0,0 +1,4 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 12: type mismatch: '==' cannot operate on 'int[2]', 'short[2]'
|
||||
1 error
|
4
tests/sksl/shared/ArrayNarrowingConversions.glsl
Normal file
4
tests/sksl/shared/ArrayNarrowingConversions.glsl
Normal file
@ -0,0 +1,4 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 12: type mismatch: '==' cannot operate on 'int[2]', 'short[2]'
|
||||
1 error
|
4
tests/sksl/shared/ArrayNarrowingConversions.metal
Normal file
4
tests/sksl/shared/ArrayNarrowingConversions.metal
Normal file
@ -0,0 +1,4 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 12: type mismatch: '==' cannot operate on 'int[2]', 'short[2]'
|
||||
1 error
|
Loading…
Reference in New Issue
Block a user