Kaydet (Commit) 4cc63432 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Michael Meeks

Resolves: tdf#107730 ensure per-thread epoxy_handle_external_wglMakeCurrent

Change-Id: Idc1e2da3a02715a09b5b8f4e8e736b8806e59f8e
Reviewed-on: https://gerrit.libreoffice.org/41927Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst b816e24a
......@@ -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))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment