mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
cogl/renderer: Add API to bind the right EGL API
We need to call eglBindAPI() with GLES before we setup the secondary GPU blit. We've been lucky not really needing this, as it has been GLES default, which is what the secondary blit uses, in order to not depend on the default, or if we want to create the secondary blit objects after initializing cogl, we must make sure to bind the right API at the right time. As we need to bind the GLES API when setting up the secondary blit, we need to make sure that cogl gets the right API bound when that's done, so Cogl can continue working. For this, add a "bind_api()" method on the CoglRenderer object, that will know what API is correct to bind. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1828>
This commit is contained in:
parent
173d895d53
commit
5e45dc15b6
@ -774,3 +774,11 @@ cogl_renderer_create_dma_buf (CoglRenderer *renderer,
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
cogl_renderer_bind_api (CoglRenderer *renderer)
|
||||
{
|
||||
const CoglWinsysVtable *winsys = _cogl_renderer_get_winsys (renderer);
|
||||
|
||||
winsys->renderer_bind_api (renderer);
|
||||
}
|
||||
|
@ -419,6 +419,12 @@ cogl_renderer_create_dma_buf (CoglRenderer *renderer,
|
||||
int height,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* cogl_renderer_bind_api: (skip)
|
||||
*/
|
||||
COGL_EXPORT void
|
||||
cogl_renderer_bind_api (CoglRenderer *renderer);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __COGL_RENDERER_H__ */
|
||||
|
@ -134,6 +134,16 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_winsys_renderer_bind_api (CoglRenderer *renderer)
|
||||
{
|
||||
if (renderer->driver == COGL_DRIVER_GL ||
|
||||
renderer->driver == COGL_DRIVER_GL3)
|
||||
eglBindAPI (EGL_OPENGL_API);
|
||||
else if (renderer->driver == COGL_DRIVER_GLES2)
|
||||
eglBindAPI (EGL_OPENGL_ES_API);
|
||||
}
|
||||
|
||||
/* Updates all the function pointers */
|
||||
static void
|
||||
check_egl_extensions (CoglRenderer *renderer)
|
||||
@ -364,11 +374,7 @@ try_create_context (CoglDisplay *display,
|
||||
|
||||
g_return_val_if_fail (egl_display->egl_context == NULL, TRUE);
|
||||
|
||||
if (renderer->driver == COGL_DRIVER_GL ||
|
||||
renderer->driver == COGL_DRIVER_GL3)
|
||||
eglBindAPI (EGL_OPENGL_API);
|
||||
else if (renderer->driver == COGL_DRIVER_GLES2)
|
||||
eglBindAPI (EGL_OPENGL_ES_API);
|
||||
cogl_renderer_bind_api (renderer);
|
||||
|
||||
cogl_display_egl_determine_attributes (display,
|
||||
&display->onscreen_template->config,
|
||||
@ -620,6 +626,7 @@ static CoglWinsysVtable _cogl_winsys_vtable =
|
||||
.renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address,
|
||||
.renderer_connect = _cogl_winsys_renderer_connect,
|
||||
.renderer_disconnect = _cogl_winsys_renderer_disconnect,
|
||||
.renderer_bind_api = _cogl_winsys_renderer_bind_api,
|
||||
.display_setup = _cogl_winsys_display_setup,
|
||||
.display_destroy = _cogl_winsys_display_destroy,
|
||||
.context_init = _cogl_winsys_context_init,
|
||||
|
@ -297,6 +297,11 @@ _cogl_winsys_renderer_outputs_changed (CoglRenderer *renderer)
|
||||
update_all_outputs (renderer);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_winsys_renderer_bind_api (CoglRenderer *renderer)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
resolve_core_glx_functions (CoglRenderer *renderer,
|
||||
GError **error)
|
||||
@ -1419,6 +1424,7 @@ static CoglWinsysVtable _cogl_winsys_vtable =
|
||||
.renderer_connect = _cogl_winsys_renderer_connect,
|
||||
.renderer_disconnect = _cogl_winsys_renderer_disconnect,
|
||||
.renderer_outputs_changed = _cogl_winsys_renderer_outputs_changed,
|
||||
.renderer_bind_api = _cogl_winsys_renderer_bind_api,
|
||||
.display_setup = _cogl_winsys_display_setup,
|
||||
.display_destroy = _cogl_winsys_display_destroy,
|
||||
.context_init = _cogl_winsys_context_init,
|
||||
|
@ -97,6 +97,9 @@ typedef struct _CoglWinsysVtable
|
||||
int height,
|
||||
GError **error);
|
||||
|
||||
void
|
||||
(*renderer_bind_api) (CoglRenderer *renderer);
|
||||
|
||||
gboolean
|
||||
(*context_init) (CoglContext *context, GError **error);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user