fix check for flush_mapped_ranges in map_buffer

`flush_mapped_ranges` needs to be called when mappings are not coherent.
We can also omit flushing for write-mapped buffers since we always flush them on unmap.
This commit is contained in:
teoxoy 2024-08-07 18:13:42 +02:00 committed by Erich Gubler
parent f0875e8fda
commit a6bc2f6f53

View File

@ -349,7 +349,7 @@ fn map_buffer<A: HalApi>(
(uninitialized.start - offset) as usize..(uninitialized.end - offset) as usize;
mapped[fill_range].fill(0);
if mapping.is_coherent {
if !mapping.is_coherent && kind == HostMap::Read {
unsafe { raw.flush_mapped_ranges(raw_buffer, iter::once(uninitialized)) };
}
}