[Bf-blender-cvs] [5584cad5d90] blender2.8: GHOST: WGL: Silence Errors when testing opengl context versions
Clément Foucault
noreply at git.blender.org
Wed Dec 5 21:57:59 CET 2018
Commit: 5584cad5d90ec56febaca96e6ea1326c15523fa4
Author: Clément Foucault
Date: Wed Dec 5 21:57:35 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB5584cad5d90ec56febaca96e6ea1326c15523fa4
GHOST: WGL: Silence Errors when testing opengl context versions
===================================================================
M intern/ghost/intern/GHOST_Context.cpp
M intern/ghost/intern/GHOST_Context.h
M intern/ghost/intern/GHOST_ContextWGL.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_Context.cpp b/intern/ghost/intern/GHOST_Context.cpp
index e02f73ad12a..775492755a9 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -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) {
diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h
index 327ecd4b245..842736691e3 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -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 */
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 9605f7ddff2..6cb92567b99 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -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;
}
More information about the Bf-blender-cvs
mailing list