mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Refactor unnecessary builtin checks
* Move unnecessary builtin checks out of type determination and into
validation
* Type determination now uses a bare minimum of information for most
builtins
* Validation now does majority of checking of builtins
* Added const qualifier to type accessors
Change-Id: Id11b739770af904a9b7afe0b1c2de50e1428a165
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/39540
Commit-Queue: Alan Baker <alanbaker@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
a6ced4d0b4
commit
e809fb3ae5
@@ -75,47 +75,47 @@ uint64_t Type::BaseAlignment(MemoryLayout) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Type::is_scalar() {
|
||||
bool Type::is_scalar() const {
|
||||
return is_float_scalar() || is_integer_scalar() || Is<Bool>();
|
||||
}
|
||||
|
||||
bool Type::is_float_scalar() {
|
||||
bool Type::is_float_scalar() const {
|
||||
return Is<F32>();
|
||||
}
|
||||
|
||||
bool Type::is_float_matrix() {
|
||||
bool Type::is_float_matrix() const {
|
||||
return Is<Matrix>() && As<Matrix>()->type()->is_float_scalar();
|
||||
}
|
||||
|
||||
bool Type::is_float_vector() {
|
||||
bool Type::is_float_vector() const {
|
||||
return Is<Vector>() && As<Vector>()->type()->is_float_scalar();
|
||||
}
|
||||
|
||||
bool Type::is_float_scalar_or_vector() {
|
||||
bool Type::is_float_scalar_or_vector() const {
|
||||
return is_float_scalar() || is_float_vector();
|
||||
}
|
||||
|
||||
bool Type::is_integer_scalar() {
|
||||
bool Type::is_integer_scalar() const {
|
||||
return Is<U32>() || Is<I32>();
|
||||
}
|
||||
|
||||
bool Type::is_unsigned_integer_vector() {
|
||||
bool Type::is_unsigned_integer_vector() const {
|
||||
return Is<Vector>() && As<Vector>()->type()->Is<U32>();
|
||||
}
|
||||
|
||||
bool Type::is_signed_integer_vector() {
|
||||
bool Type::is_signed_integer_vector() const {
|
||||
return Is<Vector>() && As<Vector>()->type()->Is<I32>();
|
||||
}
|
||||
|
||||
bool Type::is_unsigned_scalar_or_vector() {
|
||||
bool Type::is_unsigned_scalar_or_vector() const {
|
||||
return Is<U32>() || (Is<Vector>() && As<Vector>()->type()->Is<U32>());
|
||||
}
|
||||
|
||||
bool Type::is_signed_scalar_or_vector() {
|
||||
bool Type::is_signed_scalar_or_vector() const {
|
||||
return Is<I32>() || (Is<Vector>() && As<Vector>()->type()->Is<I32>());
|
||||
}
|
||||
|
||||
bool Type::is_integer_scalar_or_vector() {
|
||||
bool Type::is_integer_scalar_or_vector() const {
|
||||
return is_unsigned_scalar_or_vector() || is_signed_scalar_or_vector();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,27 +74,27 @@ class Type : public Castable<Type> {
|
||||
Type* UnwrapAll();
|
||||
|
||||
/// @returns true if this type is a scalar
|
||||
bool is_scalar();
|
||||
bool is_scalar() const;
|
||||
/// @returns true if this type is a float scalar
|
||||
bool is_float_scalar();
|
||||
bool is_float_scalar() const;
|
||||
/// @returns true if this type is a float matrix
|
||||
bool is_float_matrix();
|
||||
bool is_float_matrix() const;
|
||||
/// @returns true if this type is a float vector
|
||||
bool is_float_vector();
|
||||
bool is_float_vector() const;
|
||||
/// @returns true if this type is a float scalar or vector
|
||||
bool is_float_scalar_or_vector();
|
||||
/// @returns ture if this type is an integer scalar
|
||||
bool is_integer_scalar();
|
||||
bool is_float_scalar_or_vector() const;
|
||||
/// @returns true if this type is an integer scalar
|
||||
bool is_integer_scalar() const;
|
||||
/// @returns true if this type is a signed integer vector
|
||||
bool is_signed_integer_vector();
|
||||
bool is_signed_integer_vector() const;
|
||||
/// @returns true if this type is an unsigned vector
|
||||
bool is_unsigned_integer_vector();
|
||||
bool is_unsigned_integer_vector() const;
|
||||
/// @returns true if this type is an unsigned scalar or vector
|
||||
bool is_unsigned_scalar_or_vector();
|
||||
bool is_unsigned_scalar_or_vector() const;
|
||||
/// @returns true if this type is a signed scalar or vector
|
||||
bool is_signed_scalar_or_vector();
|
||||
bool is_signed_scalar_or_vector() const;
|
||||
/// @returns true if this type is an integer scalar or vector
|
||||
bool is_integer_scalar_or_vector();
|
||||
bool is_integer_scalar_or_vector() const;
|
||||
|
||||
protected:
|
||||
Type();
|
||||
|
||||
Reference in New Issue
Block a user