re-land of new SkSL precisions
Bug: skia:
Change-Id: Ic1deb3db2cbda6ca45f93dee99832971a36a2119
Reviewed-on: https://skia-review.googlesource.com/47841
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/ir/SkSLConstructor.h b/src/sksl/ir/SkSLConstructor.h
index 32fc0fb..cea5265 100644
--- a/src/sksl/ir/SkSLConstructor.h
+++ b/src/sksl/ir/SkSLConstructor.h
@@ -32,13 +32,15 @@
std::unique_ptr<Expression> constantPropagate(const IRGenerator& irGenerator,
const DefinitionMap& definitions) override {
if (fArguments.size() == 1 && fArguments[0]->fKind == Expression::kIntLiteral_Kind) {
- if (fType == *irGenerator.fContext.fFloat_Type) {
+ if (fType == *irGenerator.fContext.fFloat_Type ||
+ fType == *irGenerator.fContext.fHalf_Type) {
// promote float(1) to 1.0
int64_t intValue = ((IntLiteral&) *fArguments[0]).fValue;
return std::unique_ptr<Expression>(new FloatLiteral(irGenerator.fContext,
fOffset,
intValue));
- } else if (fType == *irGenerator.fContext.fUInt_Type) {
+ } else if (fType == *irGenerator.fContext.fUInt_Type ||
+ fType == *irGenerator.fContext.fUShort_Type) {
// promote uint(1) to 1u
int64_t intValue = ((IntLiteral&) *fArguments[0]).fValue;
return std::unique_ptr<Expression>(new IntLiteral(irGenerator.fContext,