diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-04-20 19:31:52 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-20 23:57:21 +0000 |
commit | cb67096b61f699b047fe8635984db1ac708a7b99 (patch) | |
tree | 3a8bda0962ad77d0d9ccb1d89c15f70578a7fe78 /src/sksl/ir/SkSLFloatLiteral.h | |
parent | e79b473714866682dea85b66c005c5bb2ff6a397 (diff) |
Improved skslc optimizer, particularly around vectors.
BUG=skia:
Change-Id: Idb364d9198f2ff84aad1eb68e236fb45ec1c86b7
Reviewed-on: https://skia-review.googlesource.com/8000
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLFloatLiteral.h')
-rw-r--r-- | src/sksl/ir/SkSLFloatLiteral.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/sksl/ir/SkSLFloatLiteral.h b/src/sksl/ir/SkSLFloatLiteral.h index 5ed123575b..8f83e2866c 100644 --- a/src/sksl/ir/SkSLFloatLiteral.h +++ b/src/sksl/ir/SkSLFloatLiteral.h @@ -17,14 +17,19 @@ namespace SkSL { * A literal floating point number. */ struct FloatLiteral : public Expression { - FloatLiteral(const Context& context, Position position, double value) - : INHERITED(position, kFloatLiteral_Kind, *context.fFloat_Type) + FloatLiteral(const Context& context, Position position, double value, + const Type* type = nullptr) + : INHERITED(position, kFloatLiteral_Kind, type ? *type : *context.fFloat_Type) , fValue(value) {} - virtual String description() const override { + String description() const override { return to_string(fValue); } + bool hasSideEffects() const override { + return false; + } + bool isConstant() const override { return true; } |