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
committerMarco Cecchetti <marco.cecchetti@collabora.com>2015-09-14 13:00:49 +0200
commit3f73cfdf5c721b250910cd220e54d53e3311840b (patch)
tree866104092fa4d2dd755fe605a460b297056bd71c /include/vcl/opengl/OpenGLContext.hxx
parente6ae8ce99566f59b2011f614160f6bdd4d5034cc (diff)
tdf#93814: Added support for caching shader program binaries.private/mcecchetti/gl-program-binary
Change-Id: I21c844b47282f6b3eec443933a86421a074e24df
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;