diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-09-15 11:42:17 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-15 18:50:54 +0000 |
commit | 05d5a13fea6246648de7e41358ed338d53c85ea2 (patch) | |
tree | 695fdbeae1116f8ce813288e47b31c2a99f28f1f /src/sksl/ir/SkSLType.h | |
parent | 49f1f34438d3431f6d7e32847accd2ba96948a73 (diff) |
Revert "Revert "Switched highp float to highfloat and mediump float to half.""
This reverts commit 1d816b92bb7cf2258007f3f74ffd143b89f25d01.
Bug: skia:
Change-Id: I388b5e5e9bf619db48297a80c9a80c039f26c9f1
Reviewed-on: https://skia-review.googlesource.com/46464
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLType.h')
-rw-r--r-- | src/sksl/ir/SkSLType.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/sksl/ir/SkSLType.h b/src/sksl/ir/SkSLType.h index b0474216c1..ed5e076e73 100644 --- a/src/sksl/ir/SkSLType.h +++ b/src/sksl/ir/SkSLType.h @@ -93,11 +93,12 @@ public: } // Create a scalar type. - Type(String name, NumberKind numberKind) + Type(String name, NumberKind numberKind, int priority) : INHERITED(-1, kType_Kind, StringFragment()) , fNameString(std::move(name)) , fTypeKind(kScalar_Kind) , fNumberKind(numberKind) + , fPriority(priority) , fColumns(1) , fRows(1) { fName.fChars = fNameString.c_str(); @@ -105,11 +106,12 @@ public: } // Create a scalar type which can be coerced to the listed types. - Type(String name, NumberKind numberKind, std::vector<const Type*> coercibleTypes) + Type(String name, NumberKind numberKind, int priority, std::vector<const Type*> coercibleTypes) : INHERITED(-1, kType_Kind, StringFragment()) , fNameString(std::move(name)) , fTypeKind(kScalar_Kind) , fNumberKind(numberKind) + , fPriority(priority) , fCoercibleTypes(std::move(coercibleTypes)) , fColumns(1) , fRows(1) { @@ -224,6 +226,14 @@ public: } /** + * Returns the "priority" of a number type, in order of double > float > half > int > short. + * When operating on two number types, the result is the higher-priority type. + */ + int priority() const { + return fPriority; + } + + /** * Returns true if an instance of this type can be freely coerced (implicitly converted) to * another type. */ @@ -315,20 +325,21 @@ public: private: typedef Symbol INHERITED; - const String fNameString; - const Kind fTypeKind; + String fNameString; + Kind fTypeKind; // always kNonnumeric_NumberKind for non-scalar values - const NumberKind fNumberKind; + NumberKind fNumberKind; + int fPriority = -1; const Type* fComponentType = nullptr; - const std::vector<const Type*> fCoercibleTypes; - const int fColumns = -1; - const int fRows = -1; - const std::vector<Field> fFields; - const SpvDim_ fDimensions = SpvDim1D; - const bool fIsDepth = false; - const bool fIsArrayed = false; - const bool fIsMultisampled = false; - const bool fIsSampled = false; + std::vector<const Type*> fCoercibleTypes; + int fColumns = -1; + int fRows = -1; + std::vector<Field> fFields; + SpvDim_ fDimensions = SpvDim1D; + bool fIsDepth = false; + bool fIsArrayed = false; + bool fIsMultisampled = false; + bool fIsSampled = false; }; } // namespace |