mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
[gl] gate usage of glFlushMappedBufferRange
This is done in the same way as in `map_buffer` & `unmap_buffer`.
This commit is contained in:
parent
b594497f4a
commit
7c917abf52
@ -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,
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user