diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2016-04-28 14:55:45 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-04-30 03:06:49 +0000 |
commit | ba0a5708803d899de4c40cfe2c1697ae83b4827a (patch) | |
tree | 2001952d455e7a0258a49a858f4a1f5339053f1a /include | |
parent | 02a8589553b5ce0e57a7ee9e66327376125b4378 (diff) |
opengl: track state of active and bound textures in context
Add TextureState which is responsible to track the state of
texture binding (and unbinding) and changing the current active
texture unit. This is necessary because all GL calls reset the
internal state without checking what the current state actually
is and this can accumulate to a large amount of overhead.
We also unbound the textures (glBindTexture with 0 as ID) after
every operation which is also a major unneeded overhead which is
fixed by this commit.
Change-Id: I770a6a744c0c41850c576b928f027375962088aa
Reviewed-on: https://gerrit.libreoffice.org/24503
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 44b8d67fd8d9..723a99404ef8 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -62,6 +62,7 @@ class OpenGLProgram; class OpenGLTexture; class SalGraphicsImpl; class OpenGLTests; +class RenderState; /// Holds the information of our new child window struct GLWindow @@ -166,6 +167,11 @@ public: OpenGLProgram* UseProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble = "" ); void UseNoProgram(); + std::unique_ptr<RenderState>& state() + { + return mpRenderState; + } + /// Is this GL context the current context ? bool isCurrent(); /// release bound resources from the current context @@ -249,6 +255,8 @@ private: ProgramCollection maPrograms; OpenGLProgram* mpCurrentProgram; + std::unique_ptr<RenderState> mpRenderState; + public: vcl::Region maClipRegion; int mnPainting; |