mirror of https://github.com/mpv-player/mpv
vo_opengl: don't crash if framebuffers are not available
In theory, vo_opengl supports operation without framebuffers. But this
has been broken for a while now (commit cc00b3ff
is a contender). It
crashed because it unconditionally called gl->BindFramebuffer() (which
is NULL if framebuffers are missing).
Since this function is actually only called to set the default
framebuffer, the simplest way to deal with this is to provide a dummy
function, insteas of uglifying the code with additional if branches.
This commit is contained in:
parent
5f0a2b5908
commit
56882eaee4
|
@ -141,6 +141,11 @@ static bool is_software_gl(GL *gl)
|
||||||
strcmp(renderer, "Mesa X11") == 0;
|
strcmp(renderer, "Mesa X11") == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dummy_glBindFramebuffer(GLenum target, GLuint framebuffer)
|
||||||
|
{
|
||||||
|
assert(framebuffer == 0);
|
||||||
|
}
|
||||||
|
|
||||||
#define FN_OFFS(name) offsetof(GL, name)
|
#define FN_OFFS(name) offsetof(GL, name)
|
||||||
|
|
||||||
#define DEF_FN(name) {FN_OFFS(name), {"gl" # name}}
|
#define DEF_FN(name) {FN_OFFS(name), {"gl" # name}}
|
||||||
|
@ -618,6 +623,10 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n),
|
||||||
|
|
||||||
mp_verbose(log, "Detected OpenGL features:");
|
mp_verbose(log, "Detected OpenGL features:");
|
||||||
list_features(gl->mpgl_caps, log, MSGL_V, false);
|
list_features(gl->mpgl_caps, log, MSGL_V, false);
|
||||||
|
|
||||||
|
// Provided for simpler handling if no framebuffer support is available.
|
||||||
|
if (!gl->BindFramebuffer)
|
||||||
|
gl->BindFramebuffer = &dummy_glBindFramebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *get_procaddr_wrapper(void *ctx, const char *name)
|
static void *get_procaddr_wrapper(void *ctx, const char *name)
|
||||||
|
|
Loading…
Reference in New Issue