mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
Wait on in-flight command buffers on exit
If there is a command buffer in flight on exit from the winit app, wait on it so that the resources get destroyed cleanly. There may be a more aggressive strategy to quick-exit, but this is probably the most reliable approach and I see it in other code bases.
This commit is contained in:
parent
f73da22a69
commit
6039916631
|
@ -1,4 +1,3 @@
|
||||||
use piet::RenderContext;
|
|
||||||
use piet_gpu_hal::{Error, ImageLayout, Instance, Session, SubmittedCmdBuf};
|
use piet_gpu_hal::{Error, ImageLayout, Instance, Session, SubmittedCmdBuf};
|
||||||
|
|
||||||
use piet_gpu::{test_scenes, PietGpuRenderContext, Renderer};
|
use piet_gpu::{test_scenes, PietGpuRenderContext, Renderer};
|
||||||
|
@ -152,6 +151,13 @@ fn main() -> Result<(), Error> {
|
||||||
|
|
||||||
current_frame += 1;
|
current_frame += 1;
|
||||||
}
|
}
|
||||||
|
Event::LoopDestroyed => {
|
||||||
|
if let Some(submitted) = submitted.take() {
|
||||||
|
// Wait for command list submission, otherwise dropping of renderer may
|
||||||
|
// cause validation errors (and possibly crashes).
|
||||||
|
submitted.wait().unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue