From 77e45d46df8829bdd49ca4336fe29e294a579831 Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Thu, 18 Jul 2024 12:21:26 +0200 Subject: [PATCH] add missing device valid check in `create_texture_view` --- wgpu-core/src/device/resource.rs | 2 ++ wgpu-core/src/resource.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 8caea3ac6..0af4516bb 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -991,6 +991,8 @@ impl Device { texture: &Arc>, desc: &resource::TextureViewDescriptor, ) -> Result>, resource::CreateTextureViewError> { + self.check_is_valid()?; + let snatch_guard = texture.device.snatchable_lock.read(); let texture_raw = texture.try_raw(&snatch_guard)?; diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 1929b9f8f..590de4747 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -1632,6 +1632,8 @@ impl TextureView { #[derive(Clone, Debug, Error)] #[non_exhaustive] pub enum CreateTextureViewError { + #[error(transparent)] + Device(#[from] DeviceError), #[error("TextureId {0:?} is invalid")] InvalidTextureId(TextureId), #[error(transparent)]