2016-05-11 10:33:49 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include "angle_dynamic.h"
|
|
|
|
|
|
|
|
#include "common/common.h"
|
2023-10-21 02:55:41 +00:00
|
|
|
#include "osdep/threads.h"
|
2016-05-11 10:33:49 +00:00
|
|
|
|
2016-11-24 21:41:09 +00:00
|
|
|
#if HAVE_EGL_ANGLE_LIB
|
|
|
|
bool angle_load(void)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#else
|
2016-05-11 10:33:49 +00:00
|
|
|
#define ANGLE_DECL(NAME, VAR) \
|
|
|
|
VAR;
|
|
|
|
ANGLE_FNS(ANGLE_DECL)
|
|
|
|
|
|
|
|
static bool angle_loaded;
|
2023-10-21 02:55:41 +00:00
|
|
|
static mp_once angle_load_once = MP_STATIC_ONCE_INITIALIZER;
|
2016-05-11 10:33:49 +00:00
|
|
|
|
|
|
|
static void angle_do_load(void)
|
|
|
|
{
|
|
|
|
// Note: we let this handle "leak", as the functions remain valid forever.
|
|
|
|
HANDLE angle_dll = LoadLibraryW(L"LIBEGL.DLL");
|
|
|
|
if (!angle_dll)
|
|
|
|
return;
|
|
|
|
#define ANGLE_LOAD_ENTRY(NAME, VAR) \
|
2023-01-19 16:03:17 +00:00
|
|
|
NAME = (void *)GetProcAddress(angle_dll, #NAME); \
|
|
|
|
if (!NAME) return;
|
2016-05-11 10:33:49 +00:00
|
|
|
ANGLE_FNS(ANGLE_LOAD_ENTRY)
|
|
|
|
angle_loaded = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool angle_load(void)
|
|
|
|
{
|
2023-10-21 02:55:41 +00:00
|
|
|
mp_exec_once(&angle_load_once, angle_do_load);
|
2016-05-11 10:33:49 +00:00
|
|
|
return angle_loaded;
|
|
|
|
}
|
2016-11-24 21:41:09 +00:00
|
|
|
#endif
|