aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ir/SkSLConstructor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sksl/ir/SkSLConstructor.h')
-rw-r--r--src/sksl/ir/SkSLConstructor.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sksl/ir/SkSLConstructor.h b/src/sksl/ir/SkSLConstructor.h
index beed0f702d..8f963e68eb 100644
--- a/src/sksl/ir/SkSLConstructor.h
+++ b/src/sksl/ir/SkSLConstructor.h
@@ -33,13 +33,15 @@ struct Constructor : public Expression {
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,
fPosition,
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,