From 2f282cdd067979736dd32b84378676def8328644 Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:53:38 +0200 Subject: [PATCH] remove `instance_flags` arg from `StagingBuffer::new` --- wgpu-core/src/device/queue.rs | 9 +++------ wgpu-core/src/device/resource.rs | 7 ++----- wgpu-core/src/resource.rs | 3 +-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index df87ecd9c..aa4061f81 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -405,8 +405,7 @@ impl Global { // Platform validation requires that the staging buffer always be // freed, even if an error occurs. All paths from here must call // `device.pending_writes.consume`. - let (staging_buffer, staging_buffer_ptr) = - StagingBuffer::new(device, data_size, device.instance_flags)?; + let (staging_buffer, staging_buffer_ptr) = StagingBuffer::new(device, data_size)?; let mut pending_writes = device.pending_writes.lock(); let pending_writes = pending_writes.as_mut().unwrap(); @@ -449,8 +448,7 @@ impl Global { let device = &queue.device; - let (staging_buffer, staging_buffer_ptr) = - StagingBuffer::new(device, buffer_size, device.instance_flags)?; + let (staging_buffer, staging_buffer_ptr) = StagingBuffer::new(device, buffer_size)?; let fid = hub.staging_buffers.prepare(id_in); let id = fid.assign(Arc::new(staging_buffer)); @@ -781,8 +779,7 @@ impl Global { // Platform validation requires that the staging buffer always be // freed, even if an error occurs. All paths from here must call // `device.pending_writes.consume`. - let (staging_buffer, staging_buffer_ptr) = - StagingBuffer::new(device, stage_size, device.instance_flags)?; + let (staging_buffer, staging_buffer_ptr) = StagingBuffer::new(device, stage_size)?; if stage_bytes_per_row == bytes_per_row { profiling::scope!("copy aligned"); diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 6a8f0a5c3..3e3e5f904 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -591,11 +591,8 @@ impl Device { }; hal::BufferUses::MAP_WRITE } else { - let (staging_buffer, staging_buffer_ptr) = StagingBuffer::new( - self, - wgt::BufferSize::new(aligned_size).unwrap(), - self.instance_flags, - )?; + let (staging_buffer, staging_buffer_ptr) = + StagingBuffer::new(self, wgt::BufferSize::new(aligned_size).unwrap())?; // Zero initialize memory and then mark the buffer as initialized // (it's guaranteed that this is the case by the time the buffer is usable) diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 0b1f15cc4..927f741b1 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -863,12 +863,11 @@ impl StagingBuffer { pub(crate) fn new( device: &Arc>, size: wgt::BufferSize, - instance_flags: wgt::InstanceFlags, ) -> Result<(Self, NonNull), DeviceError> { use hal::Device; profiling::scope!("StagingBuffer::new"); let stage_desc = hal::BufferDescriptor { - label: crate::hal_label(Some("(wgpu internal) Staging"), instance_flags), + label: crate::hal_label(Some("(wgpu internal) Staging"), device.instance_flags), size: size.get(), usage: hal::BufferUses::MAP_WRITE | hal::BufferUses::COPY_SRC, memory_flags: hal::MemoryFlags::TRANSIENT,