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

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
This commit is contained in:
bernhl 2025-04-16 17:24:32 +02:00 committed by GitHub
parent 09178f2400
commit 06ee718ddd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

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

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(),

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>