From ae8393c06efb2fb64d33986c164d5ddd12b27469 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 6 Mar 2014 14:48:44 +0100 Subject: [PATCH] Fixed refresh of debug context attribute. --- README.md | 2 ++ src/context.c | 5 +++-- src/internal.h | 3 ++- src/window.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b1669894..a8d66cfb 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ The following dependencies are needed by the examples and test programs: - Added native monitor handle access to native API - Added `glfwSetDropCallback` and `GLFWdropfun` for receiving dropped files + - Bugfix: The debug context attribute was set from `GL_ARB_debug_output` even + when a debug context had not been requested - [Cocoa] Added `_GLFW_USE_RETINA` to control whether windows will use the full resolution on Retina displays - [Cocoa] Bugfix: Using a 1x1 cursor for hidden mode caused some screen diff --git a/src/context.c b/src/context.c index 0c38e81d..92185228 100644 --- a/src/context.c +++ b/src/context.c @@ -358,7 +358,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, return closest; } -GLboolean _glfwRefreshContextAttribs(void) +GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); @@ -399,7 +399,8 @@ GLboolean _glfwRefreshContextAttribs(void) if (flags & GL_CONTEXT_FLAG_DEBUG_BIT) window->glDebug = GL_TRUE; - else if (glfwExtensionSupported("GL_ARB_debug_output")) + else if (glfwExtensionSupported("GL_ARB_debug_output") && + wndconfig->glDebug) { // HACK: This is a workaround for older drivers (pre KHR_debug) // not setting the debug bit in the context flags for diff --git a/src/internal.h b/src/internal.h index f0010ac3..2850a17c 100644 --- a/src/internal.h +++ b/src/internal.h @@ -728,10 +728,11 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, unsigned int count); /*! @brief Retrieves the attributes of the current context. + * @param[in] wndconfig The desired context attributes. * @return `GL_TRUE` if successful, or `GL_FALSE` if the context is unusable. * @ingroup utility */ -GLboolean _glfwRefreshContextAttribs(void); +GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig); /*! @brief Checks whether the desired context attributes are valid. * @param[in] wndconfig The context attributes to check. diff --git a/src/window.c b/src/window.c index 03d08fa3..22c84528 100644 --- a/src/window.c +++ b/src/window.c @@ -232,7 +232,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, glfwMakeContextCurrent((GLFWwindow*) window); // Retrieve the actual (as opposed to requested) context attributes - if (!_glfwRefreshContextAttribs()) + if (!_glfwRefreshContextAttribs(&wndconfig)) { glfwDestroyWindow((GLFWwindow*) window); glfwMakeContextCurrent((GLFWwindow*) previous);