mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
remove TextureBindGroupState.add_single
's return type
This commit is contained in:
parent
43177d78d6
commit
8d805c99d3
@ -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(
|
||||
|
@ -2054,15 +2054,10 @@ impl<A: HalApi> Device<A> {
|
||||
"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)?;
|
||||
|
||||
|
@ -189,19 +189,18 @@ impl<A: HalApi> TextureBindGroupState<A> {
|
||||
}
|
||||
|
||||
/// Adds the given resource with the given state.
|
||||
pub fn add_single<'a>(
|
||||
pub fn add_single(
|
||||
&self,
|
||||
texture: &'a Arc<Texture<A>>,
|
||||
texture: &Arc<Texture<A>>,
|
||||
selector: Option<TextureSelector>,
|
||||
state: TextureUses,
|
||||
) -> Option<&'a Arc<Texture<A>>> {
|
||||
) {
|
||||
let mut textures = self.textures.lock();
|
||||
textures.push(TextureBindGroupStateData {
|
||||
selector,
|
||||
texture: texture.clone(),
|
||||
usage: state,
|
||||
});
|
||||
Some(texture)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user