From 8fb9cc253457a58c39013906643e8dc92171adbe Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 20 Mar 2017 13:31:28 +0100 Subject: vo_opengl: read framebuffer depth from actual FBO used for rendering In some cases, such as when using the libmpv opengl-cb API, or with certain vo_opengl backends, the main framebuffer is never accessed. Instead, rendering is done to a FBO that acts as back buffer. This meant an incorrect/broken bit depth could be used for dithering. Change it to read the framebuffer depth lazily on the first render call. Also move the main FBO field out of the GL struct to MPGLContext, because the renderer's init function does not need to access it anymore. --- video/out/opengl/context_vdpau.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'video/out/opengl/context_vdpau.c') diff --git a/video/out/opengl/context_vdpau.c b/video/out/opengl/context_vdpau.c index 2d00cb4ba6..1d8479e9dc 100644 --- a/video/out/opengl/context_vdpau.c +++ b/video/out/opengl/context_vdpau.c @@ -311,7 +311,7 @@ static void glx_next_framebuffer(struct MPGLContext *ctx) VdpStatus vdp_st; GL *gl = ctx->gl; - ctx->gl->main_fb = 0; + ctx->main_fb = 0; int current_surface = p->current_surface++; p->current_surface = p->current_surface % p->num_surfaces; @@ -348,7 +348,7 @@ static void glx_next_framebuffer(struct MPGLContext *ctx) gl->VDPAUMapSurfacesNV(1, &surface->registered); surface->mapped = true; - gl->main_fb = surface->fbo; + ctx->main_fb = surface->fbo; ctx->flip_v = true; } -- cgit v1.2.3