Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-12-05 23:57:35 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-05 23:57:49 +0300
commit5584cad5d90ec56febaca96e6ea1326c15523fa4 (patch)
tree419fe939e417949f9fe25660f2049b11e330cc7c /intern
parent0424ee86f0082db3a62f2f833bca63dd2e899dae (diff)
GHOST: WGL: Silence Errors when testing opengl context versions
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_Context.cpp9
-rw-r--r--intern/ghost/intern/GHOST_Context.h3
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp5
3 files changed, 16 insertions, 1 deletions
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;
}