GHOST: WGL: Silence Errors when testing opengl context versions
This commit is contained in:
parent
0424ee86f0
commit
5584cad5d9
|
@ -48,6 +48,15 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
|
||||
bool win32_silent_chk(bool result)
|
||||
{
|
||||
if (!result) {
|
||||
SetLastError(NO_ERROR);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool win32_chk(bool result, const char *file, int line, const char *text)
|
||||
{
|
||||
if (!result) {
|
||||
|
|
|
@ -148,12 +148,15 @@ protected:
|
|||
|
||||
#ifdef _WIN32
|
||||
bool win32_chk(bool result, const char *file = NULL, int line = 0, const char *text = NULL);
|
||||
bool win32_silent_chk(bool result);
|
||||
|
||||
# ifndef NDEBUG
|
||||
# define WIN32_CHK(x) win32_chk((x), __FILE__, __LINE__, #x)
|
||||
# else
|
||||
# define WIN32_CHK(x) win32_chk(x)
|
||||
# endif
|
||||
|
||||
#define WIN32_CHK_SILENT(x, silent) ((silent) ? win32_silent_chk(x) : WIN32_CHK(x))
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
||||
|
|
|
@ -789,7 +789,10 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
|
|||
m_hGLRC = ::wglCreateContextAttribsARB(m_hDC, NULL, &(iAttributes[0]));
|
||||
}
|
||||
|
||||
if (!WIN32_CHK(m_hGLRC != NULL)) {
|
||||
/* Silence warnings interpreted as errors by users when trying to get
|
||||
* a context with version higher than 3.3 Core. */
|
||||
const bool silent = m_contextMajorVersion > 3;
|
||||
if (!WIN32_CHK_SILENT(m_hGLRC != NULL, silent)) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue