Skip to content

Commit

Permalink
Print requested and supported usages on UnsupportedUsage error (#6007)
Browse files Browse the repository at this point in the history
* Print requested and supported usages on UnsupportedUsage error

* fmt

* changelog
  • Loading branch information
VladasZ authored Jul 22, 2024
1 parent c0e7c1e commit 5a0e218
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Bottom level categories:
- Fix profiling with `tracy`. By @waywardmonkeys in [#5988](https://github.com/gfx-rs/wgpu/pull/5988)
- As a workaround for [issue #4905](https://github.com/gfx-rs/wgpu/issues/4905), `wgpu-core` is undocumented unless `--cfg wgpu_core_doc` feature is enabled. By @kpreid in [#5987](https://github.com/gfx-rs/wgpu/pull/5987)
- Bump MSRV for `d3d12`/`naga`/`wgpu-core`/`wgpu-hal`/`wgpu-types`' to 1.76. By @wumpf in [#6003](https://github.com/gfx-rs/wgpu/pull/6003)
- Print requested and supported usages on `UnsupportedUsage` error. By @VladasZ in [#6007](https://github.com/gfx-rs/wgpu/pull/6007)

## 22.0.0 (2024-07-17)

Expand Down
5 changes: 4 additions & 1 deletion wgpu-core/src/device/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,10 @@ impl Global {
config.composite_alpha_mode = new_alpha_mode;
}
if !caps.usage.contains(config.usage) {
return Err(E::UnsupportedUsage);
return Err(E::UnsupportedUsage {
requested: config.usage,
available: caps.usage,
});
}
if width == 0 || height == 0 {
return Err(E::ZeroArea);
Expand Down
7 changes: 5 additions & 2 deletions wgpu-core/src/present.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ pub enum ConfigureSurfaceError {
requested: wgt::CompositeAlphaMode,
available: Vec<wgt::CompositeAlphaMode>,
},
#[error("Requested usage is not supported")]
UnsupportedUsage,
#[error("Requested usage {requested:?} is not in the list of supported usages: {available:?}")]
UnsupportedUsage {
requested: hal::TextureUses,
available: hal::TextureUses,
},
#[error("Gpu got stuck :(")]
StuckGpu,
}
Expand Down

0 comments on commit 5a0e218

Please sign in to comment.