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
parent
097caa64a5
commit
13dcb46888
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue