summaryrefslogtreecommitdiff
path: root/vcl/opengl/program.cxx
diff options
context:
space:
mode:
authorLubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>2015-08-20 16:22:43 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-08-26 13:50:32 +0900
commit97bf7c6cc7c756109e75dc11641300e28e8b3d1f (patch)
treec0f1d13556ce8d5928408dfd57a4fa0193e9fd92 /vcl/opengl/program.cxx
parent4f0bb271c300253d1812c6cccf813eff442a02db (diff)
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
Diffstat (limited to 'vcl/opengl/program.cxx')
-rw-r--r--vcl/opengl/program.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/vcl/opengl/program.cxx b/vcl/opengl/program.cxx
index ede054816d5f..b1d3cfe8291d 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);