mirror of
https://github.com/glfw/glfw.git
synced 2024-11-15 10:44:34 +00:00
Simplified fallback pbuffer surface path.
This commit is contained in:
parent
e55a552eee
commit
2f2e7f041a
@ -849,18 +849,15 @@ _GLFWusercontext* _glfwCreateUserContextEGL(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
_GLFWusercontext* context;
|
_GLFWusercontext* context;
|
||||||
_GLFWctxconfig ctxconfig;
|
_GLFWctxconfig ctxconfig;
|
||||||
const EGLint auxConfigAttribs[] =
|
EGLint dummyConfigAttribs[] =
|
||||||
{
|
{
|
||||||
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
|
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
|
||||||
EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_ALPHA_SIZE, 8,
|
EGL_RED_SIZE, 1, EGL_GREEN_SIZE, 1, EGL_BLUE_SIZE, 1,
|
||||||
EGL_DEPTH_SIZE, 0, EGL_STENCIL_SIZE, 0,
|
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
EGLint dummySurfaceAttribs[] =
|
EGLint dummySurfaceAttribs[] =
|
||||||
{
|
{
|
||||||
EGL_WIDTH, 1, EGL_HEIGHT, 1,
|
EGL_WIDTH, 1, EGL_HEIGHT, 1,
|
||||||
EGL_TEXTURE_TARGET, EGL_NO_TEXTURE,
|
|
||||||
EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE,
|
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
EGLint dummySurfaceNumConfigs;
|
EGLint dummySurfaceNumConfigs;
|
||||||
@ -883,14 +880,21 @@ _GLFWusercontext* _glfwCreateUserContextEGL(_GLFWwindow* window)
|
|||||||
context->egl.surface = EGL_NO_SURFACE;
|
context->egl.surface = EGL_NO_SURFACE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// create dummy surface
|
eglChooseConfig(_glfw.egl.display, dummyConfigAttribs, &dummySurfaceConfig, 1, &dummySurfaceNumConfigs);
|
||||||
eglChooseConfig(_glfw.egl.display, auxConfigAttribs, &dummySurfaceConfig, 1, &dummySurfaceNumConfigs);
|
if( !dummySurfaceNumConfigs)
|
||||||
context->egl.surface = eglCreatePbufferSurface(_glfw.egl.display, dummySurfaceConfig, dummySurfaceAttribs);
|
|
||||||
if (!context->egl.surface)
|
|
||||||
{
|
{
|
||||||
eglDestroyContext(_glfw.egl.display, context->egl.handle);
|
eglDestroyContext(_glfw.egl.display, context->egl.handle);
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: Failed to create surface for user context and EGL_KHR_surfaceless_context not supported");
|
"EGL: Failed to find surface config for user context: %s", getEGLErrorString(eglGetError()));
|
||||||
|
free(context);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
context->egl.surface = eglCreatePbufferSurface(_glfw.egl.display, dummySurfaceConfig, dummySurfaceAttribs);
|
||||||
|
if (context->egl.surface == EGL_NO_SURFACE)
|
||||||
|
{
|
||||||
|
eglDestroyContext(_glfw.egl.display, context->egl.handle);
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
|
"EGL: Failed to create surface for user context: %s for %s", getEGLErrorString(eglGetError()), eglQueryString(_glfw.egl.display,0x3054));
|
||||||
free(context);
|
free(context);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user