mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-29 02:03:35 +00:00
Validate against cube storage textures (#1846)
This commit is contained in:
parent
53cac6046f
commit
0054d8cc53
@ -25,6 +25,8 @@ use thiserror::Error;
|
|||||||
|
|
||||||
#[derive(Clone, Debug, Error)]
|
#[derive(Clone, Debug, Error)]
|
||||||
pub enum BindGroupLayoutEntryError {
|
pub enum BindGroupLayoutEntryError {
|
||||||
|
#[error("cube dimension is not expected for texture storage")]
|
||||||
|
StorageTextureCube,
|
||||||
#[error("arrays of bindings unsupported for this type of binding")]
|
#[error("arrays of bindings unsupported for this type of binding")]
|
||||||
ArrayUnsupported,
|
ArrayUnsupported,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
|
@ -1094,25 +1094,40 @@ impl<A: HalApi> Device<A> {
|
|||||||
Some(wgt::Features::TEXTURE_BINDING_ARRAY),
|
Some(wgt::Features::TEXTURE_BINDING_ARRAY),
|
||||||
WritableStorage::No,
|
WritableStorage::No,
|
||||||
),
|
),
|
||||||
Bt::StorageTexture { access, .. } => (
|
Bt::StorageTexture {
|
||||||
Some(
|
access,
|
||||||
wgt::Features::TEXTURE_BINDING_ARRAY
|
view_dimension,
|
||||||
| wgt::Features::STORAGE_RESOURCE_BINDING_ARRAY,
|
format: _,
|
||||||
),
|
} => {
|
||||||
match access {
|
match view_dimension {
|
||||||
wgt::StorageTextureAccess::WriteOnly => WritableStorage::Yes,
|
wgt::TextureViewDimension::Cube | wgt::TextureViewDimension::CubeArray => {
|
||||||
wgt::StorageTextureAccess::ReadOnly => {
|
return Err(binding_model::CreateBindGroupLayoutError::Entry {
|
||||||
required_features |=
|
binding: entry.binding,
|
||||||
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
|
error: binding_model::BindGroupLayoutEntryError::StorageTextureCube,
|
||||||
WritableStorage::No
|
})
|
||||||
}
|
}
|
||||||
wgt::StorageTextureAccess::ReadWrite => {
|
_ => (),
|
||||||
required_features |=
|
}
|
||||||
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
|
(
|
||||||
WritableStorage::Yes
|
Some(
|
||||||
}
|
wgt::Features::TEXTURE_BINDING_ARRAY
|
||||||
},
|
| wgt::Features::STORAGE_RESOURCE_BINDING_ARRAY,
|
||||||
),
|
),
|
||||||
|
match access {
|
||||||
|
wgt::StorageTextureAccess::WriteOnly => WritableStorage::Yes,
|
||||||
|
wgt::StorageTextureAccess::ReadOnly => {
|
||||||
|
required_features |=
|
||||||
|
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
|
||||||
|
WritableStorage::No
|
||||||
|
}
|
||||||
|
wgt::StorageTextureAccess::ReadWrite => {
|
||||||
|
required_features |=
|
||||||
|
wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
|
||||||
|
WritableStorage::Yes
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Validate the count parameter
|
// Validate the count parameter
|
||||||
|
Loading…
Reference in New Issue
Block a user