Enable narrowing conversions automatically for Runtime Effects.
Previously, it was possible to compile runtime effects with narrowing
conversions disabled; e.g. skslc would do this. A Runtime Effect-based
ProgramKind now enables narrowing conversions automatically. (The
setting flag could still be turned on manually as well.)
Change-Id: I912c9adda77c29ccfda3b1d85d106315f648d624
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435916
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index 275eb94..d78b0cd 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -459,6 +459,11 @@
settings.fRemoveDeadFunctions &= settings.fOptimize;
settings.fRemoveDeadVariables &= settings.fOptimize;
+ // Runtime effects always allow narrowing conversions.
+ if (ProgramConfig::IsRuntimeEffect(kind)) {
+ settings.fAllowNarrowingConversions = true;
+ }
+
fErrorText = "";
fErrorCount = 0;
fInliner.reset();