vcl/opengl/win/gdiimpl.cxx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
New commits: commit 4cc634327a752d633ea341252d8f4845157f887b Author: Caolán McNamara <caol...@redhat.com> Date: Tue Sep 5 10:40:18 2017 +0100 Resolves: tdf#107730 ensure per-thread epoxy_handle_external_wglMakeCurrent Change-Id: Idc1e2da3a02715a09b5b8f4e8e736b8806e59f8e Reviewed-on: https://gerrit.libreoffice.org/41927 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index e173576480d8..c91577130071 100644 --- a/vcl/opengl/win/gdiimpl.cxx +++ b/vcl/opengl/win/gdiimpl.cxx @@ -8,6 +8,7 @@ */ #include <memory> +#include <thread> #include "opengl/win/gdiimpl.hxx" #include <comphelper/windowserrorstring.hxx> @@ -75,11 +76,24 @@ void WinOpenGLContext::resetCurrent() g_bAnyCurrent = false; } +thread_local bool bEpoxyDispatchMakeCurrentCalled = false; + +void ensureDispatchTable() +{ + if (!bEpoxyDispatchMakeCurrentCalled) + { + epoxy_handle_external_wglMakeCurrent(); + bEpoxyDispatchMakeCurrentCalled = true; + } +} + bool WinOpenGLContext::isCurrent() { OpenGLZone aZone; - return g_bAnyCurrent && m_aGLWin.hRC && wglGetCurrentContext() == m_aGLWin.hRC && - wglGetCurrentDC() == m_aGLWin.hDC; + if (!g_bAnyCurrent || !m_aGLWin.hRC) + return false; + ensureDispatchTable(); + return wglGetCurrentContext() == m_aGLWin.hRC && wglGetCurrentDC() == m_aGLWin.hDC; } bool WinOpenGLContext::isAnyCurrent() @@ -96,7 +110,7 @@ void WinOpenGLContext::makeCurrent() clearCurrent(); - epoxy_handle_external_wglMakeCurrent(); + ensureDispatchTable(); if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC)) {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits