mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 18:59:21 +00:00
Implement mixed vector-scalar float % operator
W3C consensus on https://github.com/gpuweb/gpuweb/issues/2450 Spec change: https://github.com/gpuweb/gpuweb/pull/2495 Bug: tint:1370 Change-Id: I85bb9c802b0355bc53aa8dbacca8427fb7be1ff6 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84880 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
3b671cb377
commit
9e5484264a
@@ -1901,23 +1901,13 @@ sem::Expression* Resolver::Binary(const ast::BinaryExpression* expr) {
|
||||
}
|
||||
|
||||
// Binary arithmetic expressions with mixed scalar and vector operands
|
||||
if (lhs_vec_elem_type && (lhs_vec_elem_type == rhs_ty)) {
|
||||
if (expr->IsModulo()) {
|
||||
if (rhs_ty->is_integer_scalar()) {
|
||||
return build(lhs_ty);
|
||||
}
|
||||
} else if (rhs_ty->is_numeric_scalar()) {
|
||||
return build(lhs_ty);
|
||||
}
|
||||
if (lhs_vec_elem_type && (lhs_vec_elem_type == rhs_ty) &&
|
||||
rhs_ty->is_numeric_scalar()) {
|
||||
return build(lhs_ty);
|
||||
}
|
||||
if (rhs_vec_elem_type && (rhs_vec_elem_type == lhs_ty)) {
|
||||
if (expr->IsModulo()) {
|
||||
if (lhs_ty->is_integer_scalar()) {
|
||||
return build(rhs_ty);
|
||||
}
|
||||
} else if (lhs_ty->is_numeric_scalar()) {
|
||||
return build(rhs_ty);
|
||||
}
|
||||
if (rhs_vec_elem_type && (rhs_vec_elem_type == lhs_ty) &&
|
||||
lhs_ty->is_numeric_scalar()) {
|
||||
return build(rhs_ty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1367,15 +1367,13 @@ static constexpr Params all_valid_cases[] = {
|
||||
ParamsFor<vec3<f32>, f32, vec3<f32>>(Op::kSubtract),
|
||||
ParamsFor<vec3<f32>, f32, vec3<f32>>(Op::kMultiply),
|
||||
ParamsFor<vec3<f32>, f32, vec3<f32>>(Op::kDivide),
|
||||
// NOTE: no kModulo for vec3<f32>, f32
|
||||
// ParamsFor<vec3<f32>, f32, vec3<f32>>(Op::kModulo),
|
||||
ParamsFor<vec3<f32>, f32, vec3<f32>>(Op::kModulo),
|
||||
|
||||
ParamsFor<f32, vec3<f32>, vec3<f32>>(Op::kAdd),
|
||||
ParamsFor<f32, vec3<f32>, vec3<f32>>(Op::kSubtract),
|
||||
ParamsFor<f32, vec3<f32>, vec3<f32>>(Op::kMultiply),
|
||||
ParamsFor<f32, vec3<f32>, vec3<f32>>(Op::kDivide),
|
||||
// NOTE: no kModulo for f32, vec3<f32>
|
||||
// ParamsFor<f32, vec3<f32>, vec3<f32>>(Op::kModulo),
|
||||
ParamsFor<f32, vec3<f32>, vec3<f32>>(Op::kModulo),
|
||||
|
||||
// Matrix arithmetic
|
||||
ParamsFor<mat2x3<f32>, f32, mat2x3<f32>>(Op::kMultiply),
|
||||
|
||||
Reference in New Issue
Block a user