summaryrefslogtreecommitdiff
path: root/vcl/opengl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-08-31 12:11:50 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-08-31 20:18:54 +0100
commit18dd07ba4fd9ede98ce576e6024831658bbd5401 (patch)
tree013a6802b3a7089c1b62b68c4169d21ae0982799 /vcl/opengl
parent6cf43cf6b98866401702d3275a7a026d8fa01edf (diff)
tdf#93751 - ensure textures are unbound from framebuffers post destroy.
Change-Id: I81aec0e6f8db57905826c54c3442528be6068700
Diffstat (limited to 'vcl/opengl')
-rw-r--r--vcl/opengl/framebuffer.cxx9
-rw-r--r--vcl/opengl/texture.cxx10
2 files changed, 17 insertions, 2 deletions
diff --git a/vcl/opengl/framebuffer.cxx b/vcl/opengl/framebuffer.cxx
index 87af985f4ba4..7e19981f8078 100644
--- a/vcl/opengl/framebuffer.cxx
+++ b/vcl/opengl/framebuffer.cxx
@@ -46,12 +46,17 @@ void OpenGLFramebuffer::Unbind()
bool OpenGLFramebuffer::IsFree() const
{
- return (!mnAttachedTexture);
+ return !mnAttachedTexture;
+}
+
+bool OpenGLFramebuffer::IsAttached( GLuint nTexture ) const
+{
+ return mnAttachedTexture == nTexture;
}
bool OpenGLFramebuffer::IsAttached( const OpenGLTexture& rTexture ) const
{
- return ( mnAttachedTexture == rTexture.Id() );
+ return mnAttachedTexture == rTexture.Id();
}
void OpenGLFramebuffer::AttachTexture( const OpenGLTexture& rTexture )
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index 4e62915151cd..217b8bf7a598 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -108,7 +108,17 @@ ImplOpenGLTexture::~ImplOpenGLTexture()
{
VCL_GL_INFO( "vcl.opengl", "~OpenGLTexture " << mnTexture );
if( mnTexture != 0 )
+ {
+ // FIXME: this is really not optimal performance-wise.
+
+ // Check we have been correctly un-bound from all framebuffers.
+ ImplSVData* pSVData = ImplGetSVData();
+ OpenGLContext* pContext = pSVData->maGDIData.mpLastContext;
+ if (pContext)
+ pContext->UnbindTextureFromFramebuffers( mnTexture );
+
glDeleteTextures( 1, &mnTexture );
+ }
}
bool ImplOpenGLTexture::InsertBuffer(int nX, int nY, int nWidth, int nHeight, int nFormat, int nType, sal_uInt8* pData)