[Libreoffice-commits] core.git: Branch 'feature/fixes11' - vcl/source

Tor Lillqvist tml at collabora.com
Mon Oct 19 20:52:14 PDT 2015


 vcl/source/opengl/OpenGLContext.cxx |   22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

New commits:
commit 9457c57631c3803595077314a2ecb273d25962bd
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Oct 20 06:51:32 2015 +0300

    Revert "Speed up in-process caching of OpenGL shader programs"
    
    Not going into 5.0
    
    This reverts commit 552183f691dcdbdb4466d77be66e55312980a20d.

diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 3246cfc..ca53bc0 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1739,28 +1739,20 @@ OpenGLProgram* OpenGLContext::GetProgram( const OUString& rVertexShader, const O
 {
     OpenGLZone aZone;
 
-    // We cache the shader programs in a per-process run-time cache
-    // based on only the names and the preamble. We don't expect
-    // shader source files to change during the lifetime of a
-    // LibreOffice process.
-    rtl::OString aNameBasedKey = OUStringToOString(rVertexShader + "+" + rFragmentShader, RTL_TEXTENCODING_UTF8) + "+" + preamble;
-    if( !aNameBasedKey.isEmpty() )
-    {
-        ProgramCollection::iterator it = maPrograms.find( aNameBasedKey );
+    rtl::OString aKey = OpenGLHelper::GetDigest( rVertexShader, rFragmentShader, preamble );
+
+    if( !aKey.isEmpty() )
+    {
+        ProgramCollection::iterator it = maPrograms.find( aKey );
         if( it != maPrograms.end() )
             return it->second.get();
     }
 
-    // Binary shader programs are cached persistently (between
-    // LibreOffice process instances) based on a hash of their source
-    // code, as the source code can and will change between
-    // LibreOffice versions even if the shader names don't change.
-    rtl::OString aPersistentKey = OpenGLHelper::GetDigest( rVertexShader, rFragmentShader, preamble );
     std::shared_ptr<OpenGLProgram> pProgram = std::make_shared<OpenGLProgram>();
-    if( !pProgram->Load( rVertexShader, rFragmentShader, preamble, aPersistentKey ) )
+    if( !pProgram->Load( rVertexShader, rFragmentShader, preamble, aKey ) )
         return NULL;
 
-    maPrograms.insert(std::make_pair(aNameBasedKey, pProgram));
+    maPrograms.insert(std::make_pair(aKey, pProgram));
 
     return pProgram.get();
 }


More information about the Libreoffice-commits mailing list