diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-25 20:25:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-12-13 11:33:18 +0000 |
commit | 482d7ce61b423600b41b459eb26a2cc221cd0acf (patch) | |
tree | 8da6edb8200889d93f0b344e61ed779c037a590f /vcl/opengl/win | |
parent | Don't leave WW8AnchorConvResult::m_bConverted uninitialized (diff) | |
download | core-482d7ce61b423600b41b459eb26a2cc221cd0acf.tar.gz core-482d7ce61b423600b41b459eb26a2cc221cd0acf.zip |
change from glew to epoxy
because that works under wayland out of the box and gtk3 uses it already
Change-Id: Iefaac31e325534a81a5389f752804af917c1baef
Reviewed-on: https://gerrit.libreoffice.org/31213
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/opengl/win')
-rw-r--r-- | vcl/opengl/win/gdiimpl.cxx | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index 1704a19a7234..0d0159d25500 100644 --- a/vcl/opengl/win/gdiimpl.cxx +++ b/vcl/opengl/win/gdiimpl.cxx @@ -16,9 +16,10 @@ #include <win/saldata.hxx> #include <win/salframe.h> #include <win/salinst.h> -#include <GL/wglew.h> +#include <epoxy/wgl.h> static std::vector<HGLRC> g_vShareList; +static bool g_bAnyCurrent; class GLWinWindow : public GLWindow { @@ -70,6 +71,7 @@ void WinOpenGLContext::resetCurrent() OpenGLZone aZone; wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; } bool WinOpenGLContext::isCurrent() @@ -81,7 +83,7 @@ bool WinOpenGLContext::isCurrent() bool WinOpenGLContext::isAnyCurrent() { - return wglGetCurrentContext() != nullptr; + return g_bAnyCurrent && wglGetCurrentContext() != nullptr; } void WinOpenGLContext::makeCurrent() @@ -95,10 +97,13 @@ void WinOpenGLContext::makeCurrent() if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC)) { + g_bAnyCurrent = false; SAL_WARN("vcl.opengl", "wglMakeCurrent failed: " << WindowsErrorString(GetLastError())); return; } + g_bAnyCurrent = true; + registerAsCurrent(); } @@ -140,7 +145,10 @@ void WinOpenGLContext::destroyCurrentContext() g_vShareList.erase(itr); if (wglGetCurrentContext() != nullptr) + { wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; + } wglDeleteContext( m_aGLWin.hRC ); ReleaseDC( m_aGLWin.hWnd, m_aGLWin.hDC ); m_aGLWin.hRC = nullptr; @@ -208,11 +216,13 @@ bool InitTempWindow(HWND& hwnd, int width, int height, const PIXELFORMATDESCRIPT if(!ret) { wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(glWin.hRC); ReleaseDC(hwnd, glWin.hDC); DestroyWindow(hwnd); return false; } + g_bAnyCurrent = false; return true; } @@ -275,6 +285,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat, { SAL_WARN("vcl.opengl", "Device doesn't support multisample"); wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(glWin.hRC); ReleaseDC(hWnd, glWin.hDC); DestroyWindow(hWnd); @@ -285,6 +296,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat, if (!fn_wglChoosePixelFormatARB) { wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(glWin.hRC); ReleaseDC(hWnd, glWin.hDC); DestroyWindow(hWnd); @@ -341,6 +353,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat, bArbMultisampleSupported = true; rPixelFormat = pixelFormat; wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(glWin.hRC); ReleaseDC(hWnd, glWin.hDC); DestroyWindow(hWnd); @@ -355,6 +368,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat, bArbMultisampleSupported = true; rPixelFormat = pixelFormat; wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(glWin.hRC); ReleaseDC(hWnd, glWin.hDC); DestroyWindow(hWnd); @@ -362,6 +376,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat, } // Return the valid format wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(glWin.hRC); ReleaseDC(hWnd, glWin.hDC); DestroyWindow(hWnd); @@ -542,13 +557,17 @@ bool WinOpenGLContext::ImplInit() if (!wglMakeCurrent(m_aGLWin.hDC, hTempRC)) { + g_bAnyCurrent = false; SAL_WARN("vcl.opengl", "wglMakeCurrent failed: "<< WindowsErrorString(GetLastError())); return false; } - if (!InitGLEW()) + g_bAnyCurrent = true; + + if (!InitGL()) { wglMakeCurrent(NULL, NULL); + g_bAnyCurrent = false; wglDeleteContext(hTempRC); return false; } @@ -560,6 +579,7 @@ bool WinOpenGLContext::ImplInit() if (!wglCreateContextAttribsARB) { wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(hTempRC); return false; } @@ -578,6 +598,7 @@ bool WinOpenGLContext::ImplInit() { SAL_WARN("vcl.opengl", "wglCreateContextAttribsARB failed: "<< WindowsErrorString(GetLastError())); wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(hTempRC); return false; } @@ -585,19 +606,24 @@ bool WinOpenGLContext::ImplInit() if (!compiledShaderBinariesWork()) { wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(hTempRC); return false; } wglMakeCurrent(nullptr, nullptr); + g_bAnyCurrent = false; wglDeleteContext(hTempRC); if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC)) { + g_bAnyCurrent = false; SAL_WARN("vcl.opengl", "wglMakeCurrent failed: " << WindowsErrorString(GetLastError())); return false; } + g_bAnyCurrent = true; + if (bFirstCall) { // Checking texture size @@ -629,7 +655,7 @@ bool WinOpenGLContext::ImplInit() } } - InitGLEWDebugging(); + InitGLDebugging(); g_vShareList.push_back(m_aGLWin.hRC); |