aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ir/SkSLType.h
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-08-16 16:41:30 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-16 23:05:15 +0000
commit88d99c63878c2d3d340120f0321676f72afcb4f0 (patch)
tree5b957dbf2f78ef7a15aa3810f8922c915508683f /src/sksl/ir/SkSLType.h
parenta26d219a929f4e70f8597dfd57a53348c4bba905 (diff)
Switched highp float to highfloat and mediump float to half.
The ultimate goal is to end up with "float" and "half", but this intermediate step uses "highfloat" so that it is clear if I missed a "float" somewhere. Once this lands, a subsequent CL will switch all "highfloats" back to "floats". Bug: skia: Change-Id: Ia13225c7a0a0a2901e07665891c473d2500ddcca Reviewed-on: https://skia-review.googlesource.com/31000 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLType.h')
-rw-r--r--src/sksl/ir/SkSLType.h37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/sksl/ir/SkSLType.h b/src/sksl/ir/SkSLType.h
index 6ea4c5694c..d7220f1c55 100644
--- a/src/sksl/ir/SkSLType.h
+++ b/src/sksl/ir/SkSLType.h
@@ -81,18 +81,20 @@ public:
, fFields(std::move(fields)) {}
// Create a scalar type.
- Type(String name, NumberKind numberKind)
+ Type(String name, NumberKind numberKind, int priority)
: INHERITED(Position(), kType_Kind, std::move(name))
, fTypeKind(kScalar_Kind)
, fNumberKind(numberKind)
+ , fPriority(priority)
, fColumns(1)
, fRows(1) {}
// 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(Position(), kType_Kind, std::move(name))
, fTypeKind(kScalar_Kind)
, fNumberKind(numberKind)
+ , fPriority(priority)
, fCoercibleTypes(std::move(coercibleTypes))
, fColumns(1)
, fRows(1) {}
@@ -192,6 +194,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.
*/
@@ -283,19 +293,20 @@ public:
private:
typedef Symbol INHERITED;
- const Kind fTypeKind;
+ 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