[Libreoffice-commits] core.git: vcl/inc vcl/opengl
Lubosz Sarnecki
lubosz.sarnecki at collabora.co.uk
Tue Aug 25 21:51:32 PDT 2015
vcl/inc/opengl/program.hxx | 5 +++++
vcl/opengl/program.cxx | 13 ++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
New commits:
commit 97bf7c6cc7c756109e75dc11641300e28e8b3d1f
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.
(cherry picked from commit e3cd97ce0b2e153b8b6812cc66f2e7d33504a7da)
Conflicts:
vcl/opengl/program.cxx
Change-Id: I86ae50bd8d2148e86a6c8fc0821d3e2bc29a0cd4
diff --git a/vcl/inc/opengl/program.hxx b/vcl/inc/opengl/program.hxx
index 7ac1936..8289a56 100644
--- a/vcl/inc/opengl/program.hxx
+++ b/vcl/inc/opengl/program.hxx
@@ -40,6 +40,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 ede0548..b1d3cfe 100644
--- a/vcl/opengl/program.cxx
+++ b/vcl/opengl/program.cxx
@@ -22,7 +22,10 @@ OpenGLProgram::OpenGLProgram() :
mnTexCoordAttrib( SAL_MAX_UINT32 ),
mnAlphaCoordAttrib( SAL_MAX_UINT32 ),
mnMaskCoordAttrib( SAL_MAX_UINT32 ),
- mbBlending( false )
+ mbBlending( false ),
+ mfLastWidth(0.0),
+ mfLastHeight(0.0),
+ mfLastPixelOffset(0.0)
{
}
@@ -247,6 +250,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