From 2b9a7c4b5bc5697241cb8e1448b2056d20b50b77 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 22 Dec 2014 12:49:20 +0100 Subject: 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. --- video/out/gl_video.c | 5 +++++ video/out/vo_opengl.c | 2 ++ video/out/vo_opengl_cb.c | 7 ++----- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'video') 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); -- cgit v1.2.3