Skip to content

Commit 5a0e218

Browse files
authored
Print requested and supported usages on UnsupportedUsage error (#6007)
* Print requested and supported usages on UnsupportedUsage error * fmt * changelog
1 parent c0e7c1e commit 5a0e218

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Bottom level categories:
4646
- Fix profiling with `tracy`. By @waywardmonkeys in [#5988](https://github.com/gfx-rs/wgpu/pull/5988)
4747
- 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)
4848
- 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)
49+
- Print requested and supported usages on `UnsupportedUsage` error. By @VladasZ in [#6007](https://github.com/gfx-rs/wgpu/pull/6007)
4950

5051
## 22.0.0 (2024-07-17)
5152

wgpu-core/src/device/global.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,10 @@ impl Global {
20092009
config.composite_alpha_mode = new_alpha_mode;
20102010
}
20112011
if !caps.usage.contains(config.usage) {
2012-
return Err(E::UnsupportedUsage);
2012+
return Err(E::UnsupportedUsage {
2013+
requested: config.usage,
2014+
available: caps.usage,
2015+
});
20132016
}
20142017
if width == 0 || height == 0 {
20152018
return Err(E::ZeroArea);

wgpu-core/src/present.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ pub enum ConfigureSurfaceError {
8989
requested: wgt::CompositeAlphaMode,
9090
available: Vec<wgt::CompositeAlphaMode>,
9191
},
92-
#[error("Requested usage is not supported")]
93-
UnsupportedUsage,
92+
#[error("Requested usage {requested:?} is not in the list of supported usages: {available:?}")]
93+
UnsupportedUsage {
94+
requested: hal::TextureUses,
95+
available: hal::TextureUses,
96+
},
9497
#[error("Gpu got stuck :(")]
9598
StuckGpu,
9699
}

0 commit comments

Comments
 (0)