From 64faa8c66b2722df5c13c7d8342e767578d658fd Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 28 Aug 2013 12:32:29 +0200 Subject: gl_video: don't crash if no FBOs are available This probably has been broken since bbc865a: a test was added that uses a FBO, but it's always run, even if FBOs were not detected. On the other hand, fbotex_init() just runs into an assert. Fix the test that triggered this condition, and make fbotex_init() "nicer" by just failing if FBOs are not available. --- video/out/gl_video.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 7cce15e884..719c06d54a 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -433,7 +433,6 @@ static bool fbotex_init(struct gl_video *p, struct fbotex *fbo, int w, int h, GL *gl = p->gl; bool res = true; - assert(gl->mpgl_caps & MPGL_CAP_FB); assert(!fbo->fbo); assert(!fbo->texture); @@ -446,6 +445,9 @@ static bool fbotex_init(struct gl_video *p, struct fbotex *fbo, int w, int h, MP_VERBOSE(p, "Create FBO: %dx%d\n", fbo->tex_w, fbo->tex_h); + if (!(gl->mpgl_caps & MPGL_CAP_FB)) + return false; + gl->GenFramebuffers(1, &fbo->fbo); gl->GenTextures(1, &fbo->texture); gl->BindTexture(GL_TEXTURE_2D, fbo->texture); @@ -1713,10 +1715,10 @@ static void check_gl_features(struct gl_video *p) } // fruit dithering mode and the 3D lut use this texture format - if ((p->opts.dither_depth >= 0 && p->opts.dither_algo == 0) || - p->use_lut_3d) + if (have_fbo && ((p->opts.dither_depth >= 0 && p->opts.dither_algo == 0) || + p->use_lut_3d)) { - // doesn't disalbe anything; it's just for the log + // doesn't disable anything; it's just for the log MP_VERBOSE(p, "Testing GL_R16 FBO (dithering/LUT)\n"); test_fbo(p, GL_R16); } -- cgit v1.2.3