Test that entry point IO attributes are of valid types

BUG=tint:773

Change-Id: I94e8624647c645efe7ed558caa3d3bd05dd72f63
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50260
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ryan Harrison
2021-05-07 20:28:04 +00:00
committed by Commit Bot service account
parent ff7a5f8dc9
commit 74490e118e
5 changed files with 148 additions and 8 deletions

View File

@@ -132,6 +132,15 @@ bool Type::is_bool_scalar_or_vector() const {
return Is<Bool>() || is_bool_vector();
}
bool Type::is_numeric_vector() const {
return Is<Vector>(
[](const Vector* v) { return v->type()->is_numeric_scalar(); });
}
bool Type::is_numeric_scalar_or_vector() const {
return is_numeric_scalar() || is_numeric_vector();
}
bool Type::is_handle() const {
return IsAnyOf<Sampler, Texture>();
}

View File

@@ -125,6 +125,10 @@ class Type : public Castable<Type, Node> {
bool is_bool_vector() const;
/// @returns true if this type is boolean scalar or vector
bool is_bool_scalar_or_vector() const;
/// @returns true if this type is a numeric vector
bool is_numeric_vector() const;
/// @returns true if this type is a numeric scale or vector
bool is_numeric_scalar_or_vector() const;
/// @returns true if this type is a handle type
bool is_handle() const;