Commit fba7b6ac authored by Degrande Samuel's avatar Degrande Samuel
Browse files

Revert "User context Wayland and EGL implementations"

This reverts commit 082f2b60.
parent 38674931
...@@ -454,15 +454,16 @@ void _glfwTerminateEGL(void) ...@@ -454,15 +454,16 @@ void _glfwTerminateEGL(void)
attribs[index++] = v; \ attribs[index++] = v; \
} }
// Create the OpenGL or OpenGL ES context for the window eglConfig // Create the OpenGL or OpenGL ES context
// //
GLFWbool _glfwCreateContextForConfigEGL(_GLFWwindow* window, GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig, const _GLFWctxconfig* ctxconfig,
EGLContext* context) const _GLFWfbconfig* fbconfig)
{ {
EGLint attribs[40]; EGLint attribs[40];
int index = 0; EGLConfig config;
EGLContext share = NULL; EGLContext share = NULL;
int index = 0;
if (!_glfw.egl.display) if (!_glfw.egl.display)
{ {
...@@ -473,6 +474,13 @@ GLFWbool _glfwCreateContextForConfigEGL(_GLFWwindow* window, ...@@ -473,6 +474,13 @@ GLFWbool _glfwCreateContextForConfigEGL(_GLFWwindow* window,
if (ctxconfig->share) if (ctxconfig->share)
share = ctxconfig->share->context.egl.handle; share = ctxconfig->share->context.egl.handle;
if (!chooseEGLConfig(ctxconfig, fbconfig, &config))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"EGL: Failed to find a suitable EGLConfig");
return GLFW_FALSE;
}
if (ctxconfig->client == GLFW_OPENGL_ES_API) if (ctxconfig->client == GLFW_OPENGL_ES_API)
{ {
if (!eglBindAPI(EGL_OPENGL_ES_API)) if (!eglBindAPI(EGL_OPENGL_ES_API))
...@@ -569,7 +577,7 @@ GLFWbool _glfwCreateContextForConfigEGL(_GLFWwindow* window, ...@@ -569,7 +577,7 @@ GLFWbool _glfwCreateContextForConfigEGL(_GLFWwindow* window,
setAttrib(EGL_NONE, EGL_NONE); setAttrib(EGL_NONE, EGL_NONE);
window->context.egl.handle = eglCreateContext(_glfw.egl.display, window->context.egl.handle = eglCreateContext(_glfw.egl.display,
window->context.egl.config, share, attribs); config, share, attribs);
if (window->context.egl.handle == EGL_NO_CONTEXT) if (window->context.egl.handle == EGL_NO_CONTEXT)
{ {
...@@ -579,52 +587,17 @@ GLFWbool _glfwCreateContextForConfigEGL(_GLFWwindow* window, ...@@ -579,52 +587,17 @@ GLFWbool _glfwCreateContextForConfigEGL(_GLFWwindow* window,
return GLFW_FALSE; return GLFW_FALSE;
} }
return GLFW_TRUE;
}
// Create the OpenGL or OpenGL ES context
//
GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
EGLNativeWindowType native;
EGLint attribs[40];
int index = 0;
if (!chooseEGLConfig(ctxconfig, fbconfig, &window->context.egl.config))
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"EGL: Failed to find a suitable EGLConfig");
return GLFW_FALSE;
}
if (!_glfwCreateContextForConfigEGL(window,ctxconfig,&window->context.egl.handle))
{
return GLFW_FALSE;
}
// Set up attributes for surface creation // Set up attributes for surface creation
if (fbconfig->sRGB)
{ {
if (_glfw.egl.KHR_gl_colorspace) int index = 0;
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
}
setAttrib(EGL_NONE, EGL_NONE); if (fbconfig->sRGB)
{
if (_glfw.egl.KHR_gl_colorspace)
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
}
native = _glfwPlatformGetEGLNativeWindow(window); setAttrib(EGL_NONE, EGL_NONE);
// HACK: ANGLE does not implement eglCreatePlatformWindowSurfaceEXT
// despite reporting EGL_EXT_platform_base
if (_glfw.egl.platform && _glfw.egl.platform != EGL_PLATFORM_ANGLE_ANGLE)
{
window->context.egl.surface =
eglCreatePlatformWindowSurfaceEXT(_glfw.egl.display, window->context.egl.config, native, attribs);
}
else
{
window->context.egl.surface =
eglCreateWindowSurface(_glfw.egl.display, window->context.egl.config, native, attribs);
} }
window->context.egl.surface = window->context.egl.surface =
...@@ -640,6 +613,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, ...@@ -640,6 +613,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
return GLFW_FALSE; return GLFW_FALSE;
} }
window->context.egl.config = config;
// Load the appropriate client library // Load the appropriate client library
if (!_glfw.egl.KHR_get_all_proc_addresses) if (!_glfw.egl.KHR_get_all_proc_addresses)
...@@ -774,54 +748,10 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, ...@@ -774,54 +748,10 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig,
} }
#endif // _GLFW_X11 #endif // _GLFW_X11
static void _glfwMakeUserContextCurrentEGL(_GLFWusercontext* context)
{
if (!eglMakeCurrent(_glfw.egl.display,
context->window->context.egl.surface,
context->window->context.egl.surface,
context->egl.handle))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to make user context current: %s",
getEGLErrorString(eglGetError()));
_glfwPlatformSetTls(&_glfw.usercontextSlot, NULL);
return;
}
_glfwPlatformSetTls(&_glfw.usercontextSlot, context);
}
static void _glfwDestroyUserContextEGL(_GLFWusercontext* context)
{
if (context->egl.handle)
{
eglDestroyContext(_glfw.egl.display, context->egl.handle);
}
free(context);
}
_GLFWusercontext* _glfwCreateUserContextEGL(_GLFWwindow* window) _GLFWusercontext* _glfwCreateUserContextEGL(_GLFWwindow* window)
{ {
_GLFWusercontext* context; // TODO
_GLFWctxconfig ctxconfig; return NULL;
context = calloc(1, sizeof(_GLFWusercontext));
context->window = window;
ctxconfig = _glfw.hints.context;
ctxconfig.share = window;
if(!_glfwCreateContextForConfigEGL(window,&ctxconfig,&context->egl.handle))
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"EGL: Failed to create user OpenGL context");
free(context);
return NULL;
}
context->makeCurrent = _glfwMakeUserContextCurrentEGL;
context->destroy = _glfwDestroyUserContextEGL;
return context;
} }
......
...@@ -123,13 +123,6 @@ typedef struct _GLFWcontextWGL ...@@ -123,13 +123,6 @@ typedef struct _GLFWcontextWGL
} _GLFWcontextWGL; } _GLFWcontextWGL;
// WGL-specific user context data
//
typedef struct _GLFWusercontextWGL
{
HGLRC handle;
} _GLFWusercontextWGL;
// WGL-specific global data // WGL-specific global data
// //
typedef struct _GLFWlibraryWGL typedef struct _GLFWlibraryWGL
...@@ -163,6 +156,13 @@ typedef struct _GLFWlibraryWGL ...@@ -163,6 +156,13 @@ typedef struct _GLFWlibraryWGL
} _GLFWlibraryWGL; } _GLFWlibraryWGL;
// WGL-specific user context data
//
typedef struct _GLFWusercontextWGL
{
HGLRC handle;
} _GLFWusercontextWGL;
GLFWbool _glfwInitWGL(void); GLFWbool _glfwInitWGL(void);
void _glfwTerminateWGL(void); void _glfwTerminateWGL(void);
GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, GLFWbool _glfwCreateContextWGL(_GLFWwindow* window,
......
...@@ -77,7 +77,6 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR ...@@ -77,7 +77,6 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
#define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; } #define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; }
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; } #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; }
#define _GLFW_PLATFORM_USER_CONTEXT_STATE struct { int dummyUserContext; }
struct wl_cursor_image { struct wl_cursor_image {
uint32_t width; uint32_t width;
......
...@@ -1874,19 +1874,6 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, ...@@ -1874,19 +1874,6 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
return err; return err;
} }
_GLFWusercontext* _glfwPlatformCreateUserContext(_GLFWwindow* window)
{
if (window->context.egl.handle)
{
return _glfwCreateUserContextEGL(window);
}
else if (window->context.osmesa.handle)
{
return _glfwCreateUserContextOSMesa(window);
}
return GLFW_FALSE;
}
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW native API ////// ////// GLFW native API //////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment