[Libreoffice-commits] core.git: include/vcl vcl/opengl vcl/source
Michael Meeks
michael.meeks at collabora.com
Fri Jan 1 02:07:43 PST 2016
include/vcl/opengl/OpenGLContext.hxx | 1 +
vcl/opengl/framebuffer.cxx | 1 +
vcl/opengl/gdiimpl.cxx | 2 +-
vcl/source/opengl/OpenGLContext.cxx | 21 +++++++++++++++++++++
vcl/source/opengl/OpenGLHelper.cxx | 3 ++-
5 files changed, 26 insertions(+), 2 deletions(-)
New commits:
commit 370199fa0f92f29cb75ad50705c71cd871abb2d9
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Thu Dec 31 22:12:59 2015 +0000
vcl: improve OpenGL debugging variously.
Change-Id: I097f1c1fb7fb505b6859289997bff3562fc06ba6
Reviewed-on: https://gerrit.libreoffice.org/21027
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 6f5ba5f..b2a0f09 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -156,6 +156,7 @@ public:
OpenGLFramebuffer* AcquireFramebuffer( const OpenGLTexture& rTexture );
static void ReleaseFramebuffer( OpenGLFramebuffer* pFramebuffer );
void UnbindTextureFromFramebuffers( GLuint nTexture );
+ static bool IsTextureAttachedAnywhere( GLuint nTexture );
void ReleaseFramebuffer( const OpenGLTexture& rTexture );
void ReleaseFramebuffers();
diff --git a/vcl/opengl/framebuffer.cxx b/vcl/opengl/framebuffer.cxx
index 464662d..215eadf 100644
--- a/vcl/opengl/framebuffer.cxx
+++ b/vcl/opengl/framebuffer.cxx
@@ -29,6 +29,7 @@ OpenGLFramebuffer::OpenGLFramebuffer() :
OpenGLFramebuffer::~OpenGLFramebuffer()
{
glDeleteFramebuffers( 1, &mnId );
+ VCL_GL_INFO( "Deleted framebuffer " << (int)mnId );
CHECK_GL_ERROR();
}
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 21ff211..7c6664b 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -460,9 +460,9 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture()
if( maOffscreenTex.GetWidth() != GetWidth() ||
maOffscreenTex.GetHeight() != GetHeight() )
{
+ VCL_GL_INFO( "re-size offscreen texture " << maOffscreenTex.Id() );
mpContext->ReleaseFramebuffer( maOffscreenTex );
maOffscreenTex = OpenGLTexture();
- VCL_GL_INFO( "re-size offscreen texture" );
}
}
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 36ede42..d4397a1 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1647,6 +1647,27 @@ void OpenGLContext::UnbindTextureFromFramebuffers( GLuint nTexture )
}
pFramebuffer = pFramebuffer->mpPrevFramebuffer;
}
+
+ // Lets just check that no other context has a framebuffer
+ // with this texture - that would be bad ...
+ assert( !IsTextureAttachedAnywhere( nTexture ) );
+}
+
+/// Method for debugging; check texture is not already attached.
+bool OpenGLContext::IsTextureAttachedAnywhere( GLuint nTexture )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ for( auto *pCheck = pSVData->maGDIData.mpLastContext; pCheck;
+ pCheck = pCheck->mpPrevContext )
+ {
+ for( auto pBuffer = pCheck->mpLastFramebuffer; pBuffer;
+ pBuffer = pBuffer->mpPrevFramebuffer )
+ {
+ if( pBuffer->IsAttached( nTexture ) )
+ return true;
+ }
+ }
+ return false;
}
void OpenGLContext::ReleaseFramebuffer( OpenGLFramebuffer* pFramebuffer )
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index bfd8110..32f2994 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -1012,7 +1012,8 @@ bool OpenGLWrapper::isVCLOpenGLEnabled()
void OpenGLHelper::debugMsgStream(std::ostringstream const &pStream)
{
- debugMsgPrint("%s", pStream.str().c_str());
+ debugMsgPrint ("%x: %s", osl_getThreadIdentifier(nullptr),
+ pStream.str().c_str());
}
void OpenGLHelper::debugMsgPrint(const char *pFormat, ...)
More information about the Libreoffice-commits
mailing list