From 13dcb46888348ff79956f8ea301d00392b8539af Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 23 Sep 2020 02:02:22 +0200 Subject: [PATCH] Remove unnecessary allocation in GLShader::setUniform(int, const QMatrix4x4 &) We were creating a vector just to copy it over. We can pass the original vector just as well. --- libkwineffects/kwinglutils.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index a5f6050752..55b18187cb 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -471,13 +471,7 @@ bool GLShader::setUniform(int location, const QVector4D &value) bool GLShader::setUniform(int location, const QMatrix4x4 &value) { if (location >= 0) { - GLfloat m[16]; - const auto *data = value.constData(); - // i is column, j is row for m - for (int i = 0; i < 16; ++i) { - m[i] = data[i]; - } - glUniformMatrix4fv(location, 1, GL_FALSE, m); + glUniformMatrix4fv(location, 1, GL_FALSE, value.constData()); } return (location >= 0); }