Commit 42678c60 authored by Martin Flöser's avatar Martin Flöser
Browse files

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
parent 0803544e
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment