swapchain: Do not increase the age of 0-age slots
Slots with an age of 0 were never rendered to. This means we should not increase their age, when others are submitted or the renderer might wrongfully assume usuable contents are available in the buffer.
This commit is contained in:
parent
a8bc2f4a50
commit
485aa2a9c7
|
@ -166,8 +166,17 @@ where
|
||||||
|
|
||||||
slot.0.age.store(1, Ordering::SeqCst);
|
slot.0.age.store(1, Ordering::SeqCst);
|
||||||
for other_slot in &self.slots {
|
for other_slot in &self.slots {
|
||||||
if !Arc::ptr_eq(other_slot, &slot.0) {
|
if !Arc::ptr_eq(other_slot, &slot.0) && other_slot.buffer.is_some() {
|
||||||
other_slot.age.fetch_add(1, Ordering::SeqCst);
|
assert!(other_slot
|
||||||
|
.age
|
||||||
|
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |age| {
|
||||||
|
if age > 0 {
|
||||||
|
Some(age + 1)
|
||||||
|
} else {
|
||||||
|
Some(0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.is_ok());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue