diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 7c76515dd31..84654175cc0 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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 diff --git a/src/egl/drivers/wgl/egl_wgl.c b/src/egl/drivers/wgl/egl_wgl.c index 5b7d80f9d2d..a97abe156f9 100644 --- a/src/egl/drivers/wgl/egl_wgl.c +++ b/src/egl/drivers/wgl/egl_wgl.c @@ -46,7 +46,8 @@ #include #include "util/u_call_once.h" -#include +#include "mapi/glapi/glapi.h" +#include "mesa/main/dispatch.h" #include @@ -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(), ()); } /** diff --git a/src/egl/meson.build b/src/egl/meson.build index 8b75098cad3..a02b83419c4 100644 --- a/src/egl/meson.build +++ b/src/egl/meson.build @@ -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