[naga] Allow Scalar for MathFunction::Distance (#7530)

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
This commit is contained in:
bernhlandErich Gubler authored and GitHub committed 2025-04-16 08:24:32 -07:00
1 parent 09178f2400
commit 06ee718ddd
3 files changed
+12 -1

No files matched your search

+6
View File
@@ -58,6 +58,12 @@ Naga now infers the correct binding layout when a resource appears only in an as
- Removed `MaintainBase` in favor of using `PollType`. By @waywardmonkeys in [#7508](https://github.com/gfx-rs/wgpu/pull/7508).
### Bug Fixes
#### Naga
- Allow scalars as the first argument of the `distance` built-in function. By @bernhl in [#7530](https://github.com/gfx-rs/wgpu/pull/7530).
## v25.0.1 (2025-04-11)
### Bug Fixes
+3 -1
View File
@@ -92,7 +92,9 @@ impl ir::MathFunction {
Mf::Ldexp => ldexp().into(),
Mf::Outer => outer().into(),
Mf::Cross => regular!(2, VEC3 of FLOAT).into(),
Mf::Distance => regular!(2, VECN of FLOAT_ABSTRACT_UNIMPLEMENTED -> Scalar).into(),
Mf::Distance => {
regular!(2, SCALAR|VECN of FLOAT_ABSTRACT_UNIMPLEMENTED -> Scalar).into()
}
Mf::Length => regular!(1, SCALAR|VECN of FLOAT_ABSTRACT_UNIMPLEMENTED -> Scalar).into(),
Mf::Normalize => regular!(1, VECN of FLOAT_ABSTRACT_UNIMPLEMENTED).into(),
Mf::FaceForward => regular!(3, VECN of FLOAT_ABSTRACT_UNIMPLEMENTED).into(),
+3
View File
@@ -3419,6 +3419,9 @@ fn too_many_arguments_2() {
│ ^^^^^^^^ ^^ argument #2 has type `i32`
│
= note: `distance` accepts the following types for argument #2:
= note: allowed type: f32
= note: allowed type: f16
= note: allowed type: f64
= note: allowed type: vec2<f32>
= note: allowed type: vec2<f16>
= note: allowed type: vec2<f64>