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:
authorJoshua Leung <aligorith@gmail.com>2015-02-27 03:12:21 +0300
committerJoshua Leung <aligorith@gmail.com>2015-02-27 03:14:09 +0300
commita6ebc9a813fab5e3d56b347b763ce4e99704e69e (patch)
treed34cdc3755fec402e04742197663cfde34196f7c /intern
parent7aa91f5fbcb65ae57af2665b25335ff094dfd5bf (diff)
Compile fixes for mingw64
* m_hDC was always included after m_hWnd in all the constructors and other functions, but the order was reversed in the struct, meaning that they would not get initialised correctly * Got rid of the gotos for the error handling case in initializeDrawingContext() This was causing "jump to label ... crosses initialisation" errors for the calls to get GL version string info (i.e. const char *vendor = ...; etc.) I wasn't sure if those glGetString calls needed the rest of the context to be defined first, so I decided to leave them where they are now, and got rid of the gotos (which were making this particular piece of code a bit confusing) instead. TODO: There are still a bunch of warnings about around 660, which I haven't managed to solve (but at least they won't prevent Blender from compiling) narrowing conversion of '(stereoVisual ? 1063 : 1061)' from 'int' to 'DWORD {aka long unsigned int}' inside { } is ill-formed in C++11 [-Wnarrowing]
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp41
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.h2
2 files changed, 25 insertions, 18 deletions
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index c6e0338c32a..055737481ae 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -733,13 +733,17 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
iPixelFormat = choose_pixel_format(m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, sRGB);
- if (iPixelFormat == 0)
- goto error;
+ if (iPixelFormat == 0) {
+ ::wglMakeCurrent(prevHDC, prevHGLRC);
+ return GHOST_kFailure;
+ }
lastPFD = ::DescribePixelFormat(m_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &chosenPFD);
- if (!WIN32_CHK(lastPFD != 0))
- goto error;
+ if (!WIN32_CHK(lastPFD != 0)) {
+ ::wglMakeCurrent(prevHDC, prevHGLRC);
+ return GHOST_kFailure;
+ }
if (needAlpha && chosenPFD.cAlphaBits == 0)
fprintf(stderr, "Warning! Unable to find a pixel format with an alpha channel.\n");
@@ -747,8 +751,10 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
if (needStencil && chosenPFD.cStencilBits == 0)
fprintf(stderr, "Warning! Unable to find a pixel format with a stencil buffer.\n");
- if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD)))
- goto error;
+ if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD))) {
+ ::wglMakeCurrent(prevHDC, prevHGLRC);
+ return GHOST_kFailure;
+ }
activateWGLEW();
@@ -845,19 +851,25 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
m_hGLRC = s_sharedHGLRC;
}
- if (!WIN32_CHK(m_hGLRC != NULL))
- goto error;
+ if (!WIN32_CHK(m_hGLRC != NULL)) {
+ ::wglMakeCurrent(prevHDC, prevHGLRC);
+ return GHOST_kFailure;
+ }
if (s_sharedHGLRC == NULL)
s_sharedHGLRC = m_hGLRC;
s_sharedCount++;
- if (!s_singleContextMode && s_sharedHGLRC != m_hGLRC && !WIN32_CHK(::wglShareLists(s_sharedHGLRC, m_hGLRC)))
- goto error;
+ if (!s_singleContextMode && s_sharedHGLRC != m_hGLRC && !WIN32_CHK(::wglShareLists(s_sharedHGLRC, m_hGLRC))) {
+ ::wglMakeCurrent(prevHDC, prevHGLRC);
+ return GHOST_kFailure;
+ }
- if (!WIN32_CHK(::wglMakeCurrent(m_hDC, m_hGLRC)))
- goto error;
+ if (!WIN32_CHK(::wglMakeCurrent(m_hDC, m_hGLRC))) {
+ ::wglMakeCurrent(prevHDC, prevHGLRC);
+ return GHOST_kFailure;
+ }
initContextGLEW();
@@ -898,11 +910,6 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
}
return GHOST_kSuccess;
-
-error:
- ::wglMakeCurrent(prevHDC, prevHGLRC);
-
- return GHOST_kFailure;
}
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h
index 63496d2a2b2..9f4f6fab58a 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -160,8 +160,8 @@ private:
void initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD);
- HDC m_hDC;
HWND m_hWnd;
+ HDC m_hDC;
const int m_contextProfileMask;
const int m_contextMajorVersion;