This commit is contained in:
Бранимир Караџић 2019-03-22 16:20:56 -07:00
parent 2eaad444b5
commit e574edcd47

View File

@ -40,21 +40,21 @@ namespace bgfx { namespace gl
typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval); typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
typedef EGLBoolean (EGLAPIENTRY* PFNEGLTERMINATEPROC)(EGLDisplay dpy); typedef EGLBoolean (EGLAPIENTRY* PFNEGLTERMINATEPROC)(EGLDisplay dpy);
#define EGL_IMPORT \ #define EGL_IMPORT \
EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \ EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \
EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); \ EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); \
EGL_IMPORT_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); \ EGL_IMPORT_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); \
EGL_IMPORT_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay); \ EGL_IMPORT_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay); \
EGL_IMPORT_FUNC(PFNEGLGETERRORPROC, eglGetError); \ EGL_IMPORT_FUNC(PFNEGLGETERRORPROC, eglGetError); \
EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \ EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \
EGL_IMPORT_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext); \ EGL_IMPORT_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext); \
EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); \ EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); \
EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \ EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \
EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \ EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \
EGL_IMPORT_FUNC(PGNEGLQUERYSTRINGPROC, eglQueryString); \ EGL_IMPORT_FUNC(PGNEGLQUERYSTRINGPROC, eglQueryString); \
EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \ EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \
EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \ EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \
EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate);
#define EGL_IMPORT_FUNC(_proto, _func) _proto _func #define EGL_IMPORT_FUNC(_proto, _func) _proto _func
EGL_IMPORT EGL_IMPORT
@ -65,10 +65,10 @@ EGL_IMPORT
void* handle = bx::dlopen("libEGL." BX_DL_EXT); void* handle = bx::dlopen("libEGL." BX_DL_EXT);
BGFX_FATAL(NULL != handle, Fatal::UnableToInitialize, "Failed to load libEGL dynamic library."); BGFX_FATAL(NULL != handle, Fatal::UnableToInitialize, "Failed to load libEGL dynamic library.");
#define EGL_IMPORT_FUNC(_proto, _func) \ #define EGL_IMPORT_FUNC(_proto, _func) \
_func = (_proto)bx::dlsym(handle, #_func); \ _func = (_proto)bx::dlsym(handle, #_func); \
BX_TRACE("%p " #_func, _func); \ BX_TRACE("%p " #_func, _func); \
BGFX_FATAL(NULL != _func, Fatal::UnableToInitialize, "Failed get " #_func ".") BGFX_FATAL(NULL != _func, Fatal::UnableToInitialize, "Failed get " #_func ".")
EGL_IMPORT EGL_IMPORT
#undef EGL_IMPORT_FUNC #undef EGL_IMPORT_FUNC
@ -439,26 +439,27 @@ EGL_IMPORT
BX_TRACE("Import:"); BX_TRACE("Import:");
# if BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX # if BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX
void* glesv2 = bx::dlopen("libGLESv2." BX_DL_EXT); void* glesv2 = bx::dlopen("libGLESv2." BX_DL_EXT);
# define GL_EXTENSION(_optional, _proto, _func, _import) \ # define GL_EXTENSION(_optional, _proto, _func, _import) \
{ \ { \
if (NULL == _func) \ if (NULL == _func) \
{ \ { \
_func = (_proto)bx::dlsym(glesv2, #_import); \ _func = (_proto)bx::dlsym(glesv2, #_import); \
BX_TRACE("\t%p " #_func " (" #_import ")", _func); \ BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \ BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \
} \ } \
} }
# else # else
# define GL_EXTENSION(_optional, _proto, _func, _import) \ # define GL_EXTENSION(_optional, _proto, _func, _import) \
{ \ { \
if (NULL == _func) \ if (NULL == _func) \
{ \ { \
_func = (_proto)eglGetProcAddress(#_import); \ _func = (_proto)eglGetProcAddress(#_import); \
BX_TRACE("\t%p " #_func " (" #_import ")", _func); \ BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \ BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \
} \ } \
} }
# endif // BX_PLATFORM_ # endif // BX_PLATFORM_
# include "glimports.h" # include "glimports.h"
} }