From d169557b004dc1d23f7e588de5d5ad25a9dc07ed Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 6 Mar 2014 16:45:40 +0100 Subject: [PATCH] Made GLX 1.3 the minimum supported version. --- README.md | 3 ++ src/glx_context.c | 73 +++++++--------------------------------------- src/glx_platform.h | 5 ---- 3 files changed, 14 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index a8d66cfb..63a71ddc 100644 --- a/README.md +++ b/README.md @@ -58,11 +58,14 @@ The following dependencies are needed by the examples and test programs: - [Win32] Enabled generation of pkg-config file for MinGW - [Win32] Bugfix: Failure to load winmm or its functions was not reported to the error callback + - [X11] Made GLX 1.3 the minimum supported version - [X11] Bugfix: The case of finding no usable CRTCs was not detected - [X11] Bugfix: Detection of broken Nvidia RandR gamma support did not verify that at least one CRTC was present - [X11] Bugfix: A stale `_NET_SUPPORTING_WM_CHECK` root window property would cause an uncaught `BadWindow` error + - [X11] Bugfix: No check was made for the presence GLX 1.3 when + `GLX_SGIX_fbconfig` was unavailable ## Contact diff --git a/src/glx_context.c b/src/glx_context.c index 5c4cf1d7..49a03086 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -42,20 +42,11 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))(); // Returns the specified attribute of the specified GLXFBConfig -// NOTE: Do not call this unless we have found GLX 1.3+ or GLX_SGIX_fbconfig // static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib) { int value; - - if (_glfw.glx.SGIX_fbconfig) - { - _glfw.glx.GetFBConfigAttribSGIX(_glfw.x11.display, - fbconfig, attrib, &value); - } - else - glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value); - + glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value); return value; } @@ -78,24 +69,11 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul trustWindowBit = GL_FALSE; } - if (_glfw.glx.SGIX_fbconfig) - { - nativeConfigs = _glfw.glx.ChooseFBConfigSGIX(_glfw.x11.display, - _glfw.x11.screen, - NULL, - &nativeCount); - } - else - { - nativeConfigs = glXGetFBConfigs(_glfw.x11.display, - _glfw.x11.screen, - &nativeCount); - } - + nativeConfigs = glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen, + &nativeCount); if (!nativeCount) { - _glfwInputError(GLFW_API_UNAVAILABLE, - "GLX: No GLXFBConfigs returned"); + _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned"); return GL_FALSE; } @@ -171,15 +149,6 @@ static GLXContext createLegacyContext(_GLFWwindow* window, GLXFBConfig fbconfig, GLXContext share) { - if (_glfw.glx.SGIX_fbconfig) - { - return _glfw.glx.CreateContextWithConfigSGIX(_glfw.x11.display, - fbconfig, - GLX_RGBA_TYPE, - share, - True); - } - return glXCreateNewContext(_glfw.x11.display, fbconfig, GLX_RGBA_TYPE, @@ -273,26 +242,6 @@ int _glfwInitContextAPI(void) _glfw.glx.MESA_swap_control = GL_TRUE; } - if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig")) - { - _glfw.glx.GetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC) - _glfwPlatformGetProcAddress("glXGetFBConfigAttribSGIX"); - _glfw.glx.ChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC) - _glfwPlatformGetProcAddress("glXChooseFBConfigSGIX"); - _glfw.glx.CreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) - _glfwPlatformGetProcAddress("glXCreateContextWithConfigSGIX"); - _glfw.glx.GetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) - _glfwPlatformGetProcAddress("glXGetVisualFromFBConfigSGIX"); - - if (_glfw.glx.GetFBConfigAttribSGIX && - _glfw.glx.ChooseFBConfigSGIX && - _glfw.glx.CreateContextWithConfigSGIX && - _glfw.glx.GetVisualFromFBConfigSGIX) - { - _glfw.glx.SGIX_fbconfig = GL_TRUE; - } - } - if (_glfwPlatformExtensionSupported("GLX_ARB_multisample")) _glfw.glx.ARB_multisample = GL_TRUE; @@ -317,6 +266,12 @@ int _glfwInitContextAPI(void) if (_glfwPlatformExtensionSupported("GLX_EXT_create_context_es2_profile")) _glfw.glx.EXT_create_context_es2_profile = GL_TRUE; + if (_glfw.glx.versionMajor == 1 && _glfw.glx.versionMinor < 3) + { + _glfwInputError(GLFW_API_UNAVAILABLE, "No GLXFBConfig support found"); + return GL_FALSE; + } + return GL_TRUE; } @@ -364,13 +319,7 @@ int _glfwCreateContext(_GLFWwindow* window, } // Retrieve the corresponding visual - if (_glfw.glx.SGIX_fbconfig) - { - window->glx.visual = - _glfw.glx.GetVisualFromFBConfigSGIX(_glfw.x11.display, native); - } - else - window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native); + window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native); if (window->glx.visual == NULL) { diff --git a/src/glx_platform.h b/src/glx_platform.h index f0702979..0cebc08d 100644 --- a/src/glx_platform.h +++ b/src/glx_platform.h @@ -100,12 +100,7 @@ typedef struct _GLFWlibraryGLX PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; - PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX; - PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX; - PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX; - PFNGLXGETVISUALFROMFBCONFIGSGIXPROC GetVisualFromFBConfigSGIX; PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; - GLboolean SGIX_fbconfig; GLboolean SGI_swap_control; GLboolean EXT_swap_control; GLboolean MESA_swap_control;