Skip to content

Commit a8b0f2f

Browse files
committed
remove device arg from StagingBuffer.flush()
1 parent 4d285d8 commit a8b0f2f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

wgpu-core/src/device/queue.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ pub(crate) fn prepare_staging_buffer<A: HalApi>(
340340
}
341341

342342
impl<A: HalApi> StagingBuffer<A> {
343-
unsafe fn flush(&self, device: &A::Device) -> Result<(), DeviceError> {
343+
unsafe fn flush(&self) -> Result<(), DeviceError> {
344+
let device = self.device.raw();
344345
if !self.is_coherent {
345346
unsafe { device.flush_mapped_ranges(self.raw(), iter::once(0..self.size.get())) };
346347
}
@@ -453,7 +454,7 @@ impl Global {
453454
staging_buffer_ptr.as_ptr(),
454455
data_size.get() as usize,
455456
);
456-
staging_buffer.flush(device.raw())
457+
staging_buffer.flush()
457458
} {
458459
pending_writes.consume(staging_buffer);
459460
return Err(flush_error.into());
@@ -528,7 +529,7 @@ impl Global {
528529
// user. Platform validation requires that the staging buffer always
529530
// be freed, even if an error occurs. All paths from here must call
530531
// `device.pending_writes.consume`.
531-
if let Err(flush_error) = unsafe { staging_buffer.flush(device.raw()) } {
532+
if let Err(flush_error) = unsafe { staging_buffer.flush() } {
532533
pending_writes.consume(staging_buffer);
533534
return Err(flush_error.into());
534535
}
@@ -859,7 +860,7 @@ impl Global {
859860
}
860861
}
861862

862-
if let Err(e) = unsafe { staging_buffer.flush(device.raw()) } {
863+
if let Err(e) = unsafe { staging_buffer.flush() } {
863864
pending_writes.consume(staging_buffer);
864865
return Err(e.into());
865866
}

0 commit comments

Comments
 (0)