remove instance_flags arg from StagingBuffer::new

This commit is contained in:
teoxoy 2024-07-11 16:53:38 +02:00 committed by Teodor Tanasoaia
parent 26f65ddffd
commit 2f282cdd06
3 changed files with 6 additions and 13 deletions

View File

@ -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");

View File

@ -591,11 +591,8 @@ impl<A: HalApi> Device<A> {
};
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)

View File

@ -863,12 +863,11 @@ impl<A: HalApi> StagingBuffer<A> {
pub(crate) fn new(
device: &Arc<Device<A>>,
size: wgt::BufferSize,
instance_flags: wgt::InstanceFlags,
) -> Result<(Self, NonNull<u8>), 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,