add missing device valid check in create_texture_view

This commit is contained in:
teoxoy 2024-07-18 12:21:26 +02:00 committed by Erich Gubler
parent f767220399
commit 77e45d46df
2 changed files with 4 additions and 0 deletions

View File

@ -991,6 +991,8 @@ impl<A: HalApi> Device<A> {
texture: &Arc<Texture<A>>,
desc: &resource::TextureViewDescriptor,
) -> Result<Arc<TextureView<A>>, resource::CreateTextureViewError> {
self.check_is_valid()?;
let snatch_guard = texture.device.snatchable_lock.read();
let texture_raw = texture.try_raw(&snatch_guard)?;

View File

@ -1632,6 +1632,8 @@ impl<A: HalApi> TextureView<A> {
#[derive(Clone, Debug, Error)]
#[non_exhaustive]
pub enum CreateTextureViewError {
#[error(transparent)]
Device(#[from] DeviceError),
#[error("TextureId {0:?} is invalid")]
InvalidTextureId(TextureId),
#[error(transparent)]