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
This commit is contained in:
Martin Gräßlin 2012-07-06 09:55:34 +02:00
parent b734c03346
commit f775229a80

View file

@ -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
}