mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
33c03c4d0a
commit
fd2ead5080
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue