Add GLFW_CONTEXT_NO_ERROR window hint

This adds support for the GL_KHR_no_error extension.
This commit is contained in:
Camilla Berglund
2015-08-10 12:46:14 +02:00
parent 962497bdc9
commit 7be8209d14
12 changed files with 47 additions and 2 deletions
+3
View File
@@ -403,6 +403,9 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
// debug contexts
window->context.debug = GLFW_TRUE;
}
if (flags & GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR)
window->context.noerror = GLFW_TRUE;
}
// Read back OpenGL context profile (OpenGL 3.2 and above)
+8
View File
@@ -264,6 +264,8 @@ int _glfwInitContextAPI(void)
_glfw.egl.KHR_create_context =
_glfwPlatformExtensionSupported("EGL_KHR_create_context");
_glfw.egl.KHR_create_context_no_error =
_glfwPlatformExtensionSupported("EGL_KHR_create_context_no_error");
return GLFW_TRUE;
}
@@ -345,6 +347,12 @@ int _glfwCreateContext(_GLFWwindow* window,
mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
if (_glfw.egl.KHR_create_context_no_error)
{
if (ctxconfig->noerror)
flags |= EGL_CONTEXT_OPENGL_NO_ERROR_KHR;
}
}
if (ctxconfig->debug)
+2
View File
@@ -88,6 +88,7 @@
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
#define EGL_CONTEXT_FLAGS_KHR 0x30fc
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3
#define EGL_NATIVE_VISUAL_ID 0x302e
#define EGL_NO_SURFACE ((EGLSurface) 0)
#define EGL_NO_DISPLAY ((EGLDisplay) 0)
@@ -160,6 +161,7 @@ typedef struct _GLFWlibraryEGL
EGLint major, minor;
GLFWbool KHR_create_context;
GLFWbool KHR_create_context_no_error;
void* handle;
+2
View File
@@ -380,6 +380,8 @@ int _glfwCreateContext(_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)
{
+3 -1
View File
@@ -65,6 +65,7 @@
#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82fb
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
typedef int GLint;
typedef unsigned int GLuint;
@@ -195,6 +196,7 @@ struct _GLFWctxconfig
int minor;
GLFWbool forward;
GLFWbool debug;
GLFWbool noerror;
int profile;
int robustness;
int release;
@@ -262,7 +264,7 @@ struct _GLFWwindow
struct {
int api;
int major, minor, revision;
GLFWbool forward, debug;
GLFWbool forward, debug, noerror;
int profile;
int robustness;
int release;
+2
View File
@@ -382,6 +382,8 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->debug)
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (ctxconfig->noerror)
flags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
if (ctxconfig->robustness)
{
+5
View File
@@ -357,6 +357,9 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_OPENGL_DEBUG_CONTEXT:
_glfw.hints.context.debug = hint ? GLFW_TRUE : GLFW_FALSE;
break;
case GLFW_CONTEXT_NO_ERROR:
_glfw.hints.context.noerror = hint ? GLFW_TRUE : GLFW_FALSE;
break;
case GLFW_OPENGL_PROFILE:
_glfw.hints.context.profile = hint;
break;
@@ -629,6 +632,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
return window->context.profile;
case GLFW_CONTEXT_RELEASE_BEHAVIOR:
return window->context.release;
case GLFW_CONTEXT_NO_ERROR:
return window->context.noerror;
}
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute");