|
|
|
@ -108,7 +108,7 @@ static int getConfigAttrib(EGLConfig config, int attrib) |
|
|
|
|
|
|
|
|
|
// Return a list of available and usable framebuffer configs
|
|
|
|
|
//
|
|
|
|
|
static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig, |
|
|
|
|
static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig, |
|
|
|
|
const _GLFWfbconfig* desired, |
|
|
|
|
EGLConfig* result) |
|
|
|
|
{ |
|
|
|
@ -155,9 +155,9 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig, |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) |
|
|
|
|
if (ctxconfig->api == GLFW_OPENGL_ES_API) |
|
|
|
|
{ |
|
|
|
|
if (wndconfig->glMajor == 1) |
|
|
|
|
if (ctxconfig->major == 1) |
|
|
|
|
{ |
|
|
|
|
if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT)) |
|
|
|
|
continue; |
|
|
|
@ -168,7 +168,7 @@ static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig, |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if (wndconfig->clientAPI == GLFW_OPENGL_API) |
|
|
|
|
else if (ctxconfig->api == GLFW_OPENGL_API) |
|
|
|
|
{ |
|
|
|
|
if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT)) |
|
|
|
|
continue; |
|
|
|
@ -249,18 +249,17 @@ void _glfwTerminateContextAPI(void) |
|
|
|
|
// Prepare for creation of the OpenGL context
|
|
|
|
|
//
|
|
|
|
|
int _glfwCreateContext(_GLFWwindow* window, |
|
|
|
|
const _GLFWwndconfig* wndconfig, |
|
|
|
|
const _GLFWctxconfig* ctxconfig, |
|
|
|
|
const _GLFWfbconfig* fbconfig) |
|
|
|
|
{ |
|
|
|
|
int attribs[40]; |
|
|
|
|
EGLint count = 0; |
|
|
|
|
EGLConfig config; |
|
|
|
|
EGLContext share = NULL; |
|
|
|
|
|
|
|
|
|
if (wndconfig->share) |
|
|
|
|
share = wndconfig->share->egl.context; |
|
|
|
|
if (ctxconfig->share) |
|
|
|
|
share = ctxconfig->share->egl.context; |
|
|
|
|
|
|
|
|
|
if (!chooseFBConfigs(wndconfig, fbconfig, &config)) |
|
|
|
|
if (!chooseFBConfigs(ctxconfig, fbconfig, &config)) |
|
|
|
|
{ |
|
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR, |
|
|
|
|
"EGL: Failed to find a suitable EGLConfig"); |
|
|
|
@ -270,6 +269,7 @@ int _glfwCreateContext(_GLFWwindow* window, |
|
|
|
|
#if defined(_GLFW_X11) |
|
|
|
|
// Retrieve the visual corresponding to the chosen EGL config
|
|
|
|
|
{ |
|
|
|
|
EGLint count = 0; |
|
|
|
|
int mask; |
|
|
|
|
EGLint redBits, greenBits, blueBits, alphaBits, visualID = 0; |
|
|
|
|
XVisualInfo info; |
|
|
|
@ -316,7 +316,7 @@ int _glfwCreateContext(_GLFWwindow* window, |
|
|
|
|
} |
|
|
|
|
#endif // _GLFW_X11
|
|
|
|
|
|
|
|
|
|
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) |
|
|
|
|
if (ctxconfig->api == GLFW_OPENGL_ES_API) |
|
|
|
|
{ |
|
|
|
|
if (!eglBindAPI(EGL_OPENGL_ES_API)) |
|
|
|
|
{ |
|
|
|
@ -341,34 +341,34 @@ int _glfwCreateContext(_GLFWwindow* window, |
|
|
|
|
{ |
|
|
|
|
int index = 0, mask = 0, flags = 0, strategy = 0; |
|
|
|
|
|
|
|
|
|
if (wndconfig->clientAPI == GLFW_OPENGL_API) |
|
|
|
|
if (ctxconfig->api == GLFW_OPENGL_API) |
|
|
|
|
{ |
|
|
|
|
if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE) |
|
|
|
|
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE) |
|
|
|
|
mask |= EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; |
|
|
|
|
else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE) |
|
|
|
|
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE) |
|
|
|
|
mask |= EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; |
|
|
|
|
|
|
|
|
|
if (wndconfig->glForward) |
|
|
|
|
if (ctxconfig->forward) |
|
|
|
|
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; |
|
|
|
|
|
|
|
|
|
if (wndconfig->glDebug) |
|
|
|
|
if (ctxconfig->debug) |
|
|
|
|
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (wndconfig->glRobustness != GLFW_NO_ROBUSTNESS) |
|
|
|
|
if (ctxconfig->robustness != GLFW_NO_ROBUSTNESS) |
|
|
|
|
{ |
|
|
|
|
if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION) |
|
|
|
|
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION) |
|
|
|
|
strategy = EGL_NO_RESET_NOTIFICATION_KHR; |
|
|
|
|
else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET) |
|
|
|
|
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET) |
|
|
|
|
strategy = EGL_LOSE_CONTEXT_ON_RESET_KHR; |
|
|
|
|
|
|
|
|
|
flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0) |
|
|
|
|
if (ctxconfig->major != 1 || ctxconfig->minor != 0) |
|
|
|
|
{ |
|
|
|
|
setEGLattrib(EGL_CONTEXT_MAJOR_VERSION_KHR, wndconfig->glMajor); |
|
|
|
|
setEGLattrib(EGL_CONTEXT_MINOR_VERSION_KHR, wndconfig->glMinor); |
|
|
|
|
setEGLattrib(EGL_CONTEXT_MAJOR_VERSION_KHR, ctxconfig->major); |
|
|
|
|
setEGLattrib(EGL_CONTEXT_MINOR_VERSION_KHR, ctxconfig->minor); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (mask) |
|
|
|
@ -386,8 +386,8 @@ int _glfwCreateContext(_GLFWwindow* window, |
|
|
|
|
{ |
|
|
|
|
int index = 0; |
|
|
|
|
|
|
|
|
|
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) |
|
|
|
|
setEGLattrib(EGL_CONTEXT_CLIENT_VERSION, wndconfig->glMajor); |
|
|
|
|
if (ctxconfig->api == GLFW_OPENGL_ES_API) |
|
|
|
|
setEGLattrib(EGL_CONTEXT_CLIENT_VERSION, ctxconfig->major); |
|
|
|
|
|
|
|
|
|
setEGLattrib(EGL_NONE, EGL_NONE); |
|
|
|
|
} |
|
|
|
|