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 authored and Erich Gubler committed 2024-08-12 14:20:56 +01:00
1 parent f0875e8fda
commit a6bc2f6f53
1 file changed
+1 -1
+1 -1
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)) };
}
}