diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 0a660161cde..9b98cb8c0ac 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -105,6 +105,22 @@ static PIXELFORMATDESCRIPTOR sPreferredFormat = { 0, 0, 0 /* no layer, visible, damage masks */ }; +/* Intel videocards don't work fine with multiple contexts and + have to share the same context for all windows. + But if we just share context for all windows it could work incorrect + with multiple videocards configuration. Suppose, that Intel videocards + can't be in multiple-devices configuration. */ +static int is_crappy_intel_card(void) +{ + int crappy = 0; + const char *vendor = (const char*)glGetString(GL_VENDOR); + + if (strstr(vendor, "Intel")) + crappy = 1; + + return crappy; +} + GHOST_WindowWin32::GHOST_WindowWin32( GHOST_SystemWin32 * system, const STR_String& title, @@ -707,15 +723,22 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp } // Create the context - m_hGlRc = ::wglCreateContext(m_hDC); - if (m_hGlRc) { - if (s_firsthGLRc) { - ::wglCopyContext(s_firsthGLRc, m_hGlRc, GL_ALL_ATTRIB_BITS); - wglShareLists(s_firsthGLRc, m_hGlRc); - } else { - s_firsthGLRc = m_hGlRc; + if (s_firsthGLRc && is_crappy_intel_card()) { + m_hGlRc = s_firsthGLRc; + } else { + m_hGlRc = ::wglCreateContext(m_hDC); + + if (m_hGlRc) { + if (s_firsthGLRc) { + ::wglCopyContext(s_firsthGLRc, m_hGlRc, GL_ALL_ATTRIB_BITS); + ::wglShareLists(s_firsthGLRc, m_hGlRc); + } else { + s_firsthGLRc = m_hGlRc; + } } + } + if (m_hGlRc) { success = ::wglMakeCurrent(m_hDC, m_hGlRc) == TRUE ? GHOST_kSuccess : GHOST_kFailure; } else { @@ -743,14 +766,21 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp ::DescribePixelFormat(m_hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &preferredFormat); // Create the context - m_hGlRc = ::wglCreateContext(m_hDC); - if (m_hGlRc) { - if (s_firsthGLRc) { - ::wglShareLists(s_firsthGLRc, m_hGlRc); - } else { - s_firsthGLRc = m_hGlRc; + if (s_firsthGLRc && is_crappy_intel_card()) { + m_hGlRc = s_firsthGLRc; + } else { + m_hGlRc = ::wglCreateContext(m_hDC); + + if (m_hGlRc) { + if (s_firsthGLRc) { + ::wglShareLists(s_firsthGLRc, m_hGlRc); + } else { + s_firsthGLRc = m_hGlRc; + } } + } + if (m_hGlRc) { success = ::wglMakeCurrent(m_hDC, m_hGlRc) == TRUE ? GHOST_kSuccess : GHOST_kFailure; } else { |