diff options
author | wm4 <wm4@nowhere> | 2014-11-26 20:48:11 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-26 20:48:18 +0100 |
commit | 3fe57e3cb691d75dc8813c29cada5e3ddfd2a295 (patch) | |
tree | 93962472662b8d3c402d97cd3f78b91f2d0f4c89 /video/out/vo_opengl_old.c | |
parent | 7e62f2b0527e2a4d96418b9d8009dd840a45df0c (diff) | |
download | mpv-3fe57e3cb691d75dc8813c29cada5e3ddfd2a295.tar.bz2 mpv-3fe57e3cb691d75dc8813c29cada5e3ddfd2a295.tar.xz |
gl_common: factor context creation
Always create the context in mpgl_init(), instead of doing it when
mpgl_config_window() is called the first time. This is a small step
towards cleaning up the GL backend interface, and adding other things
like perhaps GLES support, or a callback-driven backend for libmpv.
Diffstat (limited to 'video/out/vo_opengl_old.c')
-rw-r--r-- | video/out/vo_opengl_old.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/video/out/vo_opengl_old.c b/video/out/vo_opengl_old.c index 91a14398d5..fb0831202e 100644 --- a/video/out/vo_opengl_old.c +++ b/video/out/vo_opengl_old.c @@ -1700,19 +1700,6 @@ static int initGl(struct vo *vo, uint32_t d_width, uint32_t d_height) return 1; } -static bool config_window(struct vo *vo, int flags) -{ - struct gl_priv *p = vo->priv; - - if (p->stereo_mode == GL_3D_QUADBUFFER) - flags |= VOFLAG_STEREO; - - int mpgl_caps = MPGL_CAP_GL_LEGACY; - if (!p->allow_sw) - mpgl_caps |= MPGL_CAP_NO_SW; - return mpgl_config_window(p->glctx, mpgl_caps, flags); -} - static int reconfig(struct vo *vo, struct mp_image_params *params, int flags) { struct gl_priv *p = vo->priv; @@ -1733,7 +1720,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags) uninitGl(vo); - if (!config_window(vo, flags)) + if (!mpgl_reconfig_window(p->glctx, flags)) return -1; initGl(vo, vo->dwidth, vo->dheight); @@ -2085,16 +2072,22 @@ static int preinit(struct vo *vo) p->use_yuv = 2; } - p->glctx = mpgl_init(vo, p->backend_arg); + int vo_flags = 0; + + if (p->stereo_mode == GL_3D_QUADBUFFER) + vo_flags |= VOFLAG_STEREO; + + int mpgl_caps = MPGL_CAP_GL_LEGACY; + if (!p->allow_sw) + mpgl_caps |= MPGL_CAP_NO_SW; + + p->glctx = mpgl_init(vo, p->backend_arg, mpgl_caps, vo_flags); if (!p->glctx) goto err_out; p->gl = p->glctx->gl; - if (p->use_yuv == -1) { - if (!config_window(vo, VOFLAG_HIDDEN)) - goto err_out; + if (p->use_yuv == -1) autodetectGlExtensions(vo); - } MP_VERBOSE(vo, "Using %d as slice height " "(0 means image height).\n", p->slice_height); |