Context config translation cleanup.

This commit is contained in:
Camilla Berglund 2015-04-10 13:18:26 +02:00
parent 076d9311fa
commit 5c3f8efd23
3 changed files with 38 additions and 35 deletions

View File

@ -320,17 +320,17 @@ int _glfwCreateContext(_GLFWwindow* window,
if (_glfw.egl.KHR_create_context) if (_glfw.egl.KHR_create_context)
{ {
int index = 0, mask = 0, flags = 0, strategy = 0; int index = 0, mask = 0, flags = 0;
if (ctxconfig->api == GLFW_OPENGL_API) if (ctxconfig->api == GLFW_OPENGL_API)
{ {
if (ctxconfig->forward)
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
if (ctxconfig->forward)
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
} }
if (ctxconfig->debug) if (ctxconfig->debug)
@ -339,9 +339,15 @@ int _glfwCreateContext(_GLFWwindow* window,
if (ctxconfig->robustness) if (ctxconfig->robustness)
{ {
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
strategy = EGL_NO_RESET_NOTIFICATION_KHR; {
setEGLattrib(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
EGL_NO_RESET_NOTIFICATION_KHR);
}
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
strategy = EGL_LOSE_CONTEXT_ON_RESET_KHR; {
setEGLattrib(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR,
EGL_LOSE_CONTEXT_ON_RESET_KHR);
}
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
} }
@ -358,9 +364,6 @@ int _glfwCreateContext(_GLFWwindow* window,
if (flags) if (flags)
setEGLattrib(EGL_CONTEXT_FLAGS_KHR, flags); setEGLattrib(EGL_CONTEXT_FLAGS_KHR, flags);
if (strategy)
setEGLattrib(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, strategy);
setEGLattrib(EGL_NONE, EGL_NONE); setEGLattrib(EGL_NONE, EGL_NONE);
} }
else else

View File

@ -350,20 +350,17 @@ int _glfwCreateContext(_GLFWwindow* window,
if (_glfw.glx.ARB_create_context) if (_glfw.glx.ARB_create_context)
{ {
int index = 0, mask = 0, flags = 0, strategy = 0; int index = 0, mask = 0, flags = 0;
if (ctxconfig->api == GLFW_OPENGL_API) if (ctxconfig->api == GLFW_OPENGL_API)
{ {
if (ctxconfig->forward) if (ctxconfig->forward)
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (ctxconfig->profile) if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
{ mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB; mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
}
} }
else else
mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT; mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
@ -376,9 +373,15 @@ int _glfwCreateContext(_GLFWwindow* window,
if (_glfw.glx.ARB_create_context_robustness) if (_glfw.glx.ARB_create_context_robustness)
{ {
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
strategy = GLX_NO_RESET_NOTIFICATION_ARB; {
setGLXattrib(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
GLX_NO_RESET_NOTIFICATION_ARB);
}
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
strategy = GLX_LOSE_CONTEXT_ON_RESET_ARB; {
setGLXattrib(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
GLX_LOSE_CONTEXT_ON_RESET_ARB);
}
flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB; flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB;
} }
@ -417,9 +420,6 @@ int _glfwCreateContext(_GLFWwindow* window,
if (flags) if (flags)
setGLXattrib(GLX_CONTEXT_FLAGS_ARB, flags); setGLXattrib(GLX_CONTEXT_FLAGS_ARB, flags);
if (strategy)
setGLXattrib(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, strategy);
setGLXattrib(None, None); setGLXattrib(None, None);
window->glx.context = window->glx.context =

View File

@ -380,20 +380,17 @@ int _glfwCreateContext(_GLFWwindow* window,
if (window->wgl.ARB_create_context) if (window->wgl.ARB_create_context)
{ {
int index = 0, mask = 0, flags = 0, strategy = 0; int index = 0, mask = 0, flags = 0;
if (ctxconfig->api == GLFW_OPENGL_API) if (ctxconfig->api == GLFW_OPENGL_API)
{ {
if (ctxconfig->forward) if (ctxconfig->forward)
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (ctxconfig->profile) if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
{ mask |= WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
mask |= WGL_CONTEXT_CORE_PROFILE_BIT_ARB; mask |= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
mask |= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
}
} }
else else
mask |= WGL_CONTEXT_ES2_PROFILE_BIT_EXT; mask |= WGL_CONTEXT_ES2_PROFILE_BIT_EXT;
@ -406,9 +403,15 @@ int _glfwCreateContext(_GLFWwindow* window,
if (window->wgl.ARB_create_context_robustness) if (window->wgl.ARB_create_context_robustness)
{ {
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
strategy = WGL_NO_RESET_NOTIFICATION_ARB; {
setWGLattrib(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
WGL_NO_RESET_NOTIFICATION_ARB);
}
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
strategy = WGL_LOSE_CONTEXT_ON_RESET_ARB; {
setWGLattrib(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB,
WGL_LOSE_CONTEXT_ON_RESET_ARB);
}
flags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB; flags |= WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB;
} }
@ -447,9 +450,6 @@ int _glfwCreateContext(_GLFWwindow* window,
if (mask) if (mask)
setWGLattrib(WGL_CONTEXT_PROFILE_MASK_ARB, mask); setWGLattrib(WGL_CONTEXT_PROFILE_MASK_ARB, mask);
if (strategy)
setWGLattrib(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, strategy);
setWGLattrib(0, 0); setWGLattrib(0, 0);
window->wgl.context = window->wgl.CreateContextAttribsARB(window->wgl.dc, window->wgl.context = window->wgl.CreateContextAttribsARB(window->wgl.dc,