From 69289aec6cccdf31186e51882e201c2a411d13a0 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 1 Jul 2017 04:27:09 +0200 Subject: vo_opengl: fix some more pass_info_reset issues 2f41c4e8 exposed some other edge cases as well. Globally resetting the pass info was not the right way to go about it, because we don't know in advance what the frame type is going to be - at least not with the current code structure. (In principle, we could separately indicate the frame type and the pass type and then only reset it on the first actual pass_describe call, but that's annoying as well) Also fixes a latent issue where p->pass was never initialized, which broke the MP_DBG debugging code in some cases. --- video/out/opengl/video.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 6a9cbac042..224a794416 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -891,6 +891,9 @@ static void init_video(struct gl_video *p) debug_check_gl(p, "after video texture creation"); gl_video_setup_hooks(p); + + // make sure this variable is initialized to *something* + p->pass = p->pass_fresh; } // Release any texture mappings associated with the current frame. @@ -2748,7 +2751,6 @@ static void gl_video_interpolate_frame(struct gl_video *p, struct vo_frame *t, void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame, int fbo) { GL *gl = p->gl; - pass_info_reset(p, false); if (fbo && !(gl->mpgl_caps & MPGL_CAP_FB)) { MP_FATAL(p, "Rendering to FBO requested, but no FBO extension found!\n"); @@ -2825,6 +2827,7 @@ void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame, int fbo) if (is_new || !p->output_fbo_valid) { p->output_fbo_valid = false; + pass_info_reset(p, false); if (!pass_render_frame(p, frame->current, frame->frame_id)) goto done; @@ -2875,6 +2878,12 @@ done: gl->BindFramebuffer(GL_FRAMEBUFFER, fbo); if (p->osd) { + // If we haven't actually drawn anything so far, then we technically + // need to consider this the start of a new pass. Let's call it a + // redraw just because, since it's basically a blank frame anyway + if (!has_frame) + pass_info_reset(p, true); + pass_draw_osd(p, p->opts.blend_subs ? OSD_DRAW_OSD_ONLY : 0, p->osd_pts, p->osd_rect, p->vp_w, p->vp_h, fbo, true); debug_check_gl(p, "after OSD rendering"); -- cgit v1.2.3