diff options
author | wm4 <wm4@nowhere> | 2014-12-22 12:49:20 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-12-22 12:49:20 +0100 |
commit | 2b9a7c4b5bc5697241cb8e1448b2056d20b50b77 (patch) | |
tree | 32bd4391ef66c54d73f79df1f1461f390b39a7b3 /video | |
parent | cb347a9d05bf826f645c6d42b80db014cfc31827 (diff) | |
download | mpv-2b9a7c4b5bc5697241cb8e1448b2056d20b50b77.tar.bz2 mpv-2b9a7c4b5bc5697241cb8e1448b2056d20b50b77.tar.xz |
vo_opengl, vo_opengl_cb: check GL version in renderer
vo_opengl actually checks this in the context creation code already, but
it still increases robustness in case the requirements are changed
later.
Diffstat (limited to 'video')
-rw-r--r-- | video/out/gl_video.c | 5 | ||||
-rw-r--r-- | video/out/vo_opengl.c | 2 | ||||
-rw-r--r-- | video/out/vo_opengl_cb.c | 7 |
3 files changed, 9 insertions, 5 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 067f8f2b1c..5235f1bd1e 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -2440,6 +2440,11 @@ void gl_video_set_output_depth(struct gl_video *p, int r, int g, int b) struct gl_video *gl_video_init(GL *gl, struct mp_log *log, struct osd_state *osd) { + if (!(gl->mpgl_caps & MPGL_CAP_GL21)) { + mp_err(log, "At least OpenGL 2.1 or OpenGL ES 2.0 required.\n"); + return NULL; + } + struct gl_video *p = talloc_ptrtype(NULL, p); *p = (struct gl_video) { .gl = gl, diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index bc98f513a7..67cd3ce9dd 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -422,6 +422,8 @@ static int preinit(struct vo *vo) p->gl->SwapInterval(p->swap_interval); p->renderer = gl_video_init(p->gl, vo->log, vo->osd); + if (!p->renderer) + goto err_out; gl_video_set_output_depth(p->renderer, p->glctx->depth_r, p->glctx->depth_g, p->glctx->depth_b); gl_video_set_options(p->renderer, p->renderer_opts); diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c index 363b6a333f..c0870d3b42 100644 --- a/video/out/vo_opengl_cb.c +++ b/video/out/vo_opengl_cb.c @@ -143,12 +143,9 @@ int mpv_opengl_cb_init_gl(struct mpv_opengl_cb_context *ctx, const char *exts, mpgl_load_functions2(ctx->gl, get_proc_address, get_proc_address_ctx, exts, ctx->log); - int caps = MPGL_CAP_GL21; - if ((ctx->gl->mpgl_caps & caps) != caps) { - MP_FATAL(ctx, "Missing OpenGL features.\n"); - return MPV_ERROR_UNSUPPORTED; - } ctx->renderer = gl_video_init(ctx->gl, ctx->log, ctx->osd); + if (!ctx->renderer) + return MPV_ERROR_UNSUPPORTED; ctx->hwdec = gl_hwdec_load_api(ctx->log, ctx->gl, ctx->hwapi, &ctx->hwdec_info); gl_video_set_hwdec(ctx->renderer, ctx->hwdec); |