egl: use the current dispatch to execute glFlush instead of get_proc_address

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33794>
This commit is contained in:
Marek Olšák 2025-03-03 21:09:17 -05:00 committed by Marge Bot
parent 8bb7033095
commit 0a330b1660
3 changed files with 8 additions and 39 deletions

View file

@ -74,6 +74,8 @@
#include "util/u_vector.h"
#include "egl_dri2.h"
#include "egldefines.h"
#include "mapi/glapi/glapi.h"
#include "mesa/main/dispatch.h"
#define NUM_ATTRIBS 16
@ -96,28 +98,10 @@ dri_set_background_context(void *loaderPrivate)
_eglBindContextToThread(ctx, t);
}
static void
dri2_gl_flush_get(_glapi_proc *glFlush)
{
*glFlush = _mesa_glapi_get_proc_address("glFlush");
}
static void
dri2_gl_flush()
{
static void (*glFlush)(void);
static util_once_flag once = UTIL_ONCE_FLAG_INIT;
util_call_once_data(&once, (util_call_once_data_func)dri2_gl_flush_get,
&glFlush);
/* if glFlush is not available things are horribly broken */
if (!glFlush) {
_eglLog(_EGL_WARNING, "DRI2: failed to find glFlush entry point");
return;
}
glFlush();
CALL_Flush(GET_DISPATCH(), ());
}
static GLboolean

View file

@ -46,7 +46,8 @@
#include <pipe/p_state.h>
#include "util/u_call_once.h"
#include <mapi/glapi/glapi.h>
#include "mapi/glapi/glapi.h"
#include "mesa/main/dispatch.h"
#include <GL/mesa_glinterop.h>
@ -505,28 +506,10 @@ wgl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
return EGL_TRUE;
}
static void
wgl_gl_flush_get(_glapi_proc *glFlush)
{
*glFlush = _mesa_glapi_get_proc_address("glFlush");
}
static void
wgl_gl_flush()
{
static void (*glFlush)(void);
static util_once_flag once = UTIL_ONCE_FLAG_INIT;
util_call_once_data(&once, (util_call_once_data_func)wgl_gl_flush_get,
&glFlush);
/* if glFlush is not available things are horribly broken */
if (!glFlush) {
_eglLog(_EGL_WARNING, "wgl: failed to find glFlush entry point");
return;
}
glFlush();
CALL_Flush(GET_DISPATCH(), ());
}
/**

View file

@ -83,6 +83,7 @@ if with_dri
'drivers/dri2/egl_dri2.h',
)
files_egl += sha1_h
files_egl += main_dispatch_h
deps_for_egl += idep_xmlconfig
link_for_egl += libloader
incs_for_egl += inc_loader
@ -140,6 +141,7 @@ elif with_platform_windows
'-DEGLAPI=', '-DPUBLIC='
]
files_egl += files('drivers/wgl/egl_wgl.c')
files_egl += main_dispatch_h
incs_for_egl += [inc_wgl, inc_gallium, inc_gallium_aux, inc_mesa, inc_mapi]
link_for_egl += libgallium_wgl