[wgpu-core] remove Arc around StagingBuffer

This commit is contained in:
teoxoy 2024-09-06 21:24:29 +02:00 committed by Teodor Tanasoaia
parent b14fe14e88
commit 2ea314e978
2 changed files with 3 additions and 9 deletions

View File

@ -334,8 +334,6 @@ pub enum QueueWriteError {
DestroyedResource(#[from] DestroyedResourceError),
#[error(transparent)]
InvalidResource(#[from] InvalidResourceError),
#[error("StagingBufferId {0:?} is invalid")]
InvalidStagingBufferId(id::StagingBufferId),
}
#[derive(Clone, Debug, Error)]
@ -442,7 +440,7 @@ impl Global {
let ptr = unsafe { staging_buffer.ptr() };
let fid = hub.staging_buffers.prepare(queue_id.backend(), id_in);
let id = fid.assign(Arc::new(staging_buffer));
let id = fid.assign(staging_buffer);
resource_log!("Queue::create_staging_buffer {id:?}");
Ok((id, ptr))
@ -462,11 +460,7 @@ impl Global {
let device = &queue.device;
let staging_buffer = hub
.staging_buffers
.unregister(staging_buffer_id)
.and_then(Arc::into_inner)
.ok_or_else(|| QueueWriteError::InvalidStagingBufferId(staging_buffer_id))?;
let staging_buffer = hub.staging_buffers.strict_unregister(staging_buffer_id);
let mut pending_writes = device.pending_writes.lock();

View File

@ -176,7 +176,7 @@ pub struct Hub {
pub(crate) pipeline_caches: Registry<Arc<PipelineCache>>,
pub(crate) query_sets: Registry<Fallible<QuerySet>>,
pub(crate) buffers: Registry<Fallible<Buffer>>,
pub(crate) staging_buffers: Registry<Arc<StagingBuffer>>,
pub(crate) staging_buffers: Registry<StagingBuffer>,
pub(crate) textures: Registry<Fallible<Texture>>,
pub(crate) texture_views: Registry<Fallible<TextureView>>,
pub(crate) samplers: Registry<Fallible<Sampler>>,