summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-09-05 10:40:18 +0100
committerMichael Meeks <michael.meeks@collabora.com>2017-09-05 14:12:05 +0200
commit4cc634327a752d633ea341252d8f4845157f887b (patch)
treeae851ad25925b68a90b84dc5e0f3f3774ff413c1 /vcl
parentb816e24ac1dd7d725ff2ec33f9aa913a2c7b68c4 (diff)
Resolves: tdf#107730 ensure per-thread epoxy_handle_external_wglMakeCurrent
Change-Id: Idc1e2da3a02715a09b5b8f4e8e736b8806e59f8e Reviewed-on: https://gerrit.libreoffice.org/41927 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/opengl/win/gdiimpl.cxx20
1 files changed, 17 insertions, 3 deletions
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))
{