SkSL: Preserve coerced types of literals during dehydration/rehydration
Fixes a bug with ternary expressions in the pre-includes.
Change-Id: Ib277ce7d9f6a50ab3ee02610746af2672208afde
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335820
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLDehydrator.cpp b/src/sksl/SkSLDehydrator.cpp
index 6b81f28..6e8ef4a 100644
--- a/src/sksl/SkSLDehydrator.cpp
+++ b/src/sksl/SkSLDehydrator.cpp
@@ -304,6 +304,7 @@
case Expression::Kind::kFloatLiteral: {
const FloatLiteral& f = e->as<FloatLiteral>();
this->writeCommand(Rehydrator::kFloatLiteral_Command);
+ this->write(f.type());
FloatIntUnion u;
u.fFloat = f.value();
this->writeS32(u.fInt);
@@ -330,6 +331,7 @@
case Expression::Kind::kIntLiteral: {
const IntLiteral& i = e->as<IntLiteral>();
this->writeCommand(Rehydrator::kIntLiteral_Command);
+ this->write(i.type());
this->writeS32(i.value());
break;
}