Update casing of `type.h` `is_*` methods.
This CL updates the camel_case `is_foo` methods in Type to be PascalCase
like the rest of the methods, so `IsFoo`. Any method which as not used,
or only used in `type.cc` is removed.
Change-Id: Ife52bbea88e3983a11b9d293ce52a97a51046590
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/203874
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/core/constant/eval.cc b/src/tint/lang/core/constant/eval.cc
index 5ca0c4e..95ed95c 100644
--- a/src/tint/lang/core/constant/eval.cc
+++ b/src/tint/lang/core/constant/eval.cc
@@ -1430,7 +1430,7 @@
VectorRef<const Value*> args,
const Source& source) {
auto* value = args[0];
- bool is_abstract = value->Type()->is_abstract_integer_scalar_or_vector();
+ bool is_abstract = value->Type()->IsAbstractScalarOrVector();
// Target type
auto dst_elements = ty->Elements(ty->DeepestElement(), 1u);
diff --git a/src/tint/lang/core/ir/transform/binary_polyfill.cc b/src/tint/lang/core/ir/transform/binary_polyfill.cc
index 43c46b2..bdc1b03 100644
--- a/src/tint/lang/core/ir/transform/binary_polyfill.cc
+++ b/src/tint/lang/core/ir/transform/binary_polyfill.cc
@@ -71,7 +71,7 @@
case BinaryOp::kDivide:
case BinaryOp::kModulo:
if (config.int_div_mod &&
- binary->Result(0)->Type()->is_integer_scalar_or_vector()) {
+ binary->Result(0)->Type()->IsIntegerScalarOrVector()) {
worklist.Push(binary);
}
break;
@@ -110,7 +110,7 @@
void IntDivMod(ir::CoreBinary* binary) {
auto* result_ty = binary->Result(0)->Type();
bool is_div = binary->Op() == BinaryOp::kDivide;
- bool is_signed = result_ty->is_signed_integer_scalar_or_vector();
+ bool is_signed = result_ty->IsSignedIntegerScalarOrVector();
auto& helpers = is_div ? int_div_helpers : int_mod_helpers;
auto* helper = helpers.GetOrAdd(result_ty, [&] {
diff --git a/src/tint/lang/core/ir/transform/builtin_polyfill.cc b/src/tint/lang/core/ir/transform/builtin_polyfill.cc
index b40447d..cc75570 100644
--- a/src/tint/lang/core/ir/transform/builtin_polyfill.cc
+++ b/src/tint/lang/core/ir/transform/builtin_polyfill.cc
@@ -71,7 +71,7 @@
switch (builtin->Func()) {
case core::BuiltinFn::kClamp:
if (config.clamp_int &&
- builtin->Result(0)->Type()->is_integer_scalar_or_vector()) {
+ builtin->Result(0)->Type()->IsIntegerScalarOrVector()) {
worklist.Push(builtin);
}
break;
@@ -269,7 +269,7 @@
// %result = (%b16 | %b8 | %b4 | %b2 | %b1) + %b0;
auto* x = input;
- if (result_ty->is_signed_integer_scalar_or_vector()) {
+ if (result_ty->IsSignedIntegerScalarOrVector()) {
x = b.Bitcast(uint_ty, x)->Result(0);
}
auto* b16 = b.Call(uint_ty, core::BuiltinFn::kSelect, V(0), V(16),
@@ -294,7 +294,7 @@
uint_ty, b16,
b.Or(uint_ty, b8, b.Or(uint_ty, b4, b.Or(uint_ty, b2, b.Or(uint_ty, b1, b0))))),
b0);
- if (result_ty->is_signed_integer_scalar_or_vector()) {
+ if (result_ty->IsSignedIntegerScalarOrVector()) {
result = b.Bitcast(result_ty, result);
}
result->SetResults(Vector{call->DetachResult()});
@@ -331,7 +331,7 @@
// %result = (%b16 | %b8 | %b4 | %b2 | %b1) + %b0;
auto* x = input;
- if (result_ty->is_signed_integer_scalar_or_vector()) {
+ if (result_ty->IsSignedIntegerScalarOrVector()) {
x = b.Bitcast(uint_ty, x)->Result(0);
}
auto* b16 = b.Call(uint_ty, core::BuiltinFn::kSelect, V(0), V(16),
@@ -354,7 +354,7 @@
uint_ty,
b.Or(uint_ty, b16, b.Or(uint_ty, b8, b.Or(uint_ty, b4, b.Or(uint_ty, b2, b1)))),
b0);
- if (result_ty->is_signed_integer_scalar_or_vector()) {
+ if (result_ty->IsSignedIntegerScalarOrVector()) {
result = b.Bitcast(result_ty, result);
}
result->SetResults(Vector{call->DetachResult()});
@@ -437,7 +437,7 @@
// %result = select(%result, 0xffffffff, %x == 0);
auto* x = input;
- if (result_ty->is_signed_integer_scalar_or_vector()) {
+ if (result_ty->IsSignedIntegerScalarOrVector()) {
x = b.Bitcast(uint_ty, x)->Result(0);
auto* inverted = b.Complement(uint_ty, x);
x = b.Call(uint_ty, core::BuiltinFn::kSelect, inverted, x,
@@ -462,7 +462,7 @@
b.Or(uint_ty, b16, b.Or(uint_ty, b8, b.Or(uint_ty, b4, b.Or(uint_ty, b2, b1))));
result = b.Call(uint_ty, core::BuiltinFn::kSelect, result, V(0xffffffff),
b.Equal(bool_ty, x, V(0)));
- if (result_ty->is_signed_integer_scalar_or_vector()) {
+ if (result_ty->IsSignedIntegerScalarOrVector()) {
result = b.Bitcast(result_ty, result);
}
result->SetResults(Vector{call->DetachResult()});
@@ -499,7 +499,7 @@
// %result = select(%result, 0xffffffff, %x == 0);
auto* x = input;
- if (result_ty->is_signed_integer_scalar_or_vector()) {
+ if (result_ty->IsSignedIntegerScalarOrVector()) {
x = b.Bitcast(uint_ty, x)->Result(0);
}
auto* b16 = b.Call(uint_ty, core::BuiltinFn::kSelect, V(0), V(16),
@@ -520,7 +520,7 @@
b.Or(uint_ty, b16, b.Or(uint_ty, b8, b.Or(uint_ty, b4, b.Or(uint_ty, b2, b1))));
result = b.Call(uint_ty, core::BuiltinFn::kSelect, result, V(0xffffffff),
b.Equal(bool_ty, x, V(0)));
- if (result_ty->is_signed_integer_scalar_or_vector()) {
+ if (result_ty->IsSignedIntegerScalarOrVector()) {
result = b.Bitcast(result_ty, result);
}
result->SetResults(Vector{call->DetachResult()});
diff --git a/src/tint/lang/core/ir/transform/conversion_polyfill.cc b/src/tint/lang/core/ir/transform/conversion_polyfill.cc
index 87b3cfb..7f7cac0 100644
--- a/src/tint/lang/core/ir/transform/conversion_polyfill.cc
+++ b/src/tint/lang/core/ir/transform/conversion_polyfill.cc
@@ -71,9 +71,9 @@
if (auto* convert = inst->As<ir::Convert>()) {
auto* src_ty = convert->Args()[0]->Type();
auto* res_ty = convert->Result(0)->Type();
- if (config.ftoi && //
- src_ty->is_float_scalar_or_vector() && //
- res_ty->is_integer_scalar_or_vector()) {
+ if (config.ftoi && //
+ src_ty->IsFloatScalarOrVector() && //
+ res_ty->IsIntegerScalarOrVector()) {
ftoi_worklist.Push(convert);
}
}
@@ -120,7 +120,7 @@
} limits;
// Integer limits.
- if (res_ty->is_signed_integer_scalar_or_vector()) {
+ if (res_ty->IsSignedIntegerScalarOrVector()) {
limits.low_limit_i = b.MatchWidth(i32(INT32_MIN), res_ty);
limits.high_limit_i = b.MatchWidth(i32(INT32_MAX), res_ty);
} else {
@@ -130,7 +130,7 @@
// Largest integers representable in the source floating point format.
if (src_el_ty->Is<type::F32>()) {
- if (res_ty->is_signed_integer_scalar_or_vector()) {
+ if (res_ty->IsSignedIntegerScalarOrVector()) {
// INT32_MIN is -(2^31), which is exactly representable as an f32.
// INT32_MAX is (2^31 - 1), which is not exactly representable as an f32, so we
// instead use the next highest integer value in the f32 domain.
@@ -146,7 +146,7 @@
}
} else if (src_el_ty->Is<type::F16>()) {
constexpr float MAX_F16 = 65504;
- if (res_ty->is_signed_integer_scalar_or_vector()) {
+ if (res_ty->IsSignedIntegerScalarOrVector()) {
limits.low_limit_f = b.MatchWidth(f16(-MAX_F16), res_ty);
limits.high_limit_f = b.MatchWidth(f16(MAX_F16), res_ty);
} else {
diff --git a/src/tint/lang/core/ir/transform/multiplanar_external_texture.cc b/src/tint/lang/core/ir/transform/multiplanar_external_texture.cc
index f151a65..ef72b44 100644
--- a/src/tint/lang/core/ir/transform/multiplanar_external_texture.cc
+++ b/src/tint/lang/core/ir/transform/multiplanar_external_texture.cc
@@ -239,7 +239,7 @@
} else if (call->Func() == core::BuiltinFn::kTextureLoad) {
// Convert the coordinates to unsigned integers if necessary.
auto* coords = call->Args()[1];
- if (coords->Type()->is_signed_integer_vector()) {
+ if (coords->Type()->IsSignedIntegerVector()) {
auto* convert = b.Convert(ty.vec2<u32>(), coords);
convert->InsertBefore(call);
coords = convert->Result(0);
diff --git a/src/tint/lang/core/ir/transform/robustness.cc b/src/tint/lang/core/ir/transform/robustness.cc
index e6aaf32..816cf14 100644
--- a/src/tint/lang/core/ir/transform/robustness.cc
+++ b/src/tint/lang/core/ir/transform/robustness.cc
@@ -168,7 +168,7 @@
/// @param value the value to convert
/// @returns the converted value, or @p value if it is already a u32
ir::Value* CastToU32(ir::Value* value) {
- if (value->Type()->is_unsigned_integer_scalar_or_vector()) {
+ if (value->Type()->IsUnsignedIntegerScalarOrVector()) {
return value;
}
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index 2afd202..11d471e 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -1596,7 +1596,7 @@
};
auto* index = a->Indices()[i];
- if (TINT_UNLIKELY(!index->Type()->is_integer_scalar())) {
+ if (TINT_UNLIKELY(!index->Type()->IsIntegerScalar())) {
err() << "index must be integer, got " << index->Type()->FriendlyName();
return;
}
@@ -1610,7 +1610,7 @@
if (auto* const_index = index->As<ir::Constant>()) {
auto* value = const_index->Value();
- if (value->Type()->is_signed_integer_scalar()) {
+ if (value->Type()->IsSignedIntegerScalar()) {
// index is a signed integer scalar. Check that the index isn't negative.
// If the index is unsigned, we can skip this.
auto idx = value->ValueAs<AInt>();
@@ -1819,7 +1819,7 @@
void Validator::CheckSwitch(const Switch* s) {
CheckOperandNotNull(s, s->Condition(), If::kConditionOperandOffset);
- if (s->Condition() && !s->Condition()->Type()->is_integer_scalar()) {
+ if (s->Condition() && !s->Condition()->Type()->IsIntegerScalar()) {
AddError(s, Switch::kConditionOperandOffset) << "condition type must be an integer scalar";
}
diff --git a/src/tint/lang/core/type/type.cc b/src/tint/lang/core/type/type.cc
index 128f270..807e765 100644
--- a/src/tint/lang/core/type/type.cc
+++ b/src/tint/lang/core/type/type.cc
@@ -88,100 +88,72 @@
return 0;
}
-bool Type::is_float_scalar() const {
+bool Type::IsFloatScalar() const {
return IsAnyOf<F16, F32, AbstractFloat>();
}
-bool Type::is_float_matrix() const {
- return Is([](const Matrix* m) { return m->Type()->is_float_scalar(); });
+bool Type::IsFloatMatrix() const {
+ return Is([](const Matrix* m) { return m->Type()->IsFloatScalar(); });
}
-bool Type::is_square_float_matrix() const {
- return Is(
- [](const Matrix* m) { return m->Type()->is_float_scalar() && m->Rows() == m->Columns(); });
+bool Type::IsFloatVector() const {
+ return Is([](const Vector* v) { return v->Type()->IsFloatScalar(); });
}
-bool Type::is_float_vector() const {
- return Is([](const Vector* v) { return v->Type()->is_float_scalar(); });
+bool Type::IsFloatScalarOrVector() const {
+ return IsFloatScalar() || IsFloatVector();
}
-bool Type::is_float_scalar_or_vector() const {
- return is_float_scalar() || is_float_vector();
-}
-
-bool Type::is_float_scalar_or_vector_or_matrix() const {
- return is_float_scalar() || is_float_vector() || is_float_matrix();
-}
-
-bool Type::is_integer_scalar() const {
+bool Type::IsIntegerScalar() const {
return IsAnyOf<U32, I32>();
}
-bool Type::is_signed_integer_scalar() const {
+bool Type::IsSignedIntegerScalar() const {
return IsAnyOf<I32, AbstractInt>();
}
-bool Type::is_unsigned_integer_scalar() const {
+bool Type::IsUnsignedIntegerScalar() const {
return Is<U32>();
}
-bool Type::is_signed_integer_vector() const {
+bool Type::IsSignedIntegerVector() const {
return Is([](const Vector* v) { return v->Type()->IsAnyOf<I32, AbstractInt>(); });
}
-bool Type::is_unsigned_integer_vector() const {
+bool Type::IsUnsignedIntegerVector() const {
return Is([](const Vector* v) { return v->Type()->Is<U32>(); });
}
-bool Type::is_unsigned_integer_scalar_or_vector() const {
- return Is<U32>() || is_unsigned_integer_vector();
+bool Type::IsUnsignedIntegerScalarOrVector() const {
+ return Is<U32>() || IsUnsignedIntegerVector();
}
-bool Type::is_signed_integer_scalar_or_vector() const {
- return IsAnyOf<I32, AbstractInt>() || is_signed_integer_vector();
+bool Type::IsSignedIntegerScalarOrVector() const {
+ return IsAnyOf<I32, AbstractInt>() || IsSignedIntegerVector();
}
-bool Type::is_integer_scalar_or_vector() const {
- return is_unsigned_integer_scalar_or_vector() || is_signed_integer_scalar_or_vector();
+bool Type::IsIntegerScalarOrVector() const {
+ return IsUnsignedIntegerScalarOrVector() || IsSignedIntegerScalarOrVector();
}
-bool Type::is_abstract_integer_vector() const {
- return Is([](const Vector* v) { return v->Type()->Is<AbstractInt>(); });
+bool Type::IsAbstractScalarOrVector() const {
+ return Is<AbstractInt>() || Is([](const Vector* v) { return v->Type()->Is<AbstractInt>(); });
}
-bool Type::is_abstract_float_vector() const {
- return Is([](const Vector* v) { return v->Type()->Is<AbstractFloat>(); });
+bool Type::IsBoolScalarOrVector() const {
+ return Is<Bool>() || Is([](const Vector* v) { return v->Type()->Is<Bool>(); });
}
-bool Type::is_abstract_integer_scalar_or_vector() const {
- return Is<AbstractInt>() || is_abstract_integer_vector();
-}
-
-bool Type::is_abstract_float_scalar_or_vector() const {
- return Is<AbstractFloat>() || is_abstract_float_vector();
-}
-
-bool Type::is_bool_vector() const {
- return Is([](const Vector* v) { return v->Type()->Is<Bool>(); });
-}
-
-bool Type::is_bool_scalar_or_vector() const {
- return Is<Bool>() || is_bool_vector();
-}
-
-bool Type::is_numeric_vector() const {
- return Is([](const Vector* v) { return v->Type()->Is<core::type::NumericScalar>(); });
-}
-
-bool Type::is_scalar_vector() const {
+bool Type::IsScalarVector() const {
return Is([](const Vector* v) { return v->Type()->Is<core::type::Scalar>(); });
}
-bool Type::is_numeric_scalar_or_vector() const {
- return Is<core::type::NumericScalar>() || is_numeric_vector();
+bool Type::IsNumericScalarOrVector() const {
+ return Is<core::type::NumericScalar>() ||
+ Is([](const Vector* v) { return v->Type()->Is<core::type::NumericScalar>(); });
}
-bool Type::is_handle() const {
+bool Type::IsHandle() const {
return IsAnyOf<Sampler, Texture>();
}
diff --git a/src/tint/lang/core/type/type.h b/src/tint/lang/core/type/type.h
index fae0c44..4f09d90 100644
--- a/src/tint/lang/core/type/type.h
+++ b/src/tint/lang/core/type/type.h
@@ -130,53 +130,39 @@
inline bool HasFixedFootprint() const { return flags_.Contains(Flag::kFixedFootprint); }
/// @returns true if this type is a float scalar
- bool is_float_scalar() const;
+ bool IsFloatScalar() const;
/// @returns true if this type is a float matrix
- bool is_float_matrix() const;
- /// @returns true if this type is a square float matrix
- bool is_square_float_matrix() const;
+ bool IsFloatMatrix() const;
/// @returns true if this type is a float vector
- bool is_float_vector() const;
+ bool IsFloatVector() const;
/// @returns true if this type is a float scalar or vector
- bool is_float_scalar_or_vector() const;
- /// @returns true if this type is a float scalar or vector or matrix
- bool is_float_scalar_or_vector_or_matrix() const;
+ bool IsFloatScalarOrVector() const;
/// @returns true if this type is an integer scalar
- bool is_integer_scalar() const;
- /// @returns true if this type is a signed integer scalar
- bool is_signed_integer_scalar() const;
- /// @returns true if this type is an unsigned integer scalar
- bool is_unsigned_integer_scalar() const;
- /// @returns true if this type is a signed integer vector
- bool is_signed_integer_vector() const;
- /// @returns true if this type is an unsigned vector
- bool is_unsigned_integer_vector() const;
- /// @returns true if this type is an unsigned scalar or vector
- bool is_unsigned_integer_scalar_or_vector() const;
- /// @returns true if this type is a signed scalar or vector
- bool is_signed_integer_scalar_or_vector() const;
+ bool IsIntegerScalar() const;
/// @returns true if this type is an integer scalar or vector
- bool is_integer_scalar_or_vector() const;
- /// @returns true if this type is an abstract integer vector
- bool is_abstract_integer_vector() const;
- /// @returns true if this type is an abstract float vector
- bool is_abstract_float_vector() const;
+ bool IsIntegerScalarOrVector() const;
+ /// @returns true if this type is a signed integer scalar
+ bool IsSignedIntegerScalar() const;
+ /// @returns true if this type is a signed integer vector
+ bool IsSignedIntegerVector() const;
+ /// @returns true if this type is a signed scalar or vector
+ bool IsSignedIntegerScalarOrVector() const;
+ /// @returns true if this type is an unsigned integer scalar
+ bool IsUnsignedIntegerScalar() const;
+ /// @returns true if this type is an unsigned vector
+ bool IsUnsignedIntegerVector() const;
+ /// @returns true if this type is an unsigned scalar or vector
+ bool IsUnsignedIntegerScalarOrVector() const;
/// @returns true if this type is an abstract integer scalar or vector
- bool is_abstract_integer_scalar_or_vector() const;
- /// @returns true if this type is an abstract float scalar or vector
- bool is_abstract_float_scalar_or_vector() const;
- /// @returns true if this type is a boolean vector
- bool is_bool_vector() const;
+ bool IsAbstractScalarOrVector() 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;
+ bool IsBoolScalarOrVector() const;
/// @returns true if this type is a vector of scalar type
- bool is_scalar_vector() const;
+ bool IsScalarVector() const;
/// @returns true if this type is a numeric scale or vector
- bool is_numeric_scalar_or_vector() const;
+ bool IsNumericScalarOrVector() const;
/// @returns true if this type is a handle type
- bool is_handle() const;
+ bool IsHandle() const;
/// @returns true if this type is an abstract-numeric or if the type holds an element that is an
/// abstract-numeric.
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
index f54ecd1..a04f7b7d 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
@@ -409,7 +409,7 @@
auto* src_type = TypeOf(arg)->UnwrapRef();
auto* dst_type = TypeOf(call);
- if (!dst_type->is_integer_scalar_or_vector() && !dst_type->is_float_scalar_or_vector()) {
+ if (!dst_type->IsIntegerScalarOrVector() && !dst_type->IsFloatScalarOrVector()) {
diagnostics_.AddError(Source{})
<< "Unable to do bitcast to type " << dst_type->FriendlyName();
return;
@@ -459,7 +459,7 @@
}
auto s = Line(&b);
s << "return ";
- if (dst_type->is_float_scalar_or_vector()) {
+ if (dst_type->IsFloatScalarOrVector()) {
s << "uintBitsToFloat";
} else {
EmitType(s, dst_type, core::AddressSpace::kUndefined,
@@ -509,7 +509,7 @@
{
auto s = Line(&b);
s << "uvec2 r = ";
- if (src_type->is_float_scalar_or_vector()) {
+ if (src_type->IsFloatScalarOrVector()) {
s << "floatBitsToUint";
} else {
s << "uvec2";
@@ -527,7 +527,7 @@
{
auto s = Line(&b);
s << "uint r = ";
- if (src_type->is_float_scalar_or_vector()) {
+ if (src_type->IsFloatScalarOrVector()) {
s << "floatBitsToUint";
} else {
s << "uint";
@@ -547,17 +547,15 @@
EmitExpression(out, arg);
}
} else {
- if (src_type->is_float_scalar_or_vector() &&
- dst_type->is_signed_integer_scalar_or_vector()) {
+ if (src_type->IsFloatScalarOrVector() && dst_type->IsSignedIntegerScalarOrVector()) {
out << "floatBitsToInt";
- } else if (src_type->is_float_scalar_or_vector() &&
- dst_type->is_unsigned_integer_scalar_or_vector()) {
+ } else if (src_type->IsFloatScalarOrVector() &&
+ dst_type->IsUnsignedIntegerScalarOrVector()) {
out << "floatBitsToUint";
- } else if (src_type->is_signed_integer_scalar_or_vector() &&
- dst_type->is_float_scalar_or_vector()) {
+ } else if (src_type->IsSignedIntegerScalarOrVector() && dst_type->IsFloatScalarOrVector()) {
out << "intBitsToFloat";
- } else if (src_type->is_unsigned_integer_scalar_or_vector() &&
- dst_type->is_float_scalar_or_vector()) {
+ } else if (src_type->IsUnsignedIntegerScalarOrVector() &&
+ dst_type->IsFloatScalarOrVector()) {
out << "uintBitsToFloat";
} else {
EmitType(out, dst_type, core::AddressSpace::kUndefined, core::Access::kReadWrite, "");
@@ -720,14 +718,14 @@
}
if ((expr->op == core::BinaryOp::kAnd || expr->op == core::BinaryOp::kOr) &&
- TypeOf(expr->lhs)->UnwrapRef()->is_bool_scalar_or_vector()) {
+ TypeOf(expr->lhs)->UnwrapRef()->IsBoolScalarOrVector()) {
EmitBitwiseBoolOp(out, expr);
return;
}
if (expr->op == core::BinaryOp::kModulo &&
- (TypeOf(expr->lhs)->UnwrapRef()->is_float_scalar_or_vector() ||
- TypeOf(expr->rhs)->UnwrapRef()->is_float_scalar_or_vector())) {
+ (TypeOf(expr->lhs)->UnwrapRef()->IsFloatScalarOrVector() ||
+ TypeOf(expr->rhs)->UnwrapRef()->IsFloatScalarOrVector())) {
EmitFloatModulo(out, expr);
return;
}
@@ -888,7 +886,7 @@
} else if (builtin->Fn() == wgsl::BuiltinFn::kFma && version_.IsES()) {
EmitEmulatedFMA(out, expr);
} else if (builtin->Fn() == wgsl::BuiltinFn::kAbs &&
- TypeOf(expr->args[0])->UnwrapRef()->is_unsigned_integer_scalar_or_vector()) {
+ TypeOf(expr->args[0])->UnwrapRef()->IsUnsignedIntegerScalarOrVector()) {
// GLSL does not support abs() on unsigned arguments. However, it's a no-op.
EmitExpression(out, expr->args[0]);
} else if ((builtin->Fn() == wgsl::BuiltinFn::kAny || builtin->Fn() == wgsl::BuiltinFn::kAll) &&
@@ -1171,7 +1169,7 @@
const sem::BuiltinFn* builtin) {
auto* vec_ty = builtin->Parameters()[0]->Type()->As<core::type::Vector>();
std::string fn = "dot";
- if (vec_ty->Type()->is_integer_scalar()) {
+ if (vec_ty->Type()->IsIntegerScalar()) {
// GLSL does not have a builtin for dot() with integer vector types.
// Generate the helper function if it hasn't been created already
fn = tint::GetOrAdd(int_dot_funcs_, vec_ty, [&]() -> std::string {
@@ -1384,7 +1382,7 @@
auto emit_expr_as_signed = [&](const ast::Expression* e) {
auto* ty = TypeOf(e)->UnwrapRef();
- if (!ty->is_unsigned_integer_scalar_or_vector()) {
+ if (!ty->IsUnsignedIntegerScalarOrVector()) {
EmitExpression(out, e);
return;
}
diff --git a/src/tint/lang/glsl/writer/ast_raise/texture_1d_to_2d.cc b/src/tint/lang/glsl/writer/ast_raise/texture_1d_to_2d.cc
index 8808210..b2c196e 100644
--- a/src/tint/lang/glsl/writer/ast_raise/texture_1d_to_2d.cc
+++ b/src/tint/lang/glsl/writer/ast_raise/texture_1d_to_2d.cc
@@ -171,7 +171,7 @@
auto* coords = c->args[static_cast<size_t>(coords_index)];
const ast::LiteralExpression* half = nullptr;
- if (ctype->is_integer_scalar()) {
+ if (ctype->IsIntegerScalar()) {
half = ctx.dst->Expr(0_a);
} else {
half = ctx.dst->Expr(0.5_a);
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
index adaf489..e7fd33a 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
@@ -707,7 +707,7 @@
auto* src_el_type = src_type->DeepestElement();
auto* dst_el_type = dst_type->DeepestElement();
- if (!dst_el_type->is_integer_scalar() && !dst_el_type->is_float_scalar()) {
+ if (!dst_el_type->IsIntegerScalar() && !dst_el_type->IsFloatScalar()) {
diagnostics_.AddError(Source{})
<< "Unable to do bitcast to type " << dst_el_type->FriendlyName();
return false;
@@ -1278,10 +1278,10 @@
type == wgsl::BuiltinFn::kSubgroupXor) {
auto* arg = call->Arguments()[0];
auto* argType = arg->Type()->UnwrapRef();
- if (argType->is_signed_integer_scalar_or_vector()) {
+ if (argType->IsSignedIntegerScalarOrVector()) {
// Bitcast of literal int vectors fails in DXC so extract arg to a var. See
// github.com/microsoft/DirectXShaderCompiler/issues/6851.
- if (argType->is_signed_integer_vector() &&
+ if (argType->IsSignedIntegerVector() &&
arg->Stage() == core::EvaluationStage::kConstant) {
auto varName = UniqueIdentifier(kTempNamePrefix);
auto pre = Line();
@@ -1357,7 +1357,7 @@
// Single parameter matrix initializers must be identity initializer.
// It could also be conversions between f16 and f32 matrix when f16 is properly supported.
if (type->Is<core::type::Matrix>() && call->Arguments().Length() == 1) {
- if (!ctor->Parameters()[0]->Type()->UnwrapRef()->is_float_matrix()) {
+ if (!ctor->Parameters()[0]->Type()->UnwrapRef()->IsFloatMatrix()) {
TINT_UNREACHABLE()
<< "found a single-parameter matrix initializer that is not identity initializer";
}
@@ -1368,7 +1368,7 @@
// For single-value vector initializers, swizzle the scalar to the right
// vector dimension using .x
const bool is_single_value_vector_init =
- type->is_scalar_vector() && call->Arguments().Length() == 1 &&
+ type->IsScalarVector() && call->Arguments().Length() == 1 &&
ctor->Parameters()[0]->Type()->Is<core::type::Scalar>();
if (brackets) {
@@ -2638,7 +2638,7 @@
if (auto* sem = builder_.Sem().GetVal(expr)) {
if (auto* constant = sem->ConstantValue()) {
if (auto* splat = constant->As<core::constant::Splat>()) {
- if (splat->Type()->is_signed_integer_vector()) {
+ if (splat->Type()->IsSignedIntegerVector()) {
if (!EmitType(out, constant->Type(), core::AddressSpace::kUndefined,
core::Access::kUndefined, "")) {
return false;
diff --git a/src/tint/lang/hlsl/writer/raise/binary_polyfill.cc b/src/tint/lang/hlsl/writer/raise/binary_polyfill.cc
index 3f5d529..8198a15 100644
--- a/src/tint/lang/hlsl/writer/raise/binary_polyfill.cc
+++ b/src/tint/lang/hlsl/writer/raise/binary_polyfill.cc
@@ -59,7 +59,7 @@
if (auto* binary = inst->As<core::ir::Binary>()) {
switch (binary->Op()) {
case core::BinaryOp::kModulo: {
- if (binary->LHS()->Type()->is_float_scalar_or_vector()) {
+ if (binary->LHS()->Type()->IsFloatScalarOrVector()) {
binary_worklist.Push(binary);
}
break;
diff --git a/src/tint/lang/hlsl/writer/raise/builtin_polyfill.cc b/src/tint/lang/hlsl/writer/raise/builtin_polyfill.cc
index 188efa7..10adb3e 100644
--- a/src/tint/lang/hlsl/writer/raise/builtin_polyfill.cc
+++ b/src/tint/lang/hlsl/writer/raise/builtin_polyfill.cc
@@ -1750,14 +1750,14 @@
TINT_ASSERT(call->Args().Length() == 1);
auto* arg = call->Args()[0];
auto* arg_type = arg->Type()->UnwrapRef();
- if (arg_type->is_signed_integer_scalar_or_vector()) {
+ if (arg_type->IsSignedIntegerScalarOrVector()) {
auto* result_ty = call->Result(0)->Type();
auto* u32_type = ty.match_width(ty.u32(), result_ty);
b.InsertBefore(call, [&] {
core::ir::Value* val = arg;
// Bitcast of literal int vectors fails in DXC so extract arg to a var. See
// github.com/microsoft/DirectXShaderCompiler/issues/6851.
- if (arg_type->is_signed_integer_vector() && arg->Is<core::ir::Constant>()) {
+ if (arg_type->IsSignedIntegerVector() && arg->Is<core::ir::Constant>()) {
val = b.Let("arg", arg)->Result(0);
}
auto* inner =
diff --git a/src/tint/lang/hlsl/writer/raise/decompose_storage_access.cc b/src/tint/lang/hlsl/writer/raise/decompose_storage_access.cc
index eec363e..b61e497 100644
--- a/src/tint/lang/hlsl/writer/raise/decompose_storage_access.cc
+++ b/src/tint/lang/hlsl/writer/raise/decompose_storage_access.cc
@@ -381,7 +381,7 @@
core::ir::Value* from,
core::ir::Value* offset) {
auto* store_ty = from->Type();
- if (store_ty->is_numeric_scalar_or_vector()) {
+ if (store_ty->IsNumericScalarOrVector()) {
MakeScalarOrVectorStore(var, from, offset);
return;
}
@@ -445,7 +445,7 @@
core::ir::Var* var,
const core::type::Type* result_ty,
core::ir::Value* offset) {
- if (result_ty->is_numeric_scalar_or_vector()) {
+ if (result_ty->IsNumericScalarOrVector()) {
return MakeScalarOrVectorLoad(var, result_ty, offset);
}
diff --git a/src/tint/lang/hlsl/writer/raise/decompose_uniform_access.cc b/src/tint/lang/hlsl/writer/raise/decompose_uniform_access.cc
index 9710785..d6b0d36 100644
--- a/src/tint/lang/hlsl/writer/raise/decompose_uniform_access.cc
+++ b/src/tint/lang/hlsl/writer/raise/decompose_uniform_access.cc
@@ -295,10 +295,10 @@
core::ir::Var* var,
const core::type::Type* result_ty,
core::ir::Value* byte_idx) {
- if (result_ty->is_float_scalar() || result_ty->is_integer_scalar()) {
+ if (result_ty->IsFloatScalar() || result_ty->IsIntegerScalar()) {
return MakeScalarLoad(var, result_ty, byte_idx);
}
- if (result_ty->is_scalar_vector()) {
+ if (result_ty->IsScalarVector()) {
return MakeVectorLoad(var, result_ty->As<core::type::Vector>(), byte_idx);
}
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer.cc b/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
index 8315980..6c46559 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
@@ -519,7 +519,7 @@
};
auto signed_type_of = [&](const core::type::Type* ty) -> const core::type::Type* {
- if (ty->is_integer_scalar()) {
+ if (ty->IsIntegerScalar()) {
return builder_.create<core::type::I32>();
} else if (auto* v = ty->As<core::type::Vector>()) {
return builder_.create<core::type::Vector>(builder_.create<core::type::I32>(),
@@ -529,7 +529,7 @@
};
auto unsigned_type_of = [&](const core::type::Type* ty) -> const core::type::Type* {
- if (ty->is_integer_scalar()) {
+ if (ty->IsIntegerScalar()) {
return builder_.create<core::type::U32>();
} else if (auto* v = ty->As<core::type::Vector>()) {
return builder_.create<core::type::Vector>(builder_.create<core::type::U32>(),
@@ -542,7 +542,7 @@
auto* rhs_type = TypeOf(expr->rhs)->UnwrapRef();
// Handle fmod
- if (expr->op == core::BinaryOp::kModulo && lhs_type->is_float_scalar_or_vector()) {
+ if (expr->op == core::BinaryOp::kModulo && lhs_type->IsFloatScalarOrVector()) {
out << "fmod";
ScopedParen sp(out);
if (!EmitExpression(out, expr->lhs)) {
@@ -557,8 +557,7 @@
// Handle +/-/* of signed values
if ((expr->IsAdd() || expr->IsSubtract() || expr->IsMultiply()) &&
- lhs_type->is_signed_integer_scalar_or_vector() &&
- rhs_type->is_signed_integer_scalar_or_vector()) {
+ lhs_type->IsSignedIntegerScalarOrVector() && rhs_type->IsSignedIntegerScalarOrVector()) {
// If lhs or rhs is a vector, use that type (support implicit scalar to
// vector promotion)
auto* target_type = lhs_type->Is<core::type::Vector>()
@@ -591,7 +590,7 @@
// TODO(crbug.com/tint/1077): This may not be necessary. The MSL spec
// seems to imply that left shifting a signed value is treated the same as
// left shifting an unsigned value, but we need to make sure.
- if (expr->IsShiftLeft() && lhs_type->is_signed_integer_scalar_or_vector()) {
+ if (expr->IsShiftLeft() && lhs_type->IsSignedIntegerScalarOrVector()) {
// Shift left: discards top bits, so convert first operand to unsigned
// first, then convert result back to signed
ScopedBitCast outer_int_cast(this, out, lhs_type, signed_type_of(lhs_type));
@@ -1399,7 +1398,7 @@
// Cast the coordinates to unsigned integers if necessary.
bool inside_params = false;
- if (usage == Usage::kCoords && e->Type()->UnwrapRef()->is_integer_scalar_or_vector()) {
+ if (usage == Usage::kCoords && e->Type()->UnwrapRef()->IsIntegerScalarOrVector()) {
inside_params = true;
switch (texture_type->Dim()) {
case core::type::TextureDimension::k1d:
@@ -1417,7 +1416,7 @@
TINT_ICE() << "unhandled texture dimensionality";
}
} else if (usage == Usage::kArrayIndex &&
- e->Type()->UnwrapRef()->is_signed_integer_scalar() && is_gather_or_sample) {
+ e->Type()->UnwrapRef()->IsSignedIntegerScalar() && is_gather_or_sample) {
// Array index access for signed integers is zero lower bound clamped to emulate the
// behavior of other platforms. See crbug.com/202355.
out << "max(0, ";
@@ -1556,7 +1555,7 @@
const sem::BuiltinFn* builtin) {
auto* vec_ty = builtin->Parameters()[0]->Type()->As<core::type::Vector>();
std::string fn = "dot";
- if (vec_ty->Type()->is_integer_scalar()) {
+ if (vec_ty->Type()->IsIntegerScalar()) {
// MSL does not have a builtin for dot() with integer vector types.
// Generate the helper function if it hasn't been created already
fn = tint::GetOrAdd(int_dot_funcs_, vec_ty->Width(), [&]() -> std::string {
@@ -1748,7 +1747,7 @@
out += "powr";
break;
case wgsl::BuiltinFn::kAbs:
- if (builtin->ReturnType()->is_float_scalar_or_vector()) {
+ if (builtin->ReturnType()->IsFloatScalarOrVector()) {
out += "fabs";
} else {
out += "abs";
@@ -1785,14 +1784,14 @@
out += "fwidth";
break;
case wgsl::BuiltinFn::kMax:
- if (builtin->ReturnType()->is_float_scalar_or_vector()) {
+ if (builtin->ReturnType()->IsFloatScalarOrVector()) {
out += "fmax";
} else {
out += "max";
}
break;
case wgsl::BuiltinFn::kMin:
- if (builtin->ReturnType()->is_float_scalar_or_vector()) {
+ if (builtin->ReturnType()->IsFloatScalarOrVector()) {
out += "fmin";
} else {
out += "min";
@@ -3103,7 +3102,7 @@
// Handle `-e` when `e` is signed, so that we ensure that if `e` is the
// largest negative value, it returns `e`.
auto* expr_type = TypeOf(expr->expr)->UnwrapRef();
- if (expr->op == core::UnaryOp::kNegation && expr_type->is_signed_integer_scalar_or_vector()) {
+ if (expr->op == core::UnaryOp::kNegation && expr_type->IsSignedIntegerScalarOrVector()) {
auto fn = tint::GetOrAdd(unary_minus_funcs_, expr_type, [&]() -> std::string {
// e.g.:
// int tint_unary_minus(const int v) {
diff --git a/src/tint/lang/msl/writer/ast_raise/module_scope_var_to_entry_point_param.cc b/src/tint/lang/msl/writer/ast_raise/module_scope_var_to_entry_point_param.cc
index 946fa0a..c1bde6c 100644
--- a/src/tint/lang/msl/writer/ast_raise/module_scope_var_to_entry_point_param.cc
+++ b/src/tint/lang/msl/writer/ast_raise/module_scope_var_to_entry_point_param.cc
@@ -254,7 +254,7 @@
// Use a pointer for non-handle types.
tint::Vector<const ast::Attribute*, 2> attributes;
- if (!ty->is_handle()) {
+ if (!ty->IsHandle()) {
param_type = sc == core::AddressSpace::kStorage
? ctx.dst->ty.ptr(sc, param_type, var->Access())
: ctx.dst->ty.ptr(sc, param_type);
@@ -531,14 +531,14 @@
}
auto new_var = it->second;
- bool is_handle = target_var->Type()->UnwrapRef()->is_handle();
+ bool IsHandle = target_var->Type()->UnwrapRef()->IsHandle();
const ast::Expression* arg = ctx.dst->Expr(new_var.symbol);
if (new_var.is_wrapped) {
// The variable is wrapped in a struct, so we need to pass a pointer to the
// struct member instead.
arg = ctx.dst->AddressOf(
ctx.dst->MemberAccessor(ctx.dst->Deref(arg), kWrappedArrayMemberName));
- } else if (is_entry_point && !is_handle && !new_var.is_pointer) {
+ } else if (is_entry_point && !IsHandle && !new_var.is_pointer) {
// We need to pass a pointer and we don't already have one, so take
// the address of the new variable.
arg = ctx.dst->AddressOf(arg);
diff --git a/src/tint/lang/msl/writer/raise/binary_polyfill.cc b/src/tint/lang/msl/writer/raise/binary_polyfill.cc
index ad59ff9..0e579df 100644
--- a/src/tint/lang/msl/writer/raise/binary_polyfill.cc
+++ b/src/tint/lang/msl/writer/raise/binary_polyfill.cc
@@ -55,11 +55,11 @@
for (auto* inst : ir.Instructions()) {
if (auto* binary = inst->As<core::ir::CoreBinary>()) {
if (binary->Op() == core::BinaryOp::kModulo &&
- binary->LHS()->Type()->is_float_scalar_or_vector()) {
+ binary->LHS()->Type()->IsFloatScalarOrVector()) {
fmod_worklist.Push(binary);
} else if ((binary->Op() == core::BinaryOp::kAnd ||
binary->Op() == core::BinaryOp::kOr) &&
- binary->LHS()->Type()->is_bool_scalar_or_vector()) {
+ binary->LHS()->Type()->IsBoolScalarOrVector()) {
logical_bool_worklist.Push(binary);
}
}
diff --git a/src/tint/lang/msl/writer/raise/builtin_polyfill.cc b/src/tint/lang/msl/writer/raise/builtin_polyfill.cc
index 92fdf47..7ace2f6 100644
--- a/src/tint/lang/msl/writer/raise/builtin_polyfill.cc
+++ b/src/tint/lang/msl/writer/raise/builtin_polyfill.cc
@@ -348,7 +348,7 @@
auto* arg0 = builtin->Args()[0];
auto* arg1 = builtin->Args()[1];
auto* vec = arg0->Type()->As<core::type::Vector>();
- if (vec->Type()->is_integer_scalar()) {
+ if (vec->Type()->IsIntegerScalar()) {
// Calls to `dot` with a integer arguments are replaced with helper functions, as
// MSL's `dot` builtin only supports floating point arguments.
auto* polyfill = integer_dot_polyfills.GetOrAdd(vec, [&] {
@@ -530,7 +530,7 @@
b.InsertBefore(builtin, [&] {
// Calls to `sign` with an integer argument are replaced with select operations:
// result = select(select(-1, 1, arg > 0), 0, arg == 0);
- if (type->is_integer_scalar_or_vector()) {
+ if (type->IsIntegerScalarOrVector()) {
core::ir::Value* pos_one = b.MatchWidth(i32(1), type);
core::ir::Value* neg_one = b.MatchWidth(i32(-1), type);
const core::type::Type* bool_type = ty.match_width(ty.bool_(), type);
@@ -564,7 +564,7 @@
lod = b.Value(u32(0));
} else {
lod = builtin->Args()[1];
- if (lod->Type()->is_signed_integer_scalar()) {
+ if (lod->Type()->IsSignedIntegerScalar()) {
lod = b.Convert<u32>(lod)->Result(0);
}
}
@@ -611,7 +611,7 @@
auto* tex_type = tex->Type()->As<core::type::Texture>();
// Add an offset argument if it was not provided.
- const bool has_offset = args.Back()->Type()->is_signed_integer_vector();
+ const bool has_offset = args.Back()->Type()->IsSignedIntegerVector();
const bool needs_offset = tex_type->Dim() == core::type::TextureDimension::k2d ||
tex_type->Dim() == core::type::TextureDimension::k2dArray;
if (needs_offset && !has_offset) {
@@ -668,7 +668,7 @@
b.InsertBefore(builtin, [&] {
// Convert the coordinates to unsigned integers if necessary.
- if (coords->Type()->is_signed_integer_scalar_or_vector()) {
+ if (coords->Type()->IsSignedIntegerScalarOrVector()) {
coords = b.Convert(ty.match_width(ty.u32(), coords->Type()), coords)->Result(0);
}
@@ -709,7 +709,7 @@
if (IsTextureArray(tex_type->Dim())) {
const uint32_t kArrayIndex = 2;
auto* index_arg = builtin->Args()[kArrayIndex];
- if (index_arg->Type()->is_signed_integer_scalar()) {
+ if (index_arg->Type()->IsSignedIntegerScalar()) {
builtin->SetArg(kArrayIndex, b.Call(ty.i32(), core::BuiltinFn::kMax, index_arg,
b.Zero<i32>())
->Result(0));
@@ -854,7 +854,7 @@
// Resize the argument list as the gradient argument only takes up one argument.
// Move the offset argument back one place if present.
- const bool has_offset = args.Back()->Type()->is_signed_integer_vector();
+ const bool has_offset = args.Back()->Type()->IsSignedIntegerVector();
if (has_offset) {
args[args.Length() - 2] = args.Back();
}
@@ -911,7 +911,7 @@
b.InsertBefore(builtin, [&] {
// Convert the coordinates to unsigned integers if necessary.
- if (coords->Type()->is_signed_integer_scalar_or_vector()) {
+ if (coords->Type()->IsSignedIntegerScalarOrVector()) {
coords = b.Convert(ty.match_width(ty.u32(), coords->Type()), coords)->Result(0);
}
diff --git a/src/tint/lang/spirv/writer/printer/printer.cc b/src/tint/lang/spirv/writer/printer/printer.cc
index 3960266..043f427 100644
--- a/src/tint/lang/spirv/writer/printer/printer.cc
+++ b/src/tint/lang/spirv/writer/printer/printer.cc
@@ -1100,54 +1100,54 @@
spv::Op op = spv::Op::Max;
switch (binary->Op()) {
case core::BinaryOp::kAdd: {
- op = ty->is_integer_scalar_or_vector() ? spv::Op::OpIAdd : spv::Op::OpFAdd;
+ op = ty->IsIntegerScalarOrVector() ? spv::Op::OpIAdd : spv::Op::OpFAdd;
break;
}
case core::BinaryOp::kDivide: {
- if (ty->is_signed_integer_scalar_or_vector()) {
+ if (ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpSDiv;
- } else if (ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (ty->IsUnsignedIntegerScalarOrVector()) {
op = spv::Op::OpUDiv;
- } else if (ty->is_float_scalar_or_vector()) {
+ } else if (ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFDiv;
}
break;
}
case core::BinaryOp::kMultiply: {
- if (ty->is_integer_scalar_or_vector()) {
+ if (ty->IsIntegerScalarOrVector()) {
op = spv::Op::OpIMul;
- } else if (ty->is_float_scalar_or_vector()) {
+ } else if (ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFMul;
}
break;
}
case core::BinaryOp::kSubtract: {
- op = ty->is_integer_scalar_or_vector() ? spv::Op::OpISub : spv::Op::OpFSub;
+ op = ty->IsIntegerScalarOrVector() ? spv::Op::OpISub : spv::Op::OpFSub;
break;
}
case core::BinaryOp::kModulo: {
- if (ty->is_signed_integer_scalar_or_vector()) {
+ if (ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpSRem;
- } else if (ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (ty->IsUnsignedIntegerScalarOrVector()) {
op = spv::Op::OpUMod;
- } else if (ty->is_float_scalar_or_vector()) {
+ } else if (ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFRem;
}
break;
}
case core::BinaryOp::kAnd: {
- if (ty->is_integer_scalar_or_vector()) {
+ if (ty->IsIntegerScalarOrVector()) {
op = spv::Op::OpBitwiseAnd;
- } else if (ty->is_bool_scalar_or_vector()) {
+ } else if (ty->IsBoolScalarOrVector()) {
op = spv::Op::OpLogicalAnd;
}
break;
}
case core::BinaryOp::kOr: {
- if (ty->is_integer_scalar_or_vector()) {
+ if (ty->IsIntegerScalarOrVector()) {
op = spv::Op::OpBitwiseOr;
- } else if (ty->is_bool_scalar_or_vector()) {
+ } else if (ty->IsBoolScalarOrVector()) {
op = spv::Op::OpLogicalOr;
}
break;
@@ -1162,70 +1162,70 @@
break;
}
case core::BinaryOp::kShiftRight: {
- if (ty->is_signed_integer_scalar_or_vector()) {
+ if (ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpShiftRightArithmetic;
- } else if (ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (ty->IsUnsignedIntegerScalarOrVector()) {
op = spv::Op::OpShiftRightLogical;
}
break;
}
case core::BinaryOp::kEqual: {
- if (lhs_ty->is_bool_scalar_or_vector()) {
+ if (lhs_ty->IsBoolScalarOrVector()) {
op = spv::Op::OpLogicalEqual;
- } else if (lhs_ty->is_float_scalar_or_vector()) {
+ } else if (lhs_ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFOrdEqual;
- } else if (lhs_ty->is_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsIntegerScalarOrVector()) {
op = spv::Op::OpIEqual;
}
break;
}
case core::BinaryOp::kNotEqual: {
- if (lhs_ty->is_bool_scalar_or_vector()) {
+ if (lhs_ty->IsBoolScalarOrVector()) {
op = spv::Op::OpLogicalNotEqual;
- } else if (lhs_ty->is_float_scalar_or_vector()) {
+ } else if (lhs_ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFOrdNotEqual;
- } else if (lhs_ty->is_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsIntegerScalarOrVector()) {
op = spv::Op::OpINotEqual;
}
break;
}
case core::BinaryOp::kGreaterThan: {
- if (lhs_ty->is_float_scalar_or_vector()) {
+ if (lhs_ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFOrdGreaterThan;
- } else if (lhs_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpSGreaterThan;
- } else if (lhs_ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsUnsignedIntegerScalarOrVector()) {
op = spv::Op::OpUGreaterThan;
}
break;
}
case core::BinaryOp::kGreaterThanEqual: {
- if (lhs_ty->is_float_scalar_or_vector()) {
+ if (lhs_ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFOrdGreaterThanEqual;
- } else if (lhs_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpSGreaterThanEqual;
- } else if (lhs_ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsUnsignedIntegerScalarOrVector()) {
op = spv::Op::OpUGreaterThanEqual;
}
break;
}
case core::BinaryOp::kLessThan: {
- if (lhs_ty->is_float_scalar_or_vector()) {
+ if (lhs_ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFOrdLessThan;
- } else if (lhs_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpSLessThan;
- } else if (lhs_ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsUnsignedIntegerScalarOrVector()) {
op = spv::Op::OpULessThan;
}
break;
}
case core::BinaryOp::kLessThanEqual: {
- if (lhs_ty->is_float_scalar_or_vector()) {
+ if (lhs_ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFOrdLessThanEqual;
- } else if (lhs_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpSLessThanEqual;
- } else if (lhs_ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (lhs_ty->IsUnsignedIntegerScalarOrVector()) {
op = spv::Op::OpULessThanEqual;
}
break;
@@ -1390,7 +1390,7 @@
auto* result_ty = builtin->Result(0)->Type();
if (builtin->Func() == core::BuiltinFn::kAbs &&
- result_ty->is_unsigned_integer_scalar_or_vector()) {
+ result_ty->IsUnsignedIntegerScalarOrVector()) {
// abs() is a no-op for unsigned integers.
values_.Add(builtin->Result(0), Value(builtin->Args()[0]));
return;
@@ -1427,9 +1427,9 @@
// Determine the opcode.
switch (builtin->Func()) {
case core::BuiltinFn::kAbs:
- if (result_ty->is_float_scalar_or_vector()) {
+ if (result_ty->IsFloatScalarOrVector()) {
glsl_ext_inst(GLSLstd450FAbs);
- } else if (result_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (result_ty->IsSignedIntegerScalarOrVector()) {
glsl_ext_inst(GLSLstd450SAbs);
}
break;
@@ -1461,11 +1461,11 @@
glsl_ext_inst(GLSLstd450Atanh);
break;
case core::BuiltinFn::kClamp:
- if (result_ty->is_float_scalar_or_vector()) {
+ if (result_ty->IsFloatScalarOrVector()) {
glsl_ext_inst(GLSLstd450NClamp);
- } else if (result_ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (result_ty->IsUnsignedIntegerScalarOrVector()) {
glsl_ext_inst(GLSLstd450UClamp);
- } else if (result_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (result_ty->IsSignedIntegerScalarOrVector()) {
glsl_ext_inst(GLSLstd450SClamp);
}
break;
@@ -1522,8 +1522,8 @@
glsl_ext_inst(GLSLstd450Exp2);
break;
case core::BuiltinFn::kExtractBits:
- op = result_ty->is_signed_integer_scalar_or_vector() ? spv::Op::OpBitFieldSExtract
- : spv::Op::OpBitFieldUExtract;
+ op = result_ty->IsSignedIntegerScalarOrVector() ? spv::Op::OpBitFieldSExtract
+ : spv::Op::OpBitFieldUExtract;
break;
case core::BuiltinFn::kFaceForward:
glsl_ext_inst(GLSLstd450FaceForward);
@@ -1570,20 +1570,20 @@
glsl_ext_inst(GLSLstd450Log2);
break;
case core::BuiltinFn::kMax:
- if (result_ty->is_float_scalar_or_vector()) {
+ if (result_ty->IsFloatScalarOrVector()) {
glsl_ext_inst(GLSLstd450FMax);
- } else if (result_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (result_ty->IsSignedIntegerScalarOrVector()) {
glsl_ext_inst(GLSLstd450SMax);
- } else if (result_ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (result_ty->IsUnsignedIntegerScalarOrVector()) {
glsl_ext_inst(GLSLstd450UMax);
}
break;
case core::BuiltinFn::kMin:
- if (result_ty->is_float_scalar_or_vector()) {
+ if (result_ty->IsFloatScalarOrVector()) {
glsl_ext_inst(GLSLstd450FMin);
- } else if (result_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (result_ty->IsSignedIntegerScalarOrVector()) {
glsl_ext_inst(GLSLstd450SMin);
- } else if (result_ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (result_ty->IsUnsignedIntegerScalarOrVector()) {
glsl_ext_inst(GLSLstd450UMin);
}
break;
@@ -1662,9 +1662,9 @@
glsl_ext_inst(GLSLstd450RoundEven);
break;
case core::BuiltinFn::kSign:
- if (result_ty->is_float_scalar_or_vector()) {
+ if (result_ty->IsFloatScalarOrVector()) {
glsl_ext_inst(GLSLstd450FSign);
- } else if (result_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (result_ty->IsSignedIntegerScalarOrVector()) {
glsl_ext_inst(GLSLstd450SSign);
}
break;
@@ -1694,29 +1694,29 @@
break;
case core::BuiltinFn::kSubgroupAdd:
module_.PushCapability(SpvCapabilityGroupNonUniformArithmetic);
- op = result_ty->is_integer_scalar_or_vector() ? spv::Op::OpGroupNonUniformIAdd
- : spv::Op::OpGroupNonUniformFAdd;
+ op = result_ty->IsIntegerScalarOrVector() ? spv::Op::OpGroupNonUniformIAdd
+ : spv::Op::OpGroupNonUniformFAdd;
operands.push_back(Constant(ir_.constant_values.Get(u32(spv::Scope::Subgroup))));
operands.push_back(U32Operand(u32(spv::GroupOperation::Reduce)));
break;
case core::BuiltinFn::kSubgroupExclusiveAdd:
module_.PushCapability(SpvCapabilityGroupNonUniformArithmetic);
- op = result_ty->is_integer_scalar_or_vector() ? spv::Op::OpGroupNonUniformIAdd
- : spv::Op::OpGroupNonUniformFAdd;
+ op = result_ty->IsIntegerScalarOrVector() ? spv::Op::OpGroupNonUniformIAdd
+ : spv::Op::OpGroupNonUniformFAdd;
operands.push_back(Constant(ir_.constant_values.Get(u32(spv::Scope::Subgroup))));
operands.push_back(U32Operand(u32(spv::GroupOperation::ExclusiveScan)));
break;
case core::BuiltinFn::kSubgroupMul:
module_.PushCapability(SpvCapabilityGroupNonUniformArithmetic);
- op = result_ty->is_integer_scalar_or_vector() ? spv::Op::OpGroupNonUniformIMul
- : spv::Op::OpGroupNonUniformFMul;
+ op = result_ty->IsIntegerScalarOrVector() ? spv::Op::OpGroupNonUniformIMul
+ : spv::Op::OpGroupNonUniformFMul;
operands.push_back(Constant(ir_.constant_values.Get(u32(spv::Scope::Subgroup))));
operands.push_back(U32Operand(u32(spv::GroupOperation::Reduce)));
break;
case core::BuiltinFn::kSubgroupExclusiveMul:
module_.PushCapability(SpvCapabilityGroupNonUniformArithmetic);
- op = result_ty->is_integer_scalar_or_vector() ? spv::Op::OpGroupNonUniformIMul
- : spv::Op::OpGroupNonUniformFMul;
+ op = result_ty->IsIntegerScalarOrVector() ? spv::Op::OpGroupNonUniformIMul
+ : spv::Op::OpGroupNonUniformFMul;
operands.push_back(Constant(ir_.constant_values.Get(u32(spv::Scope::Subgroup))));
operands.push_back(U32Operand(u32(spv::GroupOperation::ExclusiveScan)));
break;
@@ -1780,12 +1780,12 @@
break;
case core::BuiltinFn::kSubgroupMin:
module_.PushCapability(SpvCapabilityGroupNonUniformArithmetic);
- if (result_ty->is_float_scalar_or_vector()) {
+ if (result_ty->IsFloatScalarOrVector()) {
op = spv::Op::OpGroupNonUniformFMin;
- } else if (result_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (result_ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpGroupNonUniformSMin;
} else {
- TINT_ASSERT(result_ty->is_unsigned_integer_scalar_or_vector());
+ TINT_ASSERT(result_ty->IsUnsignedIntegerScalarOrVector());
op = spv::Op::OpGroupNonUniformUMin;
}
operands.push_back(Constant(ir_.constant_values.Get(u32(spv::Scope::Subgroup))));
@@ -1793,12 +1793,12 @@
break;
case core::BuiltinFn::kSubgroupMax:
module_.PushCapability(SpvCapabilityGroupNonUniformArithmetic);
- if (result_ty->is_float_scalar_or_vector()) {
+ if (result_ty->IsFloatScalarOrVector()) {
op = spv::Op::OpGroupNonUniformFMax;
- } else if (result_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (result_ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpGroupNonUniformSMax;
} else {
- TINT_ASSERT(result_ty->is_unsigned_integer_scalar_or_vector());
+ TINT_ASSERT(result_ty->IsUnsignedIntegerScalarOrVector());
op = spv::Op::OpGroupNonUniformUMax;
}
operands.push_back(Constant(ir_.constant_values.Get(u32(spv::Scope::Subgroup))));
@@ -1913,31 +1913,28 @@
}
spv::Op op = spv::Op::Max;
- if (res_ty->is_signed_integer_scalar_or_vector() && arg_ty->is_float_scalar_or_vector()) {
+ if (res_ty->IsSignedIntegerScalarOrVector() && arg_ty->IsFloatScalarOrVector()) {
// float to signed int.
op = spv::Op::OpConvertFToS;
- } else if (res_ty->is_unsigned_integer_scalar_or_vector() &&
- arg_ty->is_float_scalar_or_vector()) {
+ } else if (res_ty->IsUnsignedIntegerScalarOrVector() && arg_ty->IsFloatScalarOrVector()) {
// float to unsigned int.
op = spv::Op::OpConvertFToU;
- } else if (res_ty->is_float_scalar_or_vector() &&
- arg_ty->is_signed_integer_scalar_or_vector()) {
+ } else if (res_ty->IsFloatScalarOrVector() && arg_ty->IsSignedIntegerScalarOrVector()) {
// signed int to float.
op = spv::Op::OpConvertSToF;
- } else if (res_ty->is_float_scalar_or_vector() &&
- arg_ty->is_unsigned_integer_scalar_or_vector()) {
+ } else if (res_ty->IsFloatScalarOrVector() && arg_ty->IsUnsignedIntegerScalarOrVector()) {
// unsigned int to float.
op = spv::Op::OpConvertUToF;
- } else if (res_ty->is_float_scalar_or_vector() && arg_ty->is_float_scalar_or_vector() &&
+ } else if (res_ty->IsFloatScalarOrVector() && arg_ty->IsFloatScalarOrVector() &&
res_ty->Size() != arg_ty->Size()) {
// float to float (different bitwidth).
op = spv::Op::OpFConvert;
- } else if (res_ty->is_integer_scalar_or_vector() && arg_ty->is_integer_scalar_or_vector() &&
+ } else if (res_ty->IsIntegerScalarOrVector() && arg_ty->IsIntegerScalarOrVector() &&
res_ty->Size() == arg_ty->Size()) {
// int to int (same bitwidth, different signedness).
op = spv::Op::OpBitcast;
- } else if (res_ty->is_bool_scalar_or_vector()) {
- if (arg_ty->is_integer_scalar_or_vector()) {
+ } else if (res_ty->IsBoolScalarOrVector()) {
+ if (arg_ty->IsIntegerScalarOrVector()) {
// int to bool.
op = spv::Op::OpINotEqual;
} else {
@@ -1945,7 +1942,7 @@
op = spv::Op::OpFUnordNotEqual;
}
operands.push_back(ConstantNull(arg_ty));
- } else if (arg_ty->is_bool_scalar_or_vector()) {
+ } else if (arg_ty->IsBoolScalarOrVector()) {
// Select between constant one and zero, splatting them to vectors if necessary.
core::ir::Constant* one = nullptr;
core::ir::Constant* zero = nullptr;
@@ -2145,9 +2142,9 @@
op = spv::Op::OpNot;
break;
case core::UnaryOp::kNegation:
- if (ty->is_float_scalar_or_vector()) {
+ if (ty->IsFloatScalarOrVector()) {
op = spv::Op::OpFNegate;
- } else if (ty->is_signed_integer_scalar_or_vector()) {
+ } else if (ty->IsSignedIntegerScalarOrVector()) {
op = spv::Op::OpSNegate;
}
break;
diff --git a/src/tint/lang/spirv/writer/raise/builtin_polyfill.cc b/src/tint/lang/spirv/writer/raise/builtin_polyfill.cc
index 5c778c0..5c1ccd4 100644
--- a/src/tint/lang/spirv/writer/raise/builtin_polyfill.cc
+++ b/src/tint/lang/spirv/writer/raise/builtin_polyfill.cc
@@ -291,7 +291,7 @@
call->AppendArg(builtin->Args()[1]);
break;
case core::BuiltinFn::kAtomicMax:
- if (result_ty->is_signed_integer_scalar()) {
+ if (result_ty->IsSignedIntegerScalar()) {
call = build(spirv::BuiltinFn::kAtomicSmax);
} else {
call = build(spirv::BuiltinFn::kAtomicUmax);
@@ -299,7 +299,7 @@
call->AppendArg(builtin->Args()[1]);
break;
case core::BuiltinFn::kAtomicMin:
- if (result_ty->is_signed_integer_scalar()) {
+ if (result_ty->IsSignedIntegerScalar()) {
call = build(spirv::BuiltinFn::kAtomicSmin);
} else {
call = build(spirv::BuiltinFn::kAtomicUmin);
@@ -331,7 +331,7 @@
void Dot(core::ir::CoreBuiltinCall* builtin) {
// OpDot only supports floating point operands, so we need to polyfill the integer case.
// TODO(crbug.com/tint/1267): If SPV_KHR_integer_dot_product is supported, use that instead.
- if (builtin->Result(0)->Type()->is_integer_scalar()) {
+ if (builtin->Result(0)->Type()->IsIntegerScalar()) {
core::ir::Instruction* sum = nullptr;
auto* v1 = builtin->Args()[0];
@@ -447,7 +447,7 @@
}
if (operands.lod) {
image_operand_mask |= SpvImageOperandsLodMask;
- if (requires_float_lod && operands.lod->Type()->is_integer_scalar()) {
+ if (requires_float_lod && operands.lod->Type()->IsIntegerScalar()) {
auto* convert = b.Convert(ty.f32(), operands.lod);
convert->InsertBefore(insertion_point);
operands.lod = convert->Result(0);
@@ -606,7 +606,7 @@
};
auto* component = next_arg();
- if (!component->Type()->is_integer_scalar()) {
+ if (!component->Type()->IsIntegerScalar()) {
// The first argument wasn't the component, so it must be the texture instead.
// Use constant zero for the component.
component = b.Constant(0_u);
@@ -906,7 +906,7 @@
auto* id = builtin->Args()[1];
// Id must be an unsigned integer scalar, so bitcast if necessary.
- if (id->Type()->is_signed_integer_scalar()) {
+ if (id->Type()->IsSignedIntegerScalar()) {
auto* cast = b.Bitcast(ty.u32(), id);
cast->InsertBefore(builtin);
builtin->SetArg(1, cast->Result(0));
@@ -921,7 +921,7 @@
TINT_ASSERT(id->Is<core::ir::Constant>());
// For const signed int IDs, compile-time convert to u32 to maintain constness.
- if (id->Type()->is_signed_integer_scalar()) {
+ if (id->Type()->IsSignedIntegerScalar()) {
builtin->SetArg(1, b.Constant(id->As<core::ir::Constant>()->Value()->ValueAs<u32>()));
}
}
@@ -934,7 +934,7 @@
TINT_ASSERT(id->Is<core::ir::Constant>());
// For const signed int IDs, compile-time convert to u32 to maintain constness.
- if (id->Type()->is_signed_integer_scalar()) {
+ if (id->Type()->IsSignedIntegerScalar()) {
builtin->SetArg(1, b.Constant(id->As<core::ir::Constant>()->Value()->ValueAs<u32>()));
}
}
diff --git a/src/tint/lang/spirv/writer/raise/expand_implicit_splats.cc b/src/tint/lang/spirv/writer/raise/expand_implicit_splats.cc
index c5359f2..2f4fdd7 100644
--- a/src/tint/lang/spirv/writer/raise/expand_implicit_splats.cc
+++ b/src/tint/lang/spirv/writer/raise/expand_implicit_splats.cc
@@ -105,7 +105,7 @@
/// @param binary the binary instruction to modify
void ExpandBinary(core::ir::Binary* binary) {
auto* result_ty = binary->Result(0)->Type();
- if (result_ty->is_float_vector() && binary->Op() == core::BinaryOp::kMultiply) {
+ if (result_ty->IsFloatVector() && binary->Op() == core::BinaryOp::kMultiply) {
// Use OpVectorTimesScalar for floating point multiply.
auto* vts = b.CallWithResult<spirv::ir::BuiltinCall>(
binary->DetachResult(), spirv::BuiltinFn::kVectorTimesScalar);
diff --git a/src/tint/lang/spirv/writer/raise/shader_io.cc b/src/tint/lang/spirv/writer/raise/shader_io.cc
index fde4aae..607044e 100644
--- a/src/tint/lang/spirv/writer/raise/shader_io.cc
+++ b/src/tint/lang/spirv/writer/raise/shader_io.cc
@@ -99,8 +99,7 @@
// Vulkan requires that fragment integer builtin inputs be Flat decorated.
if (func->Stage() == core::ir::Function::PipelineStage::kFragment &&
- addrspace == core::AddressSpace::kIn &&
- io.type->is_integer_scalar_or_vector()) {
+ addrspace == core::AddressSpace::kIn && io.type->IsIntegerScalarOrVector()) {
io.attributes.interpolation = {core::InterpolationType::kFlat};
}
}
diff --git a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc
index 18b9347..0891c85 100644
--- a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc
+++ b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc
@@ -88,7 +88,7 @@
case core::BinaryOp::kDivide: {
if (cfg.builtins.int_div_mod) {
auto* lhs_ty = src.TypeOf(bin_op->lhs)->UnwrapRef();
- if (lhs_ty->is_integer_scalar_or_vector()) {
+ if (lhs_ty->IsIntegerScalarOrVector()) {
ctx.Replace(bin_op,
[this, bin_op] { return IntDivMod(bin_op); });
made_changes = true;
@@ -99,7 +99,7 @@
case core::BinaryOp::kModulo: {
if (cfg.builtins.int_div_mod) {
auto* lhs_ty = src.TypeOf(bin_op->lhs)->UnwrapRef();
- if (lhs_ty->is_integer_scalar_or_vector()) {
+ if (lhs_ty->IsIntegerScalarOrVector()) {
ctx.Replace(bin_op,
[this, bin_op] { return IntDivMod(bin_op); });
made_changes = true;
@@ -107,7 +107,7 @@
}
if (cfg.builtins.precise_float_mod) {
auto* lhs_ty = src.TypeOf(bin_op->lhs)->UnwrapRef();
- if (lhs_ty->is_float_scalar_or_vector()) {
+ if (lhs_ty->IsFloatScalarOrVector()) {
ctx.Replace(bin_op,
[this, bin_op] { return PreciseFloatMod(bin_op); });
made_changes = true;
@@ -477,7 +477,7 @@
};
const Expression* x = nullptr;
- if (ty->is_unsigned_integer_scalar_or_vector()) {
+ if (ty->IsUnsignedIntegerScalarOrVector()) {
x = b.Expr("v");
} else {
// If ty is signed, then the value is inverted if the sign is negative
@@ -622,7 +622,7 @@
auto V = [&](auto value) -> const Expression* {
const Expression* expr = b.Expr(value);
- if (!ty->is_unsigned_integer_scalar_or_vector()) {
+ if (!ty->IsUnsignedIntegerScalarOrVector()) {
expr = b.Call<i32>(expr);
}
if (ty->Is<core::type::Vector>()) {
@@ -855,7 +855,7 @@
AFloat high_condition;
AInt high_limit;
};
- const bool is_signed = target->is_signed_integer_scalar_or_vector();
+ const bool is_signed = target->IsSignedIntegerScalarOrVector();
const Limits limits = is_signed ? Limits{
/* low_condition */ -AFloat(0x80000000),
/* low_limit */ -AInt(0x80000000),
@@ -1160,7 +1160,7 @@
auto* rhs_is_zero = b.Equal(rhs, ScalarOrVector(width, 0_a));
- if (lhs_ty->is_signed_integer_scalar_or_vector()) {
+ if (lhs_ty->IsSignedIntegerScalarOrVector()) {
const auto bits = lhs_el_ty->Size() * 8;
auto min_int = AInt(AInt::kLowestValue >> (AInt::kNumBits - bits));
const Expression* lhs_is_min = b.Equal(lhs, ScalarOrVector(width, min_int));
@@ -1331,7 +1331,7 @@
case wgsl::BuiltinFn::kClamp:
if (cfg.builtins.clamp_int) {
auto& sig = builtin->Signature();
- if (sig.parameters[0]->Type()->is_integer_scalar_or_vector()) {
+ if (sig.parameters[0]->Type()->IsIntegerScalarOrVector()) {
return builtin_polyfills.GetOrAdd(
builtin, [&] { return clampInteger(builtin->ReturnType()); });
}
@@ -1410,7 +1410,7 @@
case wgsl::BuiltinFn::kSign:
if (cfg.builtins.sign_int) {
auto* ty = builtin->ReturnType();
- if (ty->is_signed_integer_scalar_or_vector()) {
+ if (ty->IsSignedIntegerScalarOrVector()) {
return builtin_polyfills.GetOrAdd(builtin,
[&] { return sign_int(ty); });
}
diff --git a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
index eec3c26..c9361e9 100644
--- a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
+++ b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
@@ -309,7 +309,7 @@
// TODO(crbug.com/tint/1224): Remove this once a flat interpolation attribute is
// required for integers.
if (func_ast->PipelineStage() == PipelineStage::kFragment &&
- type->is_integer_scalar_or_vector() && !HasAttribute<InterpolateAttribute>(attrs) &&
+ type->IsIntegerScalarOrVector() && !HasAttribute<InterpolateAttribute>(attrs) &&
(HasAttribute<LocationAttribute>(attrs) ||
cfg.shader_style == ShaderStyle::kSpirv)) {
attrs.Push(b.Interpolate(core::InterpolationType::kFlat,
@@ -403,7 +403,7 @@
// for integers.
if (cfg.shader_style == ShaderStyle::kSpirv &&
func_ast->PipelineStage() == PipelineStage::kVertex &&
- type->is_integer_scalar_or_vector() && HasAttribute<LocationAttribute>(attrs) &&
+ type->IsIntegerScalarOrVector() && HasAttribute<LocationAttribute>(attrs) &&
!HasAttribute<InterpolateAttribute>(attrs)) {
attrs.Push(b.Interpolate(core::InterpolationType::kFlat,
core::InterpolationSampling::kUndefined));
diff --git a/src/tint/lang/wgsl/ast/transform/fold_constants.cc b/src/tint/lang/wgsl/ast/transform/fold_constants.cc
index 6eeb7d8..afce608 100644
--- a/src/tint/lang/wgsl/ast/transform/fold_constants.cc
+++ b/src/tint/lang/wgsl/ast/transform/fold_constants.cc
@@ -102,9 +102,8 @@
return nullptr;
}
- if (cv->Type()->HoldsAbstract() && !cv->Type()->is_float_scalar() &&
- !cv->Type()->is_signed_integer_scalar() &&
- !cv->Type()->is_unsigned_integer_scalar()) {
+ if (cv->Type()->HoldsAbstract() && !cv->Type()->IsFloatScalar() &&
+ !cv->Type()->IsSignedIntegerScalar() && !cv->Type()->IsUnsignedIntegerScalar()) {
return nullptr;
}
diff --git a/src/tint/lang/wgsl/ast/transform/robustness.cc b/src/tint/lang/wgsl/ast/transform/robustness.cc
index 89f5b0a..514c8b9 100644
--- a/src/tint/lang/wgsl/ast/transform/robustness.cc
+++ b/src/tint/lang/wgsl/ast/transform/robustness.cc
@@ -416,7 +416,7 @@
Symbol level_idx, num_levels;
if (level_arg_idx >= 0) {
auto* param = builtin->Parameters()[static_cast<size_t>(level_arg_idx)];
- if (param->Type()->is_integer_scalar()) {
+ if (param->Type()->IsIntegerScalar()) {
// let level_idx = u32(level-arg);
level_idx = b.Symbols().New("level_idx");
auto* arg = expr->args[static_cast<size_t>(level_arg_idx)];
@@ -440,7 +440,7 @@
Symbol coords;
if (coords_arg_idx >= 0) {
auto* param = builtin->Parameters()[static_cast<size_t>(coords_arg_idx)];
- if (param->Type()->is_integer_scalar_or_vector()) {
+ if (param->Type()->IsIntegerScalarOrVector()) {
// let coords = u32(coords-arg)
coords = b.Symbols().New("coords");
auto* arg = expr->args[static_cast<size_t>(coords_arg_idx)];
@@ -507,7 +507,7 @@
Symbol level_idx;
if (level_arg_idx >= 0) {
const auto* param = builtin->Parameters()[static_cast<size_t>(level_arg_idx)];
- if (param->Type()->is_integer_scalar()) {
+ if (param->Type()->IsIntegerScalar()) {
const auto* arg = expr->args[static_cast<size_t>(level_arg_idx)];
level_idx = b.Symbols().New("level_idx");
const auto* num_levels =
@@ -523,7 +523,7 @@
// Clamp the coordinates argument
if (coords_arg_idx >= 0) {
const auto* param = builtin->Parameters()[static_cast<size_t>(coords_arg_idx)];
- if (param->Type()->is_integer_scalar_or_vector()) {
+ if (param->Type()->IsIntegerScalarOrVector()) {
auto* arg = expr->args[static_cast<size_t>(coords_arg_idx)];
const auto width = WidthOf(param->Type());
const auto* dimensions =
@@ -534,7 +534,7 @@
// dimensions is u32 or vecN<u32>
const auto* unsigned_max = b.Sub(dimensions, ScalarOrVec(b.Expr(1_a), width));
- if (param->Type()->is_signed_integer_scalar_or_vector()) {
+ if (param->Type()->IsSignedIntegerScalarOrVector()) {
const auto* zero = ScalarOrVec(b.Expr(0_a), width);
const auto* signed_max = CastToSigned(unsigned_max, width);
ctx.Replace(arg,
@@ -552,7 +552,7 @@
auto* num_layers = b.Call(wgsl::BuiltinFn::kTextureNumLayers, ctx.Clone(texture_arg));
const auto* unsigned_max = b.Sub(num_layers, 1_a);
- if (param->Type()->is_signed_integer_scalar()) {
+ if (param->Type()->IsSignedIntegerScalar()) {
const auto* signed_max = CastToSigned(unsigned_max, 1u);
ctx.Replace(arg, b.Call(wgsl::BuiltinFn::kClamp, ctx.Clone(arg), 0_a, signed_max));
} else {
@@ -714,7 +714,7 @@
/// expr->Declaration() cast to u32.
const ast::Expression* CastToU32(const sem::ValueExpression* expr) {
auto* idx = ctx.Clone(expr->Declaration());
- if (expr->Type()->is_unsigned_integer_scalar()) {
+ if (expr->Type()->IsUnsignedIntegerScalar()) {
return idx;
}
return b.Call<u32>(idx); // u32(idx)
diff --git a/src/tint/lang/wgsl/inspector/inspector.cc b/src/tint/lang/wgsl/inspector/inspector.cc
index 1af4333..f3c68ee 100644
--- a/src/tint/lang/wgsl/inspector/inspector.cc
+++ b/src/tint/lang/wgsl/inspector/inspector.cc
@@ -95,7 +95,7 @@
std::tuple<ComponentType, CompositionType> CalculateComponentAndComposition(
const core::type::Type* type) {
// entry point in/out variables must of numeric scalar or vector types.
- TINT_ASSERT(type->is_numeric_scalar_or_vector());
+ TINT_ASSERT(type->IsNumericScalarOrVector());
ComponentType componentType = Switch(
type->DeepestElement(), //
@@ -221,17 +221,17 @@
override.id = override_id.value();
auto* type = var->Type();
TINT_ASSERT(type->Is<core::type::Scalar>());
- if (type->is_bool_scalar_or_vector()) {
+ if (type->IsBoolScalarOrVector()) {
override.type = Override::Type::kBool;
- } else if (type->is_float_scalar()) {
+ } else if (type->IsFloatScalar()) {
if (type->Is<core::type::F16>()) {
override.type = Override::Type::kFloat16;
} else {
override.type = Override::Type::kFloat32;
}
- } else if (type->is_signed_integer_scalar()) {
+ } else if (type->IsSignedIntegerScalar()) {
override.type = Override::Type::kInt32;
- } else if (type->is_unsigned_integer_scalar()) {
+ } else if (type->IsUnsignedIntegerScalar()) {
override.type = Override::Type::kUint32;
} else {
TINT_UNREACHABLE();
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
index 129bba3..47644a7 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
@@ -423,7 +423,7 @@
void EmitIncrementDecrement(const ast::IncrementDecrementStatement* stmt) {
auto lhs = EmitExpression(stmt->lhs);
- auto* one = program_.TypeOf(stmt->lhs)->UnwrapRef()->is_signed_integer_scalar()
+ auto* one = program_.TypeOf(stmt->lhs)->UnwrapRef()->IsSignedIntegerScalar()
? builder_.Constant(1_i)
: builder_.Constant(1_u);
diff --git a/src/tint/lang/wgsl/resolver/builtin_test.cc b/src/tint/lang/wgsl/resolver/builtin_test.cc
index e5dd078..e3225a7 100644
--- a/src/tint/lang/wgsl/resolver/builtin_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtin_test.cc
@@ -367,7 +367,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F32>());
@@ -412,7 +412,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F32>());
@@ -458,7 +458,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F32>());
@@ -505,7 +505,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F32>());
@@ -563,7 +563,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F16>());
@@ -612,7 +612,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F16>());
@@ -662,7 +662,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F16>());
@@ -713,7 +713,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F16>());
@@ -790,7 +790,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F32>());
}
@@ -804,7 +804,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F16>());
}
@@ -1218,7 +1218,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F32>());
@@ -1233,7 +1233,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F16>());
@@ -1450,7 +1450,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F32>());
}
@@ -1464,7 +1464,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::F16>());
}
@@ -1549,7 +1549,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector());
+ EXPECT_TRUE(TypeOf(call)->IsSignedIntegerVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::I32>());
@@ -1594,7 +1594,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector());
+ EXPECT_TRUE(TypeOf(call)->IsUnsignedIntegerVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::U32>());
@@ -1639,7 +1639,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector());
+ EXPECT_TRUE(TypeOf(call)->IsSignedIntegerVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::I32>());
@@ -1684,7 +1684,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector());
+ EXPECT_TRUE(TypeOf(call)->IsUnsignedIntegerVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::U32>());
@@ -1730,7 +1730,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector());
+ EXPECT_TRUE(TypeOf(call)->IsSignedIntegerVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::I32>());
@@ -1777,7 +1777,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector());
+ EXPECT_TRUE(TypeOf(call)->IsUnsignedIntegerVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::U32>());
@@ -1824,7 +1824,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_signed_integer_vector());
+ EXPECT_TRUE(TypeOf(call)->IsSignedIntegerVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::I32>());
@@ -1871,7 +1871,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_unsigned_integer_vector());
+ EXPECT_TRUE(TypeOf(call)->IsUnsignedIntegerVector());
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 3u);
ASSERT_NE(TypeOf(call)->As<core::type::Vector>()->Type(), nullptr);
EXPECT_TRUE(TypeOf(call)->As<core::type::Vector>()->Type()->Is<core::type::U32>());
@@ -2725,7 +2725,7 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
ASSERT_NE(TypeOf(call), nullptr);
- EXPECT_TRUE(TypeOf(call)->is_float_vector());
+ EXPECT_TRUE(TypeOf(call)->IsFloatVector());
if (pack4) {
EXPECT_EQ(TypeOf(call)->As<core::type::Vector>()->Width(), 4u);
} else {
diff --git a/src/tint/lang/wgsl/resolver/builtins_validation_test.cc b/src/tint/lang/wgsl/resolver/builtins_validation_test.cc
index a04c046..5d46e0a 100644
--- a/src/tint/lang/wgsl/resolver/builtins_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtins_validation_test.cc
@@ -1162,7 +1162,7 @@
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_float_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsFloatVector());
}
TEST_P(FloatAllMatching, Vec3) {
@@ -1183,7 +1183,7 @@
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_float_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsFloatVector());
}
TEST_P(FloatAllMatching, Vec4) {
@@ -1204,7 +1204,7 @@
});
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_float_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsFloatVector());
}
INSTANTIATE_TEST_SUITE_P(ResolverBuiltinsValidationTest,
@@ -1280,7 +1280,7 @@
WrapInFunction(builtin);
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_unsigned_integer_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsUnsignedIntegerVector());
}
TEST_P(IntegerAllMatching, Vec3Unsigned) {
@@ -1295,7 +1295,7 @@
WrapInFunction(builtin);
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_unsigned_integer_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsUnsignedIntegerVector());
}
TEST_P(IntegerAllMatching, Vec4Unsigned) {
@@ -1310,7 +1310,7 @@
WrapInFunction(builtin);
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_unsigned_integer_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsUnsignedIntegerVector());
}
TEST_P(IntegerAllMatching, ScalarSigned) {
@@ -1340,7 +1340,7 @@
WrapInFunction(builtin);
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_signed_integer_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsSignedIntegerVector());
}
TEST_P(IntegerAllMatching, Vec3Signed) {
@@ -1355,7 +1355,7 @@
WrapInFunction(builtin);
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_signed_integer_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsSignedIntegerVector());
}
TEST_P(IntegerAllMatching, Vec4Signed) {
@@ -1370,7 +1370,7 @@
WrapInFunction(builtin);
EXPECT_TRUE(r()->Resolve()) << r()->error();
- EXPECT_TRUE(TypeOf(builtin)->is_signed_integer_vector());
+ EXPECT_TRUE(TypeOf(builtin)->IsSignedIntegerVector());
}
INSTANTIATE_TEST_SUITE_P(ResolverBuiltinsValidationTest,
diff --git a/src/tint/lang/wgsl/resolver/resolver.cc b/src/tint/lang/wgsl/resolver/resolver.cc
index 5d5d73d..8903fe0 100644
--- a/src/tint/lang/wgsl/resolver/resolver.cc
+++ b/src/tint/lang/wgsl/resolver/resolver.cc
@@ -575,7 +575,7 @@
// No declared address space. Infer from usage / type.
if (!is_global) {
sem->SetAddressSpace(core::AddressSpace::kFunction);
- } else if (storage_ty->UnwrapRef()->is_handle()) {
+ } else if (storage_ty->UnwrapRef()->IsHandle()) {
// https://gpuweb.github.io/gpuweb/wgsl/#module-scope-variables
// If the store type is a texture type or a sampler type, then the
// variable declaration must not have a address space attribute. The
@@ -3740,7 +3740,7 @@
switch (unary->op) {
case core::UnaryOp::kAddressOf:
if (auto* ref = expr_ty->As<core::type::Reference>()) {
- if (ref->StoreType()->UnwrapRef()->is_handle()) {
+ if (ref->StoreType()->UnwrapRef()->IsHandle()) {
AddError(unary->expr->source)
<< "cannot take the address of " << sem_.Describe(expr)
<< " in handle address space";
@@ -4192,7 +4192,7 @@
case core::EvaluationStage::kConstant: {
auto* count_val = count_sem->ConstantValue();
- if (auto* ty = count_val->Type(); !ty->is_integer_scalar()) {
+ if (auto* ty = count_val->Type(); !ty->IsIntegerScalar()) {
AddError(count_expr->source)
<< "array count must evaluate to a constant integer expression, but is type "
<< style::Type(ty->FriendlyName());
@@ -4696,7 +4696,7 @@
}
}
auto* common_ty = core::type::Type::Common(types);
- if (!common_ty || !common_ty->is_integer_scalar()) {
+ if (!common_ty || !common_ty->IsIntegerScalar()) {
// No common type found or the common type was abstract.
// Pick i32 and let validation deal with any mismatches.
common_ty = b.create<core::type::I32>();
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc
index 28bd6a3..47a1939 100644
--- a/src/tint/lang/wgsl/resolver/validator.cc
+++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -755,7 +755,7 @@
return false;
}
- if (!var->declared_address_space && !global->Type()->UnwrapRef()->is_handle()) {
+ if (!var->declared_address_space && !global->Type()->UnwrapRef()->IsHandle()) {
AddError(decl->source) << "module-scope " << style::Keyword("var")
<< " declarations that are not of texture or sampler types "
"must provide an address space";
@@ -833,7 +833,7 @@
return false;
}
- if (store_ty->is_handle() && var->declared_address_space) {
+ if (store_ty->IsHandle() && var->declared_address_space) {
// https://gpuweb.github.io/gpuweb/wgsl/#module-scope-variables
// If the store type is a texture type or a sampler type, then the variable declaration must
// not have a address space attribute. The address space will always be handle.
@@ -1018,7 +1018,7 @@
!(stage == ast::PipelineStage::kCompute && is_input)) {
is_stage_mismatch = true;
}
- if (!(type->is_unsigned_integer_vector() &&
+ if (!(type->IsUnsignedIntegerVector() &&
type->As<core::type::Vector>()->Width() == 3)) {
err_builtin_type("vec3<u32>");
return false;
@@ -1175,7 +1175,7 @@
return false;
}
- if (type->is_integer_scalar_or_vector() && i_type != core::InterpolationType::kFlat) {
+ if (type->IsIntegerScalarOrVector() && i_type != core::InterpolationType::kFlat) {
AddError(attr->source) << "interpolation type must be " << style::Enum("flat")
<< " for integral user-defined IO types";
return false;
@@ -1459,7 +1459,7 @@
}
if (pipeline_io_attribute && pipeline_io_attribute->Is<ast::LocationAttribute>()) {
- if (ty->is_integer_scalar_or_vector() && !interpolate_attribute) {
+ if (ty->IsIntegerScalarOrVector() && !interpolate_attribute) {
if (decl->PipelineStage() == ast::PipelineStage::kVertex &&
param_or_ret == ParamOrRetType::kReturnType) {
AddError(source)
@@ -1733,7 +1733,7 @@
// Integer division by zero should be checked for the partial evaluation case (only rhs
// is const). FP division by zero is only invalid when the whole expression is
// constant-evaluated.
- if (rhs->Type()->is_integer_scalar_or_vector() &&
+ if (rhs->Type()->IsIntegerScalarOrVector() &&
rhs->Stage() == core::EvaluationStage::kConstant) {
if (rhs->ConstantValue()->AnyZero()) {
AddError(node->source) << "integer division by zero is invalid";
@@ -2028,7 +2028,7 @@
return false;
}
- if (id->Type()->is_signed_integer_scalar() && constant_value->ValueAs<i32>() < 0) {
+ if (id->Type()->IsSignedIntegerScalar() && constant_value->ValueAs<i32>() < 0) {
AddError(id->Declaration()->source) << "the sourceLaneIndex argument of subgroupBroadcast "
"must be greater than or equal to zero";
return false;
@@ -2053,7 +2053,7 @@
return false;
}
- if (id->Type()->is_signed_integer_scalar() && constant_value->ValueAs<i32>() < 0) {
+ if (id->Type()->IsSignedIntegerScalar() && constant_value->ValueAs<i32>() < 0) {
AddError(id->Declaration()->source)
<< "the id argument of quadBroadcast must be greater than or equal to zero";
return false;
@@ -2287,7 +2287,7 @@
}
bool Validator::Matrix(const core::type::Type* el_ty, const Source& source) const {
- if (!el_ty->is_float_scalar()) {
+ if (!el_ty->IsFloatScalar()) {
AddError(source) << "matrix element type must be " << style::Type("f32") << " or "
<< style::Type("f16");
return false;
@@ -2662,7 +2662,7 @@
return false;
}
- if (!type->is_numeric_scalar_or_vector()) {
+ if (!type->IsNumericScalarOrVector()) {
std::string invalid_type = sem_.TypeNameOf(type);
AddError(source) << "cannot apply " << style::Attribute("@location")
<< " to declaration of type " << style::Type(invalid_type);
@@ -2696,7 +2696,7 @@
return false;
}
- if (!type->is_numeric_scalar_or_vector()) {
+ if (!type->IsNumericScalarOrVector()) {
std::string invalid_type = sem_.TypeNameOf(type);
AddError(source) << "cannot apply " << style::Attribute("@color")
<< " to declaration of type " << style::Type(invalid_type);
@@ -2764,7 +2764,7 @@
}
auto* cond_ty = sem_.TypeOf(s->condition);
- if (!cond_ty->is_integer_scalar()) {
+ if (!cond_ty->IsIntegerScalar()) {
AddError(s->condition->source)
<< "switch statement selector expression must be of a scalar integer type";
return false;
@@ -2954,7 +2954,7 @@
return false;
}
- if (!lhs_ref->StoreType()->is_integer_scalar()) {
+ if (!lhs_ref->StoreType()->IsIntegerScalar()) {
const std::string kind = inc->increment ? "increment" : "decrement";
AddError(lhs->source) << kind << " statement can only be applied to an integer scalar";
return false;