[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/inc vcl/opengl
Lubosz Sarnecki
lubosz.sarnecki at collabora.co.uk
Wed Aug 26 01:36:52 PDT 2015
vcl/inc/opengl/program.hxx | 5 +++++
vcl/opengl/program.cxx | 13 ++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
New commits:
commit 0efe8c5c3c6c417636d31ab6e02d5066ebd6dd2b
Author: Lubosz Sarnecki <lubosz.sarnecki at collabora.co.uk>
Date: Thu Aug 20 16:22:43 2015 +0200
vcl OpenGL program: Cache mvp matrix to reduce ~200 api calls per frame.
Change-Id: I86ae50bd8d2148e86a6c8fc0821d3e2bc29a0cd4
(cherry picked from commit e3cd97ce0b2e153b8b6812cc66f2e7d33504a7da)
Reviewed-on: https://gerrit.libreoffice.org/18006
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx
index 5ca9aff..0f0f9a5 100644
--- a/vcl/inc/opengl/program.hxx
+++ b/vcl/inc/opengl/program.hxx
@@ -39,6 +39,11 @@ private:
TextureList maTextures;
bool mbBlending;
+ float mfLastWidth;
+ float mfLastHeight;
+ float mfLastPixelOffset;
+
+
OpenGLProgram(const OpenGLProgram &) SAL_DELETED_FUNCTION;
public:
OpenGLProgram();
diff --git a/vcl/opengl/program.cxx b/vcl/opengl/program.cxx
index 3bfa6c2..5f9d276 100644
--- a/vcl/opengl/program.cxx
+++ b/vcl/opengl/program.cxx
@@ -21,7 +21,10 @@ OpenGLProgram::OpenGLProgram() :
mnPositionAttrib( SAL_MAX_UINT32 ),
mnTexCoordAttrib( SAL_MAX_UINT32 ),
mnAlphaCoordAttrib( SAL_MAX_UINT32 ),
- mbBlending( false )
+ mbBlending( false ),
+ mfLastWidth(0.0),
+ mfLastHeight(0.0),
+ mfLastPixelOffset(0.0)
{
}
@@ -241,6 +244,14 @@ void OpenGLProgram::SetTransform(
void OpenGLProgram::ApplyMatrix(float fWidth, float fHeight, float fPixelOffset)
{
+
+ if (mfLastWidth == fWidth && mfLastHeight == fHeight && mfLastPixelOffset == fPixelOffset)
+ return;
+
+ mfLastWidth = fWidth;
+ mfLastHeight = fHeight;
+ mfLastPixelOffset = fPixelOffset;
+
OString sProjectionMatrix("mvp");
GLuint nUniform = GetUniformLocation(sProjectionMatrix);
More information about the Libreoffice-commits
mailing list