Commit 13dcb468 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

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.
parent 097caa64
...@@ -471,13 +471,7 @@ bool GLShader::setUniform(int location, const QVector4D &value) ...@@ -471,13 +471,7 @@ bool GLShader::setUniform(int location, const QVector4D &value)
bool GLShader::setUniform(int location, const QMatrix4x4 &value) bool GLShader::setUniform(int location, const QMatrix4x4 &value)
{ {
if (location >= 0) { if (location >= 0) {
GLfloat m[16]; glUniformMatrix4fv(location, 1, GL_FALSE, value.constData());
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);
} }
return (location >= 0); return (location >= 0);
} }
......
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