swapchain: Keep buffers on reset and wipe metadata
We make no guarantees about the buffer contents after a fresh allocation in smithay anyway, so to avoid expensive recreation of a bunch of resources, try to keep the buffers on reset and just wipe all its metadata (most importantly the age).
This commit is contained in:
parent
8536fa90a1
commit
64c535464a
|
@ -196,6 +196,15 @@ where
|
||||||
|
|
||||||
/// Remove all internally cached buffers to e.g. reset age values
|
/// Remove all internally cached buffers to e.g. reset age values
|
||||||
pub fn reset_buffers(&mut self) {
|
pub fn reset_buffers(&mut self) {
|
||||||
self.slots = Default::default();
|
for slot in &mut self.slots {
|
||||||
|
if let Some(internal_slot) = Arc::get_mut(slot) {
|
||||||
|
*internal_slot = InternalSlot {
|
||||||
|
buffer: internal_slot.buffer.take(),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
*slot = Default::default();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue