Merged GLX error code into library struct.

This commit is contained in:
Camilla Berglund 2013-05-02 16:37:55 +02:00
parent be28914732
commit 6b7f5671f8
2 changed files with 7 additions and 8 deletions

View File

@ -53,10 +53,6 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))();
#endif #endif
// The X error code as provided to the X error handler
//
static unsigned long _glfwErrorCode = Success;
// The per-thread current context/window pointer // The per-thread current context/window pointer
// //
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL; static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
@ -66,7 +62,7 @@ static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
// //
static int errorHandler(Display *display, XErrorEvent* event) static int errorHandler(Display *display, XErrorEvent* event)
{ {
_glfwErrorCode = event->error_code; _glfw.glx.errorCode = event->error_code;
return 0; return 0;
} }
@ -393,7 +389,7 @@ int _glfwCreateContext(_GLFWwindow* window,
} }
} }
_glfwErrorCode = Success; _glfw.glx.errorCode = Success;
XSetErrorHandler(errorHandler); XSetErrorHandler(errorHandler);
if (_glfw.glx.ARB_create_context) if (_glfw.glx.ARB_create_context)
@ -465,7 +461,7 @@ int _glfwCreateContext(_GLFWwindow* window,
// HACK: This is a fallback for the broken Mesa implementation of // HACK: This is a fallback for the broken Mesa implementation of
// GLX_ARB_create_context_profile, which fails default 1.0 context // GLX_ARB_create_context_profile, which fails default 1.0 context
// creation with a GLXBadProfileARB error in violation of the spec // creation with a GLXBadProfileARB error in violation of the spec
if (_glfwErrorCode == _glfw.glx.errorBase + GLXBadProfileARB && if (_glfw.glx.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
wndconfig->clientAPI == GLFW_OPENGL_API && wndconfig->clientAPI == GLFW_OPENGL_API &&
wndconfig->glProfile == GLFW_OPENGL_NO_PROFILE && wndconfig->glProfile == GLFW_OPENGL_NO_PROFILE &&
wndconfig->glForward == GL_FALSE) wndconfig->glForward == GL_FALSE)
@ -485,7 +481,7 @@ int _glfwCreateContext(_GLFWwindow* window,
{ {
char buffer[8192]; char buffer[8192];
XGetErrorText(_glfw.x11.display, XGetErrorText(_glfw.x11.display,
_glfwErrorCode, _glfw.glx.errorCode,
buffer, sizeof(buffer)); buffer, sizeof(buffer));
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,

View File

@ -93,6 +93,9 @@ typedef struct _GLFWlibraryGLX
int eventBase; int eventBase;
int errorBase; int errorBase;
// GLX error code received by Xlib error callback
int errorCode;
// GLX extensions // GLX extensions
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;