From e574edcd47c34465aa58edc781e733cc985cc8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 22 Mar 2019 16:20:56 -0700 Subject: [PATCH] Cleanup. --- src/glcontext_egl.cpp | 75 ++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/glcontext_egl.cpp b/src/glcontext_egl.cpp index f553d2981..0aeb92102 100644 --- a/src/glcontext_egl.cpp +++ b/src/glcontext_egl.cpp @@ -40,21 +40,21 @@ namespace bgfx { namespace gl typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval); typedef EGLBoolean (EGLAPIENTRY* PFNEGLTERMINATEPROC)(EGLDisplay dpy); -#define EGL_IMPORT \ - EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \ - EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); \ - EGL_IMPORT_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); \ - EGL_IMPORT_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay); \ - EGL_IMPORT_FUNC(PFNEGLGETERRORPROC, eglGetError); \ - EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \ - EGL_IMPORT_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext); \ - EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); \ - EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \ - EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \ - EGL_IMPORT_FUNC(PGNEGLQUERYSTRINGPROC, eglQueryString); \ - EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \ - EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \ - EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); +#define EGL_IMPORT \ + EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \ + EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); \ + EGL_IMPORT_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); \ + EGL_IMPORT_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay); \ + EGL_IMPORT_FUNC(PFNEGLGETERRORPROC, eglGetError); \ + EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \ + EGL_IMPORT_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext); \ + EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); \ + EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \ + EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \ + EGL_IMPORT_FUNC(PGNEGLQUERYSTRINGPROC, eglQueryString); \ + EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \ + EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \ + EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); #define EGL_IMPORT_FUNC(_proto, _func) _proto _func EGL_IMPORT @@ -65,10 +65,10 @@ EGL_IMPORT void* handle = bx::dlopen("libEGL." BX_DL_EXT); BGFX_FATAL(NULL != handle, Fatal::UnableToInitialize, "Failed to load libEGL dynamic library."); -#define EGL_IMPORT_FUNC(_proto, _func) \ - _func = (_proto)bx::dlsym(handle, #_func); \ - BX_TRACE("%p " #_func, _func); \ - BGFX_FATAL(NULL != _func, Fatal::UnableToInitialize, "Failed get " #_func ".") +#define EGL_IMPORT_FUNC(_proto, _func) \ + _func = (_proto)bx::dlsym(handle, #_func); \ + BX_TRACE("%p " #_func, _func); \ + BGFX_FATAL(NULL != _func, Fatal::UnableToInitialize, "Failed get " #_func ".") EGL_IMPORT #undef EGL_IMPORT_FUNC @@ -439,26 +439,27 @@ EGL_IMPORT BX_TRACE("Import:"); # if BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX void* glesv2 = bx::dlopen("libGLESv2." BX_DL_EXT); -# define GL_EXTENSION(_optional, _proto, _func, _import) \ - { \ - if (NULL == _func) \ - { \ - _func = (_proto)bx::dlsym(glesv2, #_import); \ - BX_TRACE("\t%p " #_func " (" #_import ")", _func); \ - BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \ - } \ - } +# define GL_EXTENSION(_optional, _proto, _func, _import) \ + { \ + if (NULL == _func) \ + { \ + _func = (_proto)bx::dlsym(glesv2, #_import); \ + BX_TRACE("\t%p " #_func " (" #_import ")", _func); \ + BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \ + } \ + } # else -# define GL_EXTENSION(_optional, _proto, _func, _import) \ - { \ - if (NULL == _func) \ - { \ - _func = (_proto)eglGetProcAddress(#_import); \ - BX_TRACE("\t%p " #_func " (" #_import ")", _func); \ - BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \ - } \ - } +# define GL_EXTENSION(_optional, _proto, _func, _import) \ + { \ + if (NULL == _func) \ + { \ + _func = (_proto)eglGetProcAddress(#_import); \ + BX_TRACE("\t%p " #_func " (" #_import ")", _func); \ + BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \ + } \ + } # endif // BX_PLATFORM_ + # include "glimports.h" }