From a8a05851644ae4b81d0481618aed0e8511bdf4fc Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 13 Dec 2012 17:33:08 +0100 Subject: [PATCH] Updated debug context detection. --- src/context.c | 11 ++++++++++- tests/glfwinfo.c | 5 +---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/context.c b/src/context.c index 99eea746..21a01ad8 100644 --- a/src/context.c +++ b/src/context.c @@ -412,6 +412,7 @@ GLboolean _glfwRefreshContextParams(void) // Read back forward-compatibility flag { window->glForward = GL_FALSE; + window->glDebug = GL_FALSE; if (window->clientAPI == GLFW_OPENGL_API && window->glMajor >= 3) { @@ -420,8 +421,16 @@ GLboolean _glfwRefreshContextParams(void) if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) window->glForward = GL_TRUE; - if (flags & 0) + if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) window->glDebug = GL_TRUE; + + if (glfwExtensionSupported("GL_ARB_debug_output")) + { + // HACK: This is a workaround for older drivers (pre KHR_debug) + // not setting the debug bit in the context flags for debug + // contexts + window->glDebug = GL_TRUE; + } } } diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c index 04a9d956..dd7dc6ae 100644 --- a/tests/glfwinfo.c +++ b/tests/glfwinfo.c @@ -303,7 +303,7 @@ int main(int argc, char** argv) if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) printf(" forward-compatible"); - if (flags & 0) + if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) printf(" debug"); putchar('\n'); @@ -339,9 +339,6 @@ int main(int argc, char** argv) get_client_api_name(api), glGetString(GL_VENDOR)); - printf("OpenGL context debug flag saved by GLFW: %s\n", - glfwGetWindowParam(window, GLFW_OPENGL_DEBUG_CONTEXT) ? "true" : "false"); - if (major > 1) { printf("%s context shading language version: \"%s\"\n",