mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-02 20:36:50 -05:00
Removed fatal error on SetPixelFormat to prevent failure when window is created with SDL and SDL_WINDOW_OPENGL flag.
This commit is contained in:
parent
c8ac5690ba
commit
6f7c04a43c
2 changed files with 13 additions and 6 deletions
14
src/bgfx_p.h
14
src/bgfx_p.h
|
@ -22,13 +22,12 @@ namespace bgfx
|
||||||
void dbgPrintf(const char* _format, ...);
|
void dbgPrintf(const char* _format, ...);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BGFX_CONFIG_DEBUG
|
#define BX_TRACE_(_format, ...) \
|
||||||
# define BX_TRACE(_format, ...) \
|
|
||||||
do { \
|
do { \
|
||||||
bgfx::dbgPrintf(BX_FILE_LINE_LITERAL "BGFX " _format "\n", ##__VA_ARGS__); \
|
bgfx::dbgPrintf(BX_FILE_LINE_LITERAL "BGFX " _format "\n", ##__VA_ARGS__); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
# define BX_WARN(_condition, _format, ...) \
|
#define BX_WARN_(_condition, _format, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (!(_condition) ) \
|
if (!(_condition) ) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -36,7 +35,7 @@ namespace bgfx
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
# define BX_CHECK(_condition, _format, ...) \
|
#define BX_CHECK_(_condition, _format, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (!(_condition) ) \
|
if (!(_condition) ) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -44,7 +43,12 @@ namespace bgfx
|
||||||
bgfx::fatal(bgfx::Fatal::DebugCheck, _format, ##__VA_ARGS__); \
|
bgfx::fatal(bgfx::Fatal::DebugCheck, _format, ##__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
#endif // 0
|
|
||||||
|
#if BGFX_CONFIG_DEBUG
|
||||||
|
# define BX_TRACE BX_TRACE_
|
||||||
|
# define BX_WARN BX_WARN_
|
||||||
|
# define BX_CHECK BX_CHECK_
|
||||||
|
#endif // BGFX_CONFIG_DEBUG
|
||||||
|
|
||||||
#define BGFX_FATAL(_condition, _err, _format, ...) \
|
#define BGFX_FATAL(_condition, _err, _format, ...) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -183,7 +183,10 @@ namespace bgfx
|
||||||
);
|
);
|
||||||
|
|
||||||
result = SetPixelFormat(m_hdc, pixelFormat, &pfd);
|
result = SetPixelFormat(m_hdc, pixelFormat, &pfd);
|
||||||
BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "SetPixelFormat failed (last err: 0x%08x)!", GetLastError() );
|
// When window is created by SDL and SDL_WINDOW_OPENGL is set SetPixelFormat
|
||||||
|
// will fail. Just warn and continue. In case it failed for some other reason
|
||||||
|
// create context will fail and it will error out there.
|
||||||
|
BX_WARN(result, "SetPixelFormat failed (last err: 0x%08x)!", GetLastError() );
|
||||||
|
|
||||||
uint32_t flags = BGFX_CONFIG_DEBUG ? WGL_CONTEXT_DEBUG_BIT_ARB : 0;
|
uint32_t flags = BGFX_CONFIG_DEBUG ? WGL_CONTEXT_DEBUG_BIT_ARB : 0;
|
||||||
BX_UNUSED(flags);
|
BX_UNUSED(flags);
|
||||||
|
|
Loading…
Reference in a new issue