Skip to content

Commit

Permalink
[gl] gate usage of glFlushMappedBufferRange
Browse files Browse the repository at this point in the history
This is done in the same way as in `map_buffer` & `unmap_buffer`.
  • Loading branch information
teoxoy authored and ErichDonGubler committed Aug 12, 2024
1 parent b594497 commit 7c917ab
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions wgpu-hal/src/gles/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,17 +705,20 @@ impl crate::Device for super::Device {
I: Iterator<Item = crate::MemoryRange>,
{
if let Some(raw) = buffer.raw {
let gl = &self.shared.context.lock();
unsafe { gl.bind_buffer(buffer.target, Some(raw)) };
for range in ranges {
let offset_of_current_mapping = *buffer.offset_of_current_mapping.lock().unwrap();
unsafe {
gl.flush_mapped_buffer_range(
buffer.target,
(range.start - offset_of_current_mapping) as i32,
(range.end - range.start) as i32,
)
};
if buffer.data.is_none() {
let gl = &self.shared.context.lock();
unsafe { gl.bind_buffer(buffer.target, Some(raw)) };
for range in ranges {
let offset_of_current_mapping =
*buffer.offset_of_current_mapping.lock().unwrap();
unsafe {
gl.flush_mapped_buffer_range(
buffer.target,
(range.start - offset_of_current_mapping) as i32,
(range.end - range.start) as i32,
)
};
}
}
}
}
Expand Down

0 comments on commit 7c917ab

Please sign in to comment.