Fix buffer unmap warning

This commit is contained in:
Dzmitry Malyshau 2020-04-14 00:08:04 -04:00
parent 8d1185f3e9
commit a0701b41cb
2 changed files with 10 additions and 10 deletions

View File

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Generated with cbindgen:0.14.0 */
/* Generated with cbindgen:0.14.1 */
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
* To generate this file:

View File

@ -142,14 +142,6 @@ fn map_buffer<B: hal::Backend>(
}
fn unmap_buffer<B: hal::Backend>(raw: &B::Device, buffer: &mut resource::Buffer<B>) {
match buffer.map_state {
resource::BufferMapState::Idle => {
log::error!("Buffer already unmapped");
return;
}
_ => buffer.map_state = resource::BufferMapState::Idle,
}
if !buffer.mapped_write_segments.is_empty() {
unsafe {
raw.flush_mapped_memory_ranges(
@ -2142,6 +2134,14 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let buffer = &mut buffer_guard[buffer_id];
log::debug!("Buffer {:?} map state -> Idle", buffer_id);
unmap_buffer(&device_guard[buffer.device_id.value].raw, buffer);
match buffer.map_state {
resource::BufferMapState::Idle => {
log::error!("Buffer already unmapped");
}
_ => {
buffer.map_state = resource::BufferMapState::Idle;
unmap_buffer(&device_guard[buffer.device_id.value].raw, buffer);
}
}
}
}