From 683e91785480735ccc37947d274c3934325583e6 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Sat, 9 Mar 2024 16:04:09 +0100 Subject: [PATCH] cogl/winsys: Remove eglGetProcAddress workaround for EGL < 1.5 `eglGetProcAddress()` used to not work for core API in EGL versions below 1.5. The workaround in place in turn can fail - notably for setups with a local Mesa build in /usr/local. EGL 1.5 is almost 10 years old and similar workarounds don't seem to be in place for toolkits we rely on, notably GTK4. Thus remove it. Part-of: --- cogl/cogl/cogl-feature-private.c | 7 +------ cogl/cogl/cogl-renderer-private.h | 3 +-- cogl/cogl/cogl-renderer.c | 5 ++--- cogl/cogl/cogl.c | 2 +- cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 9 +++------ cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 6 ++---- cogl/cogl/winsys/cogl-winsys-egl.c | 15 ++------------- cogl/cogl/winsys/cogl-winsys-glx.c | 7 +------ cogl/cogl/winsys/cogl-winsys-private.h | 3 +-- 9 files changed, 14 insertions(+), 43 deletions(-) diff --git a/cogl/cogl/cogl-feature-private.c b/cogl/cogl/cogl-feature-private.c index cdb4646af..1ef42b87d 100644 --- a/cogl/cogl/cogl-feature-private.c +++ b/cogl/cogl/cogl-feature-private.c @@ -52,7 +52,6 @@ _cogl_feature_check (CoglRenderer *renderer, const char *suffix = NULL; int func_num; CoglExtGlesAvailability gles_availability = 0; - gboolean in_core; switch (driver) { @@ -77,7 +76,6 @@ _cogl_feature_check (CoglRenderer *renderer, (data->gles_availability & gles_availability)) { suffix = ""; - in_core = TRUE; } else { @@ -130,8 +128,6 @@ _cogl_feature_check (CoglRenderer *renderer, break; } } - - in_core = FALSE; } /* If we couldn't find anything that provides the functions then @@ -148,8 +144,7 @@ _cogl_feature_check (CoglRenderer *renderer, full_function_name = g_strconcat (data->functions[func_num].name, suffix, NULL); func = _cogl_renderer_get_proc_address (renderer, - full_function_name, - in_core); + full_function_name); g_free (full_function_name); if (func == NULL) diff --git a/cogl/cogl/cogl-renderer-private.h b/cogl/cogl/cogl-renderer-private.h index 996445816..8fd915527 100644 --- a/cogl/cogl/cogl-renderer-private.h +++ b/cogl/cogl/cogl-renderer-private.h @@ -96,5 +96,4 @@ _cogl_renderer_remove_native_filter (CoglRenderer *renderer, void * _cogl_renderer_get_proc_address (CoglRenderer *renderer, - const char *name, - gboolean in_core); + const char *name); diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c index 96cc0e4b0..8e8bc4a4f 100644 --- a/cogl/cogl/cogl-renderer.c +++ b/cogl/cogl/cogl-renderer.c @@ -699,12 +699,11 @@ cogl_renderer_get_winsys_id (CoglRenderer *renderer) void * _cogl_renderer_get_proc_address (CoglRenderer *renderer, - const char *name, - gboolean in_core) + const char *name) { const CoglWinsysVtable *winsys = _cogl_renderer_get_winsys (renderer); - return winsys->renderer_get_proc_address (renderer, name, in_core); + return winsys->renderer_get_proc_address (renderer, name); } void diff --git a/cogl/cogl/cogl.c b/cogl/cogl/cogl.c index 8ae5a754c..924e18e14 100644 --- a/cogl/cogl/cogl.c +++ b/cogl/cogl/cogl.c @@ -59,7 +59,7 @@ cogl_get_proc_address (const char* name) { _COGL_GET_CONTEXT (ctx, NULL); - return _cogl_renderer_get_proc_address (ctx->display->renderer, name, FALSE); + return _cogl_renderer_get_proc_address (ctx->display->renderer, name); } gboolean diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index a8407b767..84ddfce99 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -430,16 +430,13 @@ _cogl_driver_update_features (CoglContext *ctx, we can expect */ ctx->glGetString = (void *) _cogl_renderer_get_proc_address (ctx->display->renderer, - "glGetString", - TRUE); + "glGetString"); ctx->glGetStringi = (void *) _cogl_renderer_get_proc_address (ctx->display->renderer, - "glGetStringi", - TRUE); + "glGetStringi"); ctx->glGetIntegerv = (void *) _cogl_renderer_get_proc_address (ctx->display->renderer, - "glGetIntegerv", - TRUE); + "glGetIntegerv"); gl_extensions = _cogl_context_get_gl_extensions (ctx); diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c index 3cb8ab05f..2931e8fc4 100644 --- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c @@ -579,12 +579,10 @@ _cogl_driver_update_features (CoglContext *context, can expect */ context->glGetString = (void *) _cogl_renderer_get_proc_address (context->display->renderer, - "glGetString", - TRUE); + "glGetString"); context->glGetStringi = (void *) _cogl_renderer_get_proc_address (context->display->renderer, - "glGetStringi", - TRUE); + "glGetStringi"); gl_extensions = _cogl_context_get_gl_extensions (context); diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c index bea87bcf2..ee7c1df54 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/cogl/winsys/cogl-winsys-egl.c @@ -111,20 +111,9 @@ static const CoglFeatureData winsys_feature_data[] = static GCallback _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, - const char *name, - gboolean in_core) + const char *name) { - void *ptr = NULL; - - if (!in_core) - ptr = eglGetProcAddress (name); - - /* eglGetProcAddress doesn't support fetching core API so we need to - get that separately with GModule */ - if (ptr == NULL) - g_module_symbol (renderer->libgl_module, name, &ptr); - - return ptr; + return eglGetProcAddress (name); } static void diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index 2e9b489b1..c5d572796 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -141,15 +141,10 @@ static const CoglFeatureData winsys_feature_data[] = static GCallback _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, - const char *name, - gboolean in_core) + const char *name) { CoglGLXRenderer *glx_renderer = renderer->winsys; - /* The GLX_ARB_get_proc_address extension documents that this should - * work for core functions too so we don't need to do anything - * special with in_core */ - return glx_renderer->glXGetProcAddress ((const GLubyte *) name); } diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h index f8fc0fc91..7dfbd13ed 100644 --- a/cogl/cogl/winsys/cogl-winsys-private.h +++ b/cogl/cogl/winsys/cogl-winsys-private.h @@ -68,8 +68,7 @@ typedef struct _CoglWinsysVtable GCallback (*renderer_get_proc_address) (CoglRenderer *renderer, - const char *name, - gboolean in_core); + const char *name); gboolean (*renderer_connect) (CoglRenderer *renderer,