summaryrefslogtreecommitdiff
path: root/include/vcl/opengl/OpenGLContext.hxx
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2015-09-13 12:15:13 +0200
committerTomaž Vajngerl <quikee@gmail.com>2015-09-15 15:08:01 +0000
commitd8f78d624b779244f5953fd32960c4f487e320d3 (patch)
tree9fa99447c01a33807a7c003d4d97b2c31a999105 /include/vcl/opengl/OpenGLContext.hxx
parenta191076e3b4063a074ebf1a4ef4cded25cebdb8c (diff)
tdf#93814: Added support for caching shader program binaries.
Change-Id: I21c844b47282f6b3eec443933a86421a074e24df Reviewed-on: https://gerrit.libreoffice.org/18555 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/vcl/opengl/OpenGLContext.hxx')
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index ecc503829051..b2aaa173ea3a 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -55,10 +55,13 @@ class NSOpenGLView;
#include <vcl/window.hxx>
#include <tools/gen.hxx>
#include <vcl/syschild.hxx>
+#include <rtl/crc.h>
#include <rtl/ref.hxx>
#include <map>
+#include <memory>
#include <set>
+#include <unordered_map>
class OpenGLFramebuffer;
class OpenGLProgram;
@@ -271,15 +274,16 @@ private:
OpenGLFramebuffer* mpFirstFramebuffer;
OpenGLFramebuffer* mpLastFramebuffer;
- struct ProgramKey
+ struct ProgramHash
{
- ProgramKey( const OUString& vertexShader, const OUString& fragmentShader, const OString& preamble );
- bool operator< ( const ProgramKey& other ) const;
- OUString vertexShader;
- OUString fragmentShader;
- OString preamble;
+ size_t operator()( const rtl::OString& aDigest ) const
+ {
+ return (size_t)( rtl_crc32( 0, aDigest.getStr(), aDigest.getLength() ) );
+ }
};
- std::map<ProgramKey, std::shared_ptr<OpenGLProgram> > maPrograms;
+
+ typedef std::unordered_map< rtl::OString, std::shared_ptr<OpenGLProgram>, ProgramHash > ProgramCollection;
+ ProgramCollection maPrograms;
OpenGLProgram* mpCurrentProgram;
#ifdef DBG_UTIL
std::set<SalGraphicsImpl*> maParents;