summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2016-07-04 21:38:36 +1000
committerJames Ross-Gowan <rossymiles@gmail.com>2016-07-04 22:04:37 +1000
commit6a3da439cda7c9075fbca2fcffeb8a28f5149f5d (patch)
treee0c8609a3b1d71944e95a5a654c5d9fadf7efb3d /video
parentf98e1b0b966d11b50df79d04dbab54ca20a08319 (diff)
downloadmpv-6a3da439cda7c9075fbca2fcffeb8a28f5149f5d.tar.bz2
mpv-6a3da439cda7c9075fbca2fcffeb8a28f5149f5d.tar.xz
vo_opengl: angle: update the swapchain on resize
This uses eglPostSubBufferNV to trigger ANGLE to check the window size and update the size of the swapchain to match, which is recommended here: https://groups.google.com/d/msg/angleproject/RvyVkjRCQGU/gfKfT64IAgAJ With the D3D11 backend, using eglPostSubBufferNV with a 0-sized update region will even skip the Present() call, meaning it won't block for a vsync period. Hopefully ANGLE will have a less hacky way of doing this in future. See the relevant ANGLE issue: http://anglebug.com/1438 Fixes #3301
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/context_angle.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/video/out/opengl/context_angle.c b/video/out/opengl/context_angle.c
index cc14fc32c6..28515f431f 100644
--- a/video/out/opengl/context_angle.c
+++ b/video/out/opengl/context_angle.c
@@ -38,6 +38,7 @@ struct priv {
EGLContext egl_context;
EGLSurface egl_surface;
bool use_es2;
+ PFNEGLPOSTSUBBUFFERNVPROC eglPostSubBufferNV;
};
static void angle_uninit(MPGLContext *ctx)
@@ -288,6 +289,11 @@ static int angle_init(struct MPGLContext *ctx, int flags)
// Configure the underlying Direct3D device
d3d_init(ctx);
+ if (strstr(exts, "EGL_NV_post_sub_buffer")) {
+ p->eglPostSubBufferNV =
+ (PFNEGLPOSTSUBBUFFERNVPROC)eglGetProcAddress("eglPostSubBufferNV");
+ }
+
mpgl_load_functions(ctx->gl, get_proc_address, NULL, vo->log);
return 0;
@@ -315,7 +321,16 @@ static int angle_reconfig(struct MPGLContext *ctx)
static int angle_control(MPGLContext *ctx, int *events, int request, void *arg)
{
- return vo_w32_control(ctx->vo, events, request, arg);
+ struct priv *p = ctx->priv;
+ int r = vo_w32_control(ctx->vo, events, request, arg);
+
+ // Calling eglPostSubBufferNV with a 0-sized region doesn't present a frame
+ // or block, but it does update the swapchain to match the window size
+ // See: https://groups.google.com/d/msg/angleproject/RvyVkjRCQGU/gfKfT64IAgAJ
+ if ((*events & VO_EVENT_RESIZE) && p->eglPostSubBufferNV)
+ p->eglPostSubBufferNV(p->egl_display, p->egl_surface, 0, 0, 0, 0);
+
+ return r;
}
static void angle_swap_buffers(MPGLContext *ctx)