summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/context_dxinterop.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-03-20 13:31:28 +0100
committerwm4 <wm4@nowhere>2017-03-20 13:31:28 +0100
commit8fb9cc253457a58c39013906643e8dc92171adbe (patch)
treecd78041d0ea61c580c628d15eb90d5ae2433b8b8 /video/out/opengl/context_dxinterop.c
parent03fe50651baeb506ca8b6fb2b597598a096be2f6 (diff)
downloadmpv-8fb9cc253457a58c39013906643e8dc92171adbe.tar.bz2
mpv-8fb9cc253457a58c39013906643e8dc92171adbe.tar.xz
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.
Diffstat (limited to 'video/out/opengl/context_dxinterop.c')
-rw-r--r--video/out/opengl/context_dxinterop.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/opengl/context_dxinterop.c b/video/out/opengl/context_dxinterop.c
index e98b0d55ae..a23318a6a4 100644
--- a/video/out/opengl/context_dxinterop.c
+++ b/video/out/opengl/context_dxinterop.c
@@ -294,7 +294,7 @@ static int d3d_size_dependent_create(MPGLContext *ctx)
return -1;
}
- gl->BindFramebuffer(GL_FRAMEBUFFER, gl->main_fb);
+ gl->BindFramebuffer(GL_FRAMEBUFFER, ctx->main_fb);
gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, p->texture, 0);
gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -506,7 +506,7 @@ static int dxinterop_init(struct MPGLContext *ctx, int flags)
goto fail;
// Create the shared framebuffer
- gl->GenFramebuffers(1, &gl->main_fb);
+ gl->GenFramebuffers(1, &ctx->main_fb);
current_ctx = ctx;
gl->SwapInterval = dxinterop_swap_interval;