Skip to content

Commit

Permalink
fix check for flush_mapped_ranges in map_buffer
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
teoxoy committed Aug 8, 2024
1 parent 552d7df commit cbbfb67
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) };
}
}
Expand Down

0 comments on commit cbbfb67

Please sign in to comment.