From 8d805c99d37cd0bb3e49acef3f45b9106368866f Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Wed, 19 Jun 2024 14:35:08 +0200 Subject: [PATCH] remove `TextureBindGroupState.add_single`'s return type --- wgpu-core/src/binding_model.rs | 4 +--- wgpu-core/src/device/resource.rs | 9 ++------- wgpu-core/src/track/texture.rs | 7 +++---- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index fce70e27b..e211e0d13 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -6,7 +6,7 @@ use crate::{ }, error::{ErrorFormatter, PrettyError}, hal_api::HalApi, - id::{BindGroupLayoutId, BufferId, SamplerId, TextureId, TextureViewId}, + id::{BindGroupLayoutId, BufferId, SamplerId, TextureViewId}, init_tracker::{BufferInitTrackerAction, TextureInitTrackerAction}, resource::{ParentDevice, Resource, ResourceInfo, ResourceType}, resource_log, @@ -80,8 +80,6 @@ pub enum CreateBindGroupError { InvalidBuffer(BufferId), #[error("Texture view {0:?} is invalid")] InvalidTextureView(TextureViewId), - #[error("Texture {0:?} is invalid")] - InvalidTexture(TextureId), #[error("Sampler {0:?} is invalid")] InvalidSampler(SamplerId), #[error( diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index fed39d3ad..8c2e26717 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -2054,15 +2054,10 @@ impl Device { "SampledTexture, ReadonlyStorageTexture or WriteonlyStorageTexture", )?; let texture = &view.parent; - let texture_id = texture.as_info().id(); // Careful here: the texture may no longer have its own ref count, // if it was deleted by the user. - let texture = used - .textures - .add_single(texture, Some(view.selector.clone()), internal_use) - .ok_or(binding_model::CreateBindGroupError::InvalidTexture( - texture_id, - ))?; + used.textures + .add_single(texture, Some(view.selector.clone()), internal_use); texture.same_device_as(view)?; diff --git a/wgpu-core/src/track/texture.rs b/wgpu-core/src/track/texture.rs index ab8e7dca9..b3ec79681 100644 --- a/wgpu-core/src/track/texture.rs +++ b/wgpu-core/src/track/texture.rs @@ -189,19 +189,18 @@ impl TextureBindGroupState { } /// Adds the given resource with the given state. - pub fn add_single<'a>( + pub fn add_single( &self, - texture: &'a Arc>, + texture: &Arc>, selector: Option, state: TextureUses, - ) -> Option<&'a Arc>> { + ) { let mut textures = self.textures.lock(); textures.push(TextureBindGroupStateData { selector, texture: texture.clone(), usage: state, }); - Some(texture) } }