From aa48c6e9bcab25ae847365c0dc20addc13f9bd29 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Mon, 25 Jan 2016 10:42:48 -0800 Subject: [PATCH] deps/glad: Add support for glSwapIntervalMESA Just in case glSwapIntervalEXT and glSwapIntervalSGI aren't available for whatever reason. This entire patch is most likely completely redundant on modern mesa drivers. --- deps/glad/include/glad/glad_glx.h | 7 +++++++ deps/glad/src/glad_glx.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/deps/glad/include/glad/glad_glx.h b/deps/glad/include/glad/glad_glx.h index 14b59f0fa..617f50a70 100644 --- a/deps/glad/include/glad/glad_glx.h +++ b/deps/glad/include/glad/glad_glx.h @@ -764,6 +764,13 @@ typedef GLXDrawable (APIENTRYP PFNGLXGETCURRENTREADDRAWABLESGIPROC)(); GLAPI PFNGLXGETCURRENTREADDRAWABLESGIPROC glad_glXGetCurrentReadDrawableSGI; #define glXGetCurrentReadDrawableSGI glad_glXGetCurrentReadDrawableSGI #endif +#ifndef GLX_MESA_swap_control +#define GLX_MESA_swap_control 1 +GLAPI int GLAD_GLX_MESA_swap_control; +typedef int (APIENTRYP PFNGLXSWAPINTERVALMESAPROC)(int); +GLAPI PFNGLXSWAPINTERVALMESAPROC glad_glXSwapIntervalMESA; +#define glXSwapIntervalMESA glad_glXSwapIntervalMESA +#endif #ifndef GLX_SGI_swap_control #define GLX_SGI_swap_control 1 GLAPI int GLAD_GLX_SGI_swap_control; diff --git a/deps/glad/src/glad_glx.c b/deps/glad/src/glad_glx.c index 1d377c685..7c55b9fc0 100644 --- a/deps/glad/src/glad_glx.c +++ b/deps/glad/src/glad_glx.c @@ -203,6 +203,7 @@ int GLAD_GLX_NV_copy_image; int GLAD_GLX_OML_sync_control; int GLAD_GLX_EXT_framebuffer_sRGB; int GLAD_GLX_SGI_make_current_read; +int GLAD_GLX_MESA_swap_control; int GLAD_GLX_SGI_swap_control; int GLAD_GLX_EXT_fbconfig_packed_float; int GLAD_GLX_EXT_buffer_age; @@ -280,6 +281,7 @@ PFNGLXWAITFORMSCOMLPROC glad_glXWaitForMscOML; PFNGLXWAITFORSBCOMLPROC glad_glXWaitForSbcOML; PFNGLXMAKECURRENTREADSGIPROC glad_glXMakeCurrentReadSGI; PFNGLXGETCURRENTREADDRAWABLESGIPROC glad_glXGetCurrentReadDrawableSGI; +PFNGLXSWAPINTERVALMESAPROC glad_glXSwapIntervalMESA; PFNGLXSWAPINTERVALSGIPROC glad_glXSwapIntervalSGI; PFNGLXGETVIDEOSYNCSGIPROC glad_glXGetVideoSyncSGI; PFNGLXWAITVIDEOSYNCSGIPROC glad_glXWaitVideoSyncSGI; @@ -444,6 +446,10 @@ static void load_GLX_SGI_make_current_read(GLADloadproc load) { glad_glXMakeCurrentReadSGI = (PFNGLXMAKECURRENTREADSGIPROC)load("glXMakeCurrentReadSGI"); glad_glXGetCurrentReadDrawableSGI = (PFNGLXGETCURRENTREADDRAWABLESGIPROC)load("glXGetCurrentReadDrawableSGI"); } +static void load_GLX_MESA_swap_control(GLADloadproc load) { + if(!GLAD_GLX_MESA_swap_control) return; + glad_glXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)load("glXSwapIntervalMESA"); +} static void load_GLX_SGI_swap_control(GLADloadproc load) { if(!GLAD_GLX_SGI_swap_control) return; glad_glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)load("glXSwapIntervalSGI"); @@ -584,6 +590,7 @@ static void find_extensionsGLX(void) { GLAD_GLX_OML_sync_control = has_ext("GLX_OML_sync_control"); GLAD_GLX_EXT_framebuffer_sRGB = has_ext("GLX_EXT_framebuffer_sRGB"); GLAD_GLX_SGI_make_current_read = has_ext("GLX_SGI_make_current_read"); + GLAD_GLX_MESA_swap_control = has_ext("GLX_MESA_swap_control"); GLAD_GLX_SGI_swap_control = has_ext("GLX_SGI_swap_control"); GLAD_GLX_EXT_fbconfig_packed_float = has_ext("GLX_EXT_fbconfig_packed_float"); GLAD_GLX_EXT_buffer_age = has_ext("GLX_EXT_buffer_age"); @@ -664,6 +671,7 @@ void gladLoadGLXLoader(GLADloadproc load, Display *dpy, int screen) { load_GLX_NV_copy_image(load); load_GLX_OML_sync_control(load); load_GLX_SGI_make_current_read(load); + load_GLX_MESA_swap_control(load); load_GLX_SGI_swap_control(load); load_GLX_SGI_video_sync(load); load_GLX_MESA_agp_offset(load);