From 662c793a557925319493297de8c941a636f18d73 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 4 Nov 2021 10:01:24 -0500 Subject: vo_gpu_next: call start_frame in vulkan/context.c In practice, this is for wayland. vo_gpu_next doesn't check the check_visible parameter since it didn't descend into the vulkan/context.c file when starting a frame. To make this happen, just call the start_frame function pointer but pass NULL as the ra_fbo. In there, we can do the visibility checks and after that bail out of the start_frame function if ra_fbo is NULL. --- video/out/vo_gpu_next.c | 6 ++++++ video/out/vulkan/context.c | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'video') diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 72c9cdb8ee..d2d2e9d9f5 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -577,6 +577,12 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame) p->last_id = id; } + // Doesn't draw anything. Only checks for visibility. + struct ra_swapchain *sw = p->ra_ctx->swapchain; + bool should_draw = sw->fns->start_frame(sw, NULL); + if (!should_draw) + return; + struct pl_swapchain_frame swframe; if (!pl_swapchain_start_frame(p->sw, &swframe)) return; diff --git a/video/out/vulkan/context.c b/video/out/vulkan/context.c index bcc52f46f3..216e653c82 100644 --- a/video/out/vulkan/context.c +++ b/video/out/vulkan/context.c @@ -239,11 +239,15 @@ static bool start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo) { struct priv *p = sw->priv; struct pl_swapchain_frame frame; + bool visible = true; if (p->params.check_visible) visible = p->params.check_visible(sw->ctx); - if (!visible) - return false; + + // If out_fbo is NULL, this was called from vo_gpu_next. Bail out. + if (out_fbo == NULL || !visible) + return visible; + if (!pl_swapchain_start_frame(p->vk->swapchain, &frame)) return false; if (!mppl_wrap_tex(sw->ctx->ra, frame.fbo, &p->proxy_tex)) -- cgit v1.2.3