From f775229a80b9be264ae87630e9309aff7d57edd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 6 Jul 2012 09:55:34 +0200 Subject: [PATCH] Don't use GL Matrix Stack on OpenGL 2 backend Currently the GL Matrix Stack is also used with OpenGL 2. That is pushMatrix, multMatrix and popMatrix are executed although this does not influence the rendering at all. The OpenGL 1 matrices are not passed to the shaders. With this change the calls to the matrix stack are no longer executed if the Shader based backend is used. This means we have a few less matrix multiplications in the rendering. Mostly affects a few effects which have not yet completely be ported over to OpenGL 2. BUG: 303093 FIXED-IN: 4.10 REVIEW: 105455 --- libkwineffects/kwinglutils.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index e237c1b12c..016d31efc8 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -191,6 +191,9 @@ int nearestPowerOfTwo(int x) void pushMatrix() { #ifndef KWIN_HAVE_OPENGLES + if (ShaderManager::instance()->isValid()) { + return; + } glPushMatrix(); #endif } @@ -200,6 +203,9 @@ void pushMatrix(const QMatrix4x4 &matrix) #ifdef KWIN_HAVE_OPENGLES Q_UNUSED(matrix) #else + if (ShaderManager::instance()->isValid()) { + return; + } glPushMatrix(); multiplyMatrix(matrix); #endif @@ -210,6 +216,9 @@ void multiplyMatrix(const QMatrix4x4 &matrix) #ifdef KWIN_HAVE_OPENGLES Q_UNUSED(matrix) #else + if (ShaderManager::instance()->isValid()) { + return; + } GLfloat m[16]; const qreal *data = matrix.constData(); for (int i = 0; i < 4; ++i) { @@ -243,6 +252,9 @@ void loadMatrix(const QMatrix4x4 &matrix) void popMatrix() { #ifndef KWIN_HAVE_OPENGLES + if (ShaderManager::instance()->isValid()) { + return; + } glPopMatrix(); #endif }