This commit is contained in:
Бранимир Караџић
2020-09-02 20:43:47 -07:00
parent 0093a67681
commit 8f4750b199
6 changed files with 116 additions and 73 deletions

View File

@@ -444,30 +444,41 @@ EGL_IMPORT
void GlContext::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 = BGFX_CAST_FUNCTION(_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 = bx::functionCast<_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 = BGFX_CAST_FUNCTION(_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 = bx::functionCast<_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"
# undef GL_EXTENSION
}
} /* namespace gl */ } // namespace bgfx