add custom error for Compositor::draw()
This commit is contained in:
parent
191288771f
commit
a7d2834a6d
5 changed files with 69 additions and 30 deletions
|
|
@ -366,7 +366,7 @@ async fn run_instance<A, E, C>(
|
|||
viewport_version = current_viewport_version;
|
||||
}
|
||||
|
||||
if let Ok(new_mouse_interaction) = compositor.draw(
|
||||
match compositor.draw(
|
||||
&mut renderer,
|
||||
&mut swap_chain,
|
||||
state.viewport(),
|
||||
|
|
@ -374,23 +374,34 @@ async fn run_instance<A, E, C>(
|
|||
&primitive,
|
||||
&debug.overlay(),
|
||||
) {
|
||||
debug.render_finished();
|
||||
Ok(new_mouse_interaction) => {
|
||||
debug.render_finished();
|
||||
|
||||
if new_mouse_interaction != mouse_interaction {
|
||||
window.set_cursor_icon(conversion::mouse_interaction(
|
||||
new_mouse_interaction,
|
||||
));
|
||||
if new_mouse_interaction != mouse_interaction {
|
||||
window.set_cursor_icon(
|
||||
conversion::mouse_interaction(
|
||||
new_mouse_interaction,
|
||||
),
|
||||
);
|
||||
|
||||
mouse_interaction = new_mouse_interaction;
|
||||
mouse_interaction = new_mouse_interaction;
|
||||
}
|
||||
|
||||
// TODO: Handle animations!
|
||||
// Maybe we can use `ControlFlow::WaitUntil` for this.
|
||||
}
|
||||
Err(error) => match error {
|
||||
window::CompositorDrawError::SwapchainOutdated(_) => {
|
||||
debug.render_finished();
|
||||
|
||||
// TODO: Handle animations!
|
||||
// Maybe we can use `ControlFlow::WaitUntil` for this.
|
||||
} else {
|
||||
debug.render_finished();
|
||||
|
||||
// Rendering could not complete, try again next frame.
|
||||
window.request_redraw();
|
||||
// Swapchain is outdated. Try rendering again next frame.
|
||||
window.request_redraw();
|
||||
}
|
||||
window::CompositorDrawError::FatalSwapchainError(e) => {
|
||||
// Fatal swapchain error. Rendering cannot continue.
|
||||
panic!("{}", e);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
event::Event::WindowEvent {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue