summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-11-21 16:19:08 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-12-04 01:53:22 +0000
commite737e3a79ff6a97da2fdeae3899e72e06190342f (patch)
tree78711d9a705aefea1e210bc7f5da929ccf2aa12b
parent56f452987d71fb0714a2cba152a2bb6ccc624712 (diff)
vcl rebase cleanup; also assertions on non-flushed SalGraphics.
Change-Id: I41443640e00c69891e4a95ced84b97b8b4626cd8
-rw-r--r--vcl/inc/openglgdiimpl.hxx2
-rw-r--r--vcl/opengl/gdiimpl.cxx42
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx6
3 files changed, 33 insertions, 17 deletions
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index c39185303bef..87000c3b01d1 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -89,6 +89,8 @@ protected:
SalColor mnFillColor;
#ifdef DBG_UTIL
bool mProgramIsSolidColor;
+ sal_uInt32 mnDrawCount;
+ sal_uInt32 mnDrawCountAtFlush;
#endif
SalColor mProgramSolidColor;
double mProgramSolidTransparency;
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index bf7ab781a2a9..a87c05c2a159 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -51,6 +51,8 @@ OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl(SalGraphics& rParent, SalGeometryPr
, mnFillColor(SALCOLOR_NONE)
#ifdef DBG_UTIL
, mProgramIsSolidColor(false)
+ , mnDrawCount(0)
+ , mnDrawCountAtFlush(0)
#endif
, mProgramSolidColor(SALCOLOR_NONE)
, mProgramSolidTransparency(0.0)
@@ -59,6 +61,14 @@ OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl(SalGraphics& rParent, SalGeometryPr
OpenGLSalGraphicsImpl::~OpenGLSalGraphicsImpl()
{
+#ifdef DBG_UTIL
+ if( !IsOffscreen() )
+ {
+ // Check that all SalGraphics have flushed before being destroyed
+ assert( mnDrawCountAtFlush == mnDrawCount );
+ }
+#endif
+
ReleaseContext();
}
@@ -144,7 +154,7 @@ void OpenGLSalGraphicsImpl::Init()
mpContext->ReleaseFramebuffer( maOffscreenTex );
}
maOffscreenTex = OpenGLTexture();
- VCL_GL_INFO("vcl.opengl", "::Init - re-size offscreen texture");
+ VCL_GL_INFO("::Init - re-size offscreen texture");
}
if( !IsOffscreen() )
@@ -173,6 +183,8 @@ void OpenGLSalGraphicsImpl::PreDraw()
{
OpenGLZone::enter();
+ mnDrawCount++;
+
if( !AcquireContext() )
{
SAL_WARN( "vcl.opengl", "Couldn't acquire context" );
@@ -239,7 +251,7 @@ void OpenGLSalGraphicsImpl::freeResources()
// TODO Delete shaders, programs and textures if not shared
if( mpContext.is() && mpContext->isInitialized() )
{
- VCL_GL_INFO( "vcl.opengl", "freeResources" );
+ VCL_GL_INFO( "freeResources" );
mpContext->makeCurrent();
mpContext->ReleaseFramebuffer( maOffscreenTex );
}
@@ -406,7 +418,7 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture()
{
bool bClearTexture = false;
- VCL_GL_INFO( "vcl.opengl", "Check Offscreen texture" );
+ VCL_GL_INFO( "Check Offscreen texture" );
// Always create the offscreen texture
if( maOffscreenTex )
@@ -416,13 +428,13 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture()
{
mpContext->ReleaseFramebuffer( maOffscreenTex );
maOffscreenTex = OpenGLTexture();
- VCL_GL_INFO( "vcl.opengl", "re-size offscreen texture" );
+ VCL_GL_INFO( "re-size offscreen texture" );
}
}
if( !maOffscreenTex )
{
- VCL_GL_INFO( "vcl.opengl", "create texture of size "
+ VCL_GL_INFO( "create texture of size "
<< GetWidth() << " x " << GetHeight() );
maOffscreenTex = OpenGLTexture( GetWidth(), GetHeight() );
bClearTexture = true;
@@ -1940,25 +1952,27 @@ void OpenGLSalGraphicsImpl::flushAndSwap()
if( !maOffscreenTex )
{
- VCL_GL_INFO( "vcl.opengl", "flushAndSwap - odd no texture !" );
+ VCL_GL_INFO( "flushAndSwap - odd no texture !" );
return;
}
+ mnDrawCountAtFlush = mnDrawCount;
+
OpenGLZone aZone;
- VCL_GL_INFO( "vcl.opengl", "flushAndSwap" );
+ VCL_GL_INFO( "flushAndSwap" );
// Interesting ! -> this destroys a context [ somehow ] ...
mpWindowContext->makeCurrent();
CHECK_GL_ERROR();
- VCL_GL_INFO( "vcl.opengl", "flushAndSwap - acquire default frame buffer" );
+ VCL_GL_INFO( "flushAndSwap - acquire default frame buffer" );
mpWindowContext->AcquireDefaultFramebuffer();
glBindFramebuffer( GL_FRAMEBUFFER, 0 ); // FIXME: paranoid double check.
CHECK_GL_ERROR();
- VCL_GL_INFO( "vcl.opengl", "flushAndSwap - acquired default frame buffer" );
+ VCL_GL_INFO( "flushAndSwap - acquired default frame buffer" );
glDisable( GL_SCISSOR_TEST ); // FIXME: paranoia ...
CHECK_GL_ERROR();
@@ -1975,20 +1989,20 @@ void OpenGLSalGraphicsImpl::flushAndSwap()
SalTwoRect aPosAry( 0, 0, maOffscreenTex.GetWidth(), maOffscreenTex.GetHeight(),
0, 0, maOffscreenTex.GetWidth(), maOffscreenTex.GetHeight() );
- VCL_GL_INFO( "vcl.opengl", "Texture height " << maOffscreenTex.GetHeight() << " vs. window height " << GetHeight() );
+ VCL_GL_INFO( "Texture height " << maOffscreenTex.GetHeight() << " vs. window height " << GetHeight() );
OpenGLProgram *pProgram =
mpWindowContext->UseProgram( "textureVertexShader", "textureFragmentShader", "" );
if( !pProgram )
- VCL_GL_INFO( "vcl.opengl", "Can't compile simple copying shader !" );
+ VCL_GL_INFO( "Can't compile simple copying shader !" );
else
{
pProgram->Use(); // FIXME: paranoia ...
- VCL_GL_INFO( "vcl.opengl", "done paranoid re-use." );
+ VCL_GL_INFO( "done paranoid re-use." );
pProgram->SetTexture( "sampler", maOffscreenTex );
maOffscreenTex.Bind(); // FIXME: paranoia ...
- VCL_GL_INFO( "vcl.opengl", "bound bits etc." );
+ VCL_GL_INFO( "bound bits etc." );
GLfloat aTexCoord[8];
maOffscreenTex.GetCoord( aTexCoord, aPosAry, false );
@@ -2027,7 +2041,7 @@ void OpenGLSalGraphicsImpl::flushAndSwap()
usleep(500 * 1000);
}
}
- VCL_GL_INFO( "vcl.opengl", "flushAndSwap - end." );
+ VCL_GL_INFO( "flushAndSwap - end." );
}
void OpenGLSalGraphicsImpl::endPaint()
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 5cb1aeafb6b5..09fac7bf771a 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1372,7 +1372,7 @@ void OpenGLContext::prepareForYield()
{
ImplSVData* pSVData = ImplGetSVData();
- VCL_GL_INFO("vcl.opengl", "clearCurrent - detachframebuffers");
+ VCL_GL_INFO("clearCurrent - detachframebuffers");
// release all framebuffers from the old context so we can re-attach the
// texture in the new context
@@ -1541,9 +1541,9 @@ bool OpenGLContext::BindFramebuffer( OpenGLFramebuffer* pFramebuffer )
else
OpenGLFramebuffer::Unbind();
- VCL_GL_INFO( "vcl.opengl", "before assign pFramebuffer" );
+ VCL_GL_INFO( "before assign pFramebuffer" );
mpCurrentFramebuffer = pFramebuffer;
- VCL_GL_INFO( "vcl.opengl", "after assign pFramebuffer" );
+ VCL_GL_INFO( "after assign pFramebuffer" );
}
return true;