Cleanup.
This commit is contained in:
parent
73508ac80f
commit
2996246a90
@ -86,7 +86,7 @@ namespace bgfx { namespace gl
|
|||||||
template<typename ProtoT>
|
template<typename ProtoT>
|
||||||
static ProtoT glXGetProcAddress(const char* _name)
|
static ProtoT glXGetProcAddress(const char* _name)
|
||||||
{
|
{
|
||||||
return bx::functionCast<ProtoT>( (void*)::glXGetProcAddress( (const GLubyte*)_name) );
|
return reinterpret_cast<ProtoT>( (void*)::glXGetProcAddress( (const GLubyte*)_name) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
void GlContext::create(uint32_t _width, uint32_t _height)
|
||||||
|
@ -183,21 +183,21 @@ namespace bgfx { namespace gl
|
|||||||
{
|
{
|
||||||
BX_TRACE("Import:");
|
BX_TRACE("Import:");
|
||||||
|
|
||||||
# define GL_EXTENSION(_optional, _proto, _func, _import) \
|
# define GL_EXTENSION(_optional, _proto, _func, _import) \
|
||||||
{ \
|
{ \
|
||||||
if (NULL == _func) \
|
if (NULL == _func) \
|
||||||
{ \
|
{ \
|
||||||
_func = (_proto)emscripten_webgl1_get_proc_address(#_import); \
|
_func = (_proto)emscripten_webgl1_get_proc_address(#_import); \
|
||||||
if (!_func && webGLVersion >= 2) \
|
if (!_func && webGLVersion >= 2) \
|
||||||
{ \
|
{ \
|
||||||
_func = bx::functionCast<_proto>(emscripten_webgl2_get_proc_address(#_import); \
|
_func = reinterpret_cast<ProtoT><_proto>(emscripten_webgl2_get_proc_address(#_import); \
|
||||||
} \
|
} \
|
||||||
BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
|
BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
|
||||||
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize \
|
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize \
|
||||||
, "Failed to create WebGL/OpenGLES context. GetProcAddress(\"%s\")" \
|
, "Failed to create WebGL/OpenGLES context. GetProcAddress(\"%s\")" \
|
||||||
, #_import \
|
, #_import \
|
||||||
); \
|
); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
# include "glimports.h"
|
# include "glimports.h"
|
||||||
|
@ -23,6 +23,13 @@ namespace bgfx { namespace gl
|
|||||||
|
|
||||||
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
|
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
|
||||||
# include "glimports.h"
|
# include "glimports.h"
|
||||||
|
# undef GL_IMPORT
|
||||||
|
|
||||||
|
template<typename ProtoT>
|
||||||
|
static ProtoT wglGetProc(const char* _name)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<ProtoT>( (void*)wglGetProcAddress(_name) );
|
||||||
|
}
|
||||||
|
|
||||||
struct SwapChainGL
|
struct SwapChainGL
|
||||||
{
|
{
|
||||||
@ -109,8 +116,6 @@ namespace bgfx { namespace gl
|
|||||||
wglGetProcAddress = bx::dlsym<PFNWGLGETPROCADDRESSPROC>(m_opengl32dll, "wglGetProcAddress");
|
wglGetProcAddress = bx::dlsym<PFNWGLGETPROCADDRESSPROC>(m_opengl32dll, "wglGetProcAddress");
|
||||||
BGFX_FATAL(NULL != wglGetProcAddress, Fatal::UnableToInitialize, "Failed get wglGetProcAddress.");
|
BGFX_FATAL(NULL != wglGetProcAddress, Fatal::UnableToInitialize, "Failed get wglGetProcAddress.");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// If g_platformHooks.nwh is NULL, the assumption is that GL context was created
|
// If g_platformHooks.nwh is NULL, the assumption is that GL context was created
|
||||||
// by user (for example, using SDL, GLFW, etc.)
|
// by user (for example, using SDL, GLFW, etc.)
|
||||||
BX_WARN(NULL != g_platformData.nwh
|
BX_WARN(NULL != g_platformData.nwh
|
||||||
@ -171,10 +176,10 @@ namespace bgfx { namespace gl
|
|||||||
|
|
||||||
HGLRC context = createContext(hdc);
|
HGLRC context = createContext(hdc);
|
||||||
|
|
||||||
wglGetExtensionsStringARB = bx::functionCast<PFNWGLGETEXTENSIONSSTRINGARBPROC >(wglGetProcAddress("wglGetExtensionsStringARB") );
|
wglGetExtensionsStringARB = wglGetProc<PFNWGLGETEXTENSIONSSTRINGARBPROC >("wglGetExtensionsStringARB");
|
||||||
wglChoosePixelFormatARB = bx::functionCast<PFNWGLCHOOSEPIXELFORMATARBPROC >(wglGetProcAddress("wglChoosePixelFormatARB") );
|
wglChoosePixelFormatARB = wglGetProc<PFNWGLCHOOSEPIXELFORMATARBPROC >("wglChoosePixelFormatARB");
|
||||||
wglCreateContextAttribsARB = bx::functionCast<PFNWGLCREATECONTEXTATTRIBSARBPROC>(wglGetProcAddress("wglCreateContextAttribsARB") );
|
wglCreateContextAttribsARB = wglGetProc<PFNWGLCREATECONTEXTATTRIBSARBPROC>("wglCreateContextAttribsARB");
|
||||||
wglSwapIntervalEXT = bx::functionCast<PFNWGLSWAPINTERVALEXTPROC >(wglGetProcAddress("wglSwapIntervalEXT") );
|
wglSwapIntervalEXT = wglGetProc<PFNWGLSWAPINTERVALEXTPROC >("wglSwapIntervalEXT");
|
||||||
|
|
||||||
if (NULL != wglGetExtensionsStringARB)
|
if (NULL != wglGetExtensionsStringARB)
|
||||||
{
|
{
|
||||||
@ -392,7 +397,7 @@ namespace bgfx { namespace gl
|
|||||||
{ \
|
{ \
|
||||||
if (NULL == _func) \
|
if (NULL == _func) \
|
||||||
{ \
|
{ \
|
||||||
_func = bx::functionCast<_proto>(wglGetProcAddress(#_import) ); \
|
_func = wglGetProc<_proto>(#_import); \
|
||||||
if (NULL == _func) \
|
if (NULL == _func) \
|
||||||
{ \
|
{ \
|
||||||
_func = bx::dlsym<_proto>(m_opengl32dll, #_import); \
|
_func = bx::dlsym<_proto>(m_opengl32dll, #_import); \
|
||||||
|
Loading…
Reference in New Issue
Block a user