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 /vcl/opengl/x11 | |
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 'vcl/opengl/x11')
-rw-r--r-- | vcl/opengl/x11/gdiimpl.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index fc49e2520e58..61dba9b78db3 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -22,6 +22,7 @@ #include <opengl/texture.hxx> #include <opengl/x11/gdiimpl.hxx> #include <opengl/x11/salvd.hxx> +#include "opengl/RenderState.hxx" #include <vcl/opengl/OpenGLContext.hxx> #include <vcl/opengl/OpenGLHelper.hxx> @@ -144,8 +145,8 @@ bool X11OpenGLSalGraphicsImpl::RenderPixmap(X11Pixmap* pPixmap, X11Pixmap* pMask rCombo.mpTexture.reset(new OpenGLTexture(pPixmap->GetWidth(), pPixmap->GetHeight(), false)); - glActiveTexture( GL_TEXTURE0 ); - CHECK_GL_ERROR(); + mpContext->state()->texture().active(0); + rCombo.mpTexture->Bind(); glXBindTexImageEXT( pDisplay, pGlxPixmap, GLX_FRONT_LEFT_EXT, nullptr ); rCombo.mpTexture->Unbind(); |