From a8b0f2f6a6abdb60cbd9ba58f41d07eaef502666 Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:44:45 +0200 Subject: [PATCH] remove device arg from `StagingBuffer.flush()` --- wgpu-core/src/device/queue.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index de5801485..8cb99c177 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -340,7 +340,8 @@ pub(crate) fn prepare_staging_buffer( } impl StagingBuffer { - unsafe fn flush(&self, device: &A::Device) -> Result<(), DeviceError> { + unsafe fn flush(&self) -> Result<(), DeviceError> { + let device = self.device.raw(); if !self.is_coherent { unsafe { device.flush_mapped_ranges(self.raw(), iter::once(0..self.size.get())) }; } @@ -453,7 +454,7 @@ impl Global { staging_buffer_ptr.as_ptr(), data_size.get() as usize, ); - staging_buffer.flush(device.raw()) + staging_buffer.flush() } { pending_writes.consume(staging_buffer); return Err(flush_error.into()); @@ -528,7 +529,7 @@ impl Global { // user. 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`. - if let Err(flush_error) = unsafe { staging_buffer.flush(device.raw()) } { + if let Err(flush_error) = unsafe { staging_buffer.flush() } { pending_writes.consume(staging_buffer); return Err(flush_error.into()); } @@ -859,7 +860,7 @@ impl Global { } } - if let Err(e) = unsafe { staging_buffer.flush(device.raw()) } { + if let Err(e) = unsafe { staging_buffer.flush() } { pending_writes.consume(staging_buffer); return Err(e.into()); }