diff --git a/CHANGELOG.md b/CHANGELOG.md index 66248e175..c781d3f60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/wgpu-core/src/device/global.rs b/wgpu-core/src/device/global.rs index ba2b94dd2..69a9ebf32 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -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); diff --git a/wgpu-core/src/present.rs b/wgpu-core/src/present.rs index fa03387cb..b59493f31 100644 --- a/wgpu-core/src/present.rs +++ b/wgpu-core/src/present.rs @@ -89,8 +89,11 @@ pub enum ConfigureSurfaceError { requested: wgt::CompositeAlphaMode, available: Vec, }, - #[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, }