Skip to content

Commit

Permalink
fix(const_eval): don't panic when a vecN constructor's arg. count i…
Browse files Browse the repository at this point in the history
…s less than N (#6508)
  • Loading branch information
ErichDonGubler authored Nov 12, 2024
1 parent cffc793 commit 5e68a63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Bottom level categories:
#### Naga

- Fix crash when a texture argument is missing. By @aedm in [#6486](https://github.com/gfx-rs/wgpu/pull/6486)
- Emit an error in constant evaluation, rather than crash, in certain cases where `vecN` constructors have less than N arguments. By @ErichDonGubler in [#6508](https://github.com/gfx-rs/wgpu/pull/6508).

#### General

Expand Down
4 changes: 2 additions & 2 deletions naga/src/proc/constant_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ macro_rules! gen_component_wise_extractor {
for idx in 0..(size as u8).into() {
let group = component_groups
.iter()
.map(|cs| cs[idx])
.collect::<ArrayVec<_, N>>()
.map(|cs| cs.get(idx).cloned().ok_or(err.clone()))
.collect::<Result<ArrayVec<_, N>, _>>()?
.into_inner()
.unwrap();
new_components.push($ident(
Expand Down

0 comments on commit 5e68a63

Please sign in to comment.