vo_gpu_next: fix assertion on wayland

This code failed to handle the case of the swapchain submission being
skipped because the window was invisible.

Fixes: f9dc695b58
This commit is contained in:
Niklas Haas 2023-07-29 19:09:45 +02:00
parent f9dc695b58
commit 3bf1d22879
1 changed files with 7 additions and 2 deletions

View File

@ -116,6 +116,7 @@ struct priv {
double last_pts; double last_pts;
bool is_interpolated; bool is_interpolated;
bool want_reset; bool want_reset;
bool frame_pending;
struct m_config_cache *opts_cache; struct m_config_cache *opts_cache;
struct mp_csp_equalizer_state *video_eq; struct mp_csp_equalizer_state *video_eq;
@ -1064,6 +1065,7 @@ done:
pl_tex_clear(gpu, swframe.fbo, (float[4]){ 0.5, 0.0, 1.0, 1.0 }); pl_tex_clear(gpu, swframe.fbo, (float[4]){ 0.5, 0.0, 1.0, 1.0 });
pl_gpu_flush(gpu); pl_gpu_flush(gpu);
p->frame_pending = true;
} }
static void flip_page(struct vo *vo) static void flip_page(struct vo *vo)
@ -1071,8 +1073,11 @@ static void flip_page(struct vo *vo)
struct priv *p = vo->priv; struct priv *p = vo->priv;
struct ra_swapchain *sw = p->ra_ctx->swapchain; struct ra_swapchain *sw = p->ra_ctx->swapchain;
if (!pl_swapchain_submit_frame(p->sw)) if (p->frame_pending) {
MP_ERR(vo, "Failed presenting frame!\n"); if (!pl_swapchain_submit_frame(p->sw))
MP_ERR(vo, "Failed presenting frame!\n");
p->frame_pending = false;
}
sw->fns->swap_buffers(sw); sw->fns->swap_buffers(sw);
} }