diff options
Diffstat (limited to 'video/out/opengl/common.c')
-rw-r--r-- | video/out/opengl/common.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c index 3d03c47..fda40da 100644 --- a/video/out/opengl/common.c +++ b/video/out/opengl/common.c @@ -31,6 +31,7 @@ #include "common.h" #include "common/common.h" +#include "utils.h" // This guesses if the current GL context is a suspected software renderer. static bool is_software_gl(GL *gl) @@ -49,14 +50,6 @@ static void GLAPIENTRY dummy_glBindFramebuffer(GLenum target, GLuint framebuffer assert(framebuffer == 0); } -static bool check_ext(GL *gl, const char *name) -{ - const char *exts = gl->extensions; - char *s = strstr(exts, name); - char *e = s ? s + strlen(name) : NULL; - return s && (s == exts || s[-1] == ' ') && (e[0] == ' ' || !e[0]); -} - #define FN_OFFS(name) offsetof(GL, name) #define DEF_FN(name) {FN_OFFS(name), "gl" # name} @@ -383,6 +376,15 @@ static const struct gl_functions gl_functions[] = { {0}, }, }, + // This one overrides GLX_SGI_swap_control on platforms using mesa. The + // only difference is that it supports glXSwapInterval(0). + { + .extension = "GLX_MESA_swap_control", + .functions = (const struct gl_function[]) { + DEF_FN_NAME(SwapInterval, "glXSwapIntervalMESA"), + {0}, + }, + }, { .extension = "WGL_EXT_swap_control", .functions = (const struct gl_function[]) { @@ -572,8 +574,8 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), if (ver_core) must_exist = version >= ver_core; - if (section->extension && check_ext(gl, section->extension)) - exists = true; + if (section->extension) + exists = gl_check_extension(gl->extensions, section->extension); exists |= must_exist; if (!exists) @@ -623,7 +625,7 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), if (gl->es >= 300) gl->glsl_version = 300; } else { - gl->glsl_version = 110; + gl->glsl_version = 120; int glsl_major = 0, glsl_minor = 0; if (shader && sscanf(shader, "%d.%d", &glsl_major, &glsl_minor) == 2) gl->glsl_version = glsl_major * 100 + glsl_minor; |