From f4ea29cd06b8f42f9614f7a3f29a44532d3e90f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 8 Jun 2017 15:23:04 +0200 Subject: [PATCH] GLX: Add GLX_ARB_create_context_no_error support --- README.md | 1 + src/glx_context.c | 13 +++++++++++-- src/glx_context.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3058a40a..9ab9eae6 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,7 @@ information on what to include when reporting a bug. modes (#682) - [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts - [WGL] Added support for `WGL_ARB_create_context_no_error` +- [GLX] Added support for `GLX_ARB_create_context_no_error` - [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871) - [EGL] Added support for `EGL_KHR_context_flush_control` - [EGL] Bugfix: The test for `EGL_RGB_BUFFER` was invalid diff --git a/src/glx_context.c b/src/glx_context.c index 3e6ff96f..a3978167 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -397,6 +397,9 @@ GLFWbool _glfwInitGLX(void) if (extensionSupportedGLX("GLX_EXT_create_context_es2_profile")) _glfw.glx.EXT_create_context_es2_profile = GLFW_TRUE; + if (extensionSupportedGLX("GLX_ARB_create_context_no_error")) + _glfw.glx.ARB_create_context_no_error = GLFW_TRUE; + if (extensionSupportedGLX("GLX_ARB_context_flush_control")) _glfw.glx.ARB_context_flush_control = GLFW_TRUE; @@ -498,8 +501,6 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, if (ctxconfig->debug) flags |= GLX_CONTEXT_DEBUG_BIT_ARB; - if (ctxconfig->noerror) - flags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR; if (ctxconfig->robustness) { @@ -537,6 +538,14 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, } } + if (ctxconfig->noerror) + { + if (_glfw.glx.ARB_create_context_no_error) + { + setGLXattrib(GLX_CONTEXT_OPENGL_NO_ERROR_ARB, GLFW_TRUE); + } + } + // NOTE: Only request an explicitly versioned context when necessary, as // explicitly requesting version 1.0 does not always return the // highest version supported by the driver diff --git a/src/glx_context.h b/src/glx_context.h index 3a427bd2..30743c11 100644 --- a/src/glx_context.h +++ b/src/glx_context.h @@ -64,6 +64,7 @@ #define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 #define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 #define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 +#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3 typedef XID GLXWindow; typedef XID GLXDrawable; @@ -162,6 +163,7 @@ typedef struct _GLFWlibraryGLX GLFWbool ARB_create_context_profile; GLFWbool ARB_create_context_robustness; GLFWbool EXT_create_context_es2_profile; + GLFWbool ARB_create_context_no_error; GLFWbool ARB_context_flush_control; } _GLFWlibraryGLX;