diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-08-16 22:01:21 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-17 02:23:35 +0000 |
commit | 8ac36a577f14158c820bbc673f477a7ce20702e5 (patch) | |
tree | 19fd50c4b6b91a01677fe8a5c2c8e990f0568505 /src/sksl/ir/SkSLConstructor.h | |
parent | 88d99c63878c2d3d340120f0321676f72afcb4f0 (diff) |
fixed constant vector swizzling
Bug: skia:
Change-Id: I2d205bf7242d2223c4939c3e7897db9aba02c705
Reviewed-on: https://skia-review.googlesource.com/35640
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLConstructor.h')
-rw-r--r-- | src/sksl/ir/SkSLConstructor.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sksl/ir/SkSLConstructor.h b/src/sksl/ir/SkSLConstructor.h index 8f963e68eb..51af1c1132 100644 --- a/src/sksl/ir/SkSLConstructor.h +++ b/src/sksl/ir/SkSLConstructor.h @@ -50,6 +50,17 @@ struct Constructor : public Expression { &fType)); } } + if (fArguments.size() == 1 && fArguments[0]->fKind == Expression::kFloatLiteral_Kind) { + if (fType == *irGenerator.fContext.fFloat_Type || + fType == *irGenerator.fContext.fHalf_Type) { + // convert float(1.0) to 1.0 + double floatValue = ((FloatLiteral&) *fArguments[0]).fValue; + return std::unique_ptr<Expression>(new FloatLiteral(irGenerator.fContext, + fPosition, + floatValue, + &fType)); + } + } return nullptr; } |