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.
master
Aleix Pol 2020-09-23 02:02:22 +02:00 committed by Aleix Pol Gonzalez
parent 097caa64a5
commit 13dcb46888
1 changed files with 1 additions and 7 deletions

View File

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