mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 09:40:40 +02:00
egl/wgl: Use util_call_once_data to replace usage of mtx_t glFlushMutex
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19154>
This commit is contained in:
parent
81ef38f484
commit
56a34d1568
1 changed files with 10 additions and 5 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include <pipe/p_context.h>
|
||||
|
||||
#include <mapi/glapi/glapi.h>
|
||||
#include "util/u_call_once.h"
|
||||
|
||||
static EGLBoolean
|
||||
wgl_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
|
||||
|
|
@ -523,16 +524,20 @@ wgl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
|||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
wgl_gl_flush_get(_glapi_proc *glFlush)
|
||||
{
|
||||
*glFlush = _glapi_get_proc_address("glFlush");
|
||||
}
|
||||
|
||||
static void
|
||||
wgl_gl_flush()
|
||||
{
|
||||
static void (*glFlush)(void);
|
||||
static mtx_t glFlushMutex = _MTX_INITIALIZER_NP;
|
||||
static util_once_flag once = UTIL_ONCE_FLAG_INIT;
|
||||
|
||||
mtx_lock(&glFlushMutex);
|
||||
if (!glFlush)
|
||||
glFlush = _glapi_get_proc_address("glFlush");
|
||||
mtx_unlock(&glFlushMutex);
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue