diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 18 | ||||
-rw-r--r-- | include/vcl/opengl/OpenGLHelper.hxx | 7 |
2 files changed, 17 insertions, 8 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index e706df5e10ce..68d7209f6662 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -56,9 +56,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; @@ -281,15 +285,15 @@ 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, boost::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; diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx index 646a2d39254e..788b056723d2 100644 --- a/include/vcl/opengl/OpenGLHelper.hxx +++ b/include/vcl/opengl/OpenGLHelper.hxx @@ -36,8 +36,13 @@ class VCL_DLLPUBLIC OpenGLHelper { + OpenGLHelper() SAL_DELETED_FUNCTION; // Should not be instantiated + public: - static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, const OString& preamble = "" ); + + static rtl::OString GetDigest(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, const rtl::OString& preamble = "" ); + + static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName, const rtl::OString& preamble = "", const rtl::OString& rDigest = "" ); /** * The caller is responsible for allocate the memory for the RGBA buffer, before call |