diff options
Diffstat (limited to 'stockton-render/src')
-rw-r--r-- | stockton-render/src/draw/buffer.rs | 10 | ||||
-rw-r--r-- | stockton-render/src/draw/texture/image.rs | 6 |
2 files changed, 3 insertions, 13 deletions
diff --git a/stockton-render/src/draw/buffer.rs b/stockton-render/src/draw/buffer.rs index 532da3c..c202d04 100644 --- a/stockton-render/src/draw/buffer.rs +++ b/stockton-render/src/draw/buffer.rs @@ -128,7 +128,7 @@ impl<'a, T: Sized> StagedBuffer<'a, T> { device, adapter, Usage::TRANSFER_DST | usage, - Properties::DEVICE_LOCAL, + Properties::DEVICE_LOCAL | Properties::COHERENT, size_bytes, )?; @@ -177,14 +177,6 @@ impl<'a, T: Sized> ModifiableBuffer for StagedBuffer<'a, T> { ) -> &'b Buffer { // Only commit if there's changes to commit. if self.staged_is_dirty { - // Flush mapped memory to ensure the staged buffer is filled - unsafe { - use std::ops::Deref; - device - .flush_mapped_memory_ranges(once((self.staged_memory.deref(), Segment::ALL))) - .unwrap(); - } - // Copy from staged to buffer let buf = unsafe { use hal::command::{BufferCopy, CommandBufferFlags}; diff --git a/stockton-render/src/draw/texture/image.rs b/stockton-render/src/draw/texture/image.rs index 2e0b27b..37e8ce8 100644 --- a/stockton-render/src/draw/texture/image.rs +++ b/stockton-render/src/draw/texture/image.rs @@ -186,7 +186,7 @@ impl LoadedImage { device, adapter, BufUsage::TRANSFER_SRC, - MemProperties::CPU_VISIBLE, + MemProperties::CPU_VISIBLE | MemProperties::COHERENT, total_size, ) .map_err(|_| "Couldn't create staging buffer")?; @@ -201,9 +201,7 @@ impl LoadedImage { let dest_base: isize = (y * row_size).try_into().unwrap(); img.copy_row(y as u32, mapped_memory.offset(dest_base)); } - device - .flush_mapped_memory_ranges(once((&staging_memory, Segment::ALL))) - .map_err(|_| "Couldn't write buffer memory")?; + device.unmap_memory(&staging_memory); } |