Skip to content

Commit

Permalink
add missing device valid check in create_texture_view
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy authored and ErichDonGubler committed Jul 18, 2024
1 parent f767220 commit 77e45d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
2 changes: 2 additions & 0 deletions wgpu-core/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 77e45d4

Please sign in to comment.