From 16b0e217c1f67948374ff050496e5d4ffb8ceb90 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 2 Sep 2015 22:14:10 +0100 Subject: tdf#93867 - clear current GL context before thread switch. Fixes regression from otherwise a nice cleanup in: d20092259c7ea63885a539f911788715f8147ee9 Also get polarity of debug logging only with a context right. Change-Id: Id322471f01e5656e758aefc57b0d4d5ad073ec54 --- vcl/source/opengl/OpenGLContext.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'vcl/source/opengl/OpenGLContext.cxx') diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 49feb75368b4..3c305d523d98 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -1336,6 +1336,20 @@ void OpenGLContext::clearCurrent() pCurrentCtx->ReleaseFramebuffers(); } +void OpenGLContext::prepareForYield() +{ + ImplSVData* pSVData = ImplGetSVData(); + + SAL_INFO("vcl.opengl", "Unbinding contexts in preparation for yield"); + // release all framebuffers from the old context so we can re-attach the + // texture in the new context + OpenGLContext* pCurrentCtx = pSVData->maGDIData.mpLastContext; + if( pCurrentCtx && pCurrentCtx->isCurrent() ) + pCurrentCtx->resetCurrent(); + + assert (!hasCurrent()); +} + void OpenGLContext::makeCurrent() { ImplSVData* pSVData = ImplGetSVData(); -- cgit