mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
added downlevel restriction error message for InvalidFormatUsages error
This commit is contained in:
parent
48325f1aaa
commit
6d4677fd7f
@ -800,9 +800,17 @@ impl<A: HalApi> Device<A> {
|
||||
|
||||
let missing_allowed_usages = desc.usage - format_features.allowed_usages;
|
||||
if !missing_allowed_usages.is_empty() {
|
||||
// detect downlevel incompatibilities
|
||||
let wgpu_allowed_usages = desc
|
||||
.format
|
||||
.describe()
|
||||
.guaranteed_format_features
|
||||
.allowed_usages;
|
||||
let wgpu_missing_usages = desc.usage - wgpu_allowed_usages;
|
||||
return Err(CreateTextureError::InvalidFormatUsages(
|
||||
missing_allowed_usages,
|
||||
desc.format,
|
||||
wgpu_missing_usages.is_empty(),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -423,8 +423,11 @@ pub enum CreateTextureError {
|
||||
"Texture descriptor mip level count {requested} is invalid, maximum allowed is {maximum}"
|
||||
)]
|
||||
InvalidMipLevelCount { requested: u32, maximum: u32 },
|
||||
#[error("Texture usages {0:?} are not allowed on a texture of type {1:?}")]
|
||||
InvalidFormatUsages(wgt::TextureUsages, wgt::TextureFormat),
|
||||
#[error(
|
||||
"Texture usages {0:?} are not allowed on a texture of type {1:?}{}",
|
||||
if *.2 { " due to downlevel restrictions" } else { "" }
|
||||
)]
|
||||
InvalidFormatUsages(wgt::TextureUsages, wgt::TextureFormat, bool),
|
||||
#[error("Texture usages {0:?} are not allowed on a texture of dimensions {1:?}")]
|
||||
InvalidDimensionUsages(wgt::TextureUsages, wgt::TextureDimension),
|
||||
#[error("Texture usage STORAGE_BINDING is not allowed for multisampled textures")]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user