diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-01-04 21:51:28 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-01-05 10:55:31 +0000 |
commit | 38f9ef832cd583366eb0a2a730baefec40534922 (patch) | |
tree | 37fa14620b68c41a6314626074939137679df9ef /vcl/opengl | |
parent | c29a6e1541f57d2a2ba8372af30e65a2a7b32a9f (diff) |
tdf#96894 - get ordering right for TextureAtlas cleanup on shutdown.
Do it much earlier - while we have a valid OpenGLContext.
Change-Id: Ie258283147d02984b6f507c0075d114ae7288051
Reviewed-on: https://gerrit.libreoffice.org/21089
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/opengl')
-rw-r--r-- | vcl/opengl/salbmp.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index 75d4d21a9c18..31038c37ff0d 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -28,6 +28,7 @@ #include "svdata.hxx" #include "salgdi.hxx" #include "vcleventlisteners.hxx" +#include "vcl/lazydelete.hxx" #include "opengl/zone.hxx" #include "opengl/program.hxx" @@ -97,7 +98,8 @@ sal_uInt16 lclBytesPerRow(sal_uInt16 nBits, int nWidth) return 0; } -static std::vector<std::unique_ptr<FixedTextureAtlasManager>> sTextureAtlases; +typedef std::vector<std::unique_ptr< FixedTextureAtlasManager > > TextureAtlasVector; +static vcl::DeleteOnDeinit< TextureAtlasVector > gTextureAtlases(new TextureAtlasVector()); } @@ -381,6 +383,7 @@ void lclInstantiateTexture(OpenGLTexture& rTexture, const int nWidth, const int { if (nWidth == nHeight) { + TextureAtlasVector &sTextureAtlases = *gTextureAtlases.get(); if (sTextureAtlases.empty()) { sTextureAtlases.push_back(std::unique_ptr<FixedTextureAtlasManager>(new FixedTextureAtlasManager(8, 8, 16))); @@ -582,8 +585,10 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType& { OUString FragShader("areaHashCRC64TFragmentShader"); - static const OpenGLTexture aCRCTableTexture(512, 1, GL_RGBA, GL_UNSIGNED_BYTE, - vcl_get_crc64_table()); + static vcl::DeleteOnDeinit<OpenGLTexture> gCRCTableTexture( + new OpenGLTexture(512, 1, GL_RGBA, GL_UNSIGNED_BYTE, + vcl_get_crc64_table())); + OpenGLTexture &rCRCTableTexture = *gCRCTableTexture.get(); // First Pass @@ -603,7 +608,7 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType& pProgram->SetUniform1f( "xstep", 1.0 / mnWidth ); pProgram->SetUniform1f( "ystep", 1.0 / mnHeight ); - pProgram->SetTexture("crc_table", (OpenGLTexture&)(aCRCTableTexture)); + pProgram->SetTexture("crc_table", rCRCTableTexture); pProgram->SetTexture("sampler", rInputTexture); pProgram->DrawTexture(rInputTexture); pProgram->Clean(); @@ -631,7 +636,7 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType& pProgram->SetUniform1f( "xstep", 1.0 / mnWidth ); pProgram->SetUniform1f( "ystep", 1.0 / mnHeight ); - pProgram->SetTexture("crc_table", (OpenGLTexture&)(aCRCTableTexture)); + pProgram->SetTexture("crc_table", rCRCTableTexture); pProgram->SetTexture("sampler", aFirstPassTexture); pProgram->DrawTexture(aFirstPassTexture); pProgram->Clean(); |