summaryrefslogtreecommitdiffstats
path: root/src/render/materialsystem
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-10-18 14:35:40 +0200
committerPaul Lemire <paul.lemire@kdab.com>2019-11-14 06:37:38 +0100
commit50db67eb310fba162f73ac6fdf28a8457ce50b21 (patch)
tree788a6e72aac7ea848c443b6db4f25eb5215ef05d /src/render/materialsystem
parent38a3ceef605fb337066e441a4afeb4e460e6a26c (diff)
PackUniformHash to QVector
Surprisingly it's hard to notice its effect in the speed of execution, frame preparation looks to be more or less the same with the profiler. However with vtune, the profiling traces show a huge difference with QHash, mainly in time spent allocating memory. It shows a noticeable reduction in CPU usage. On bigscene-cpp with 600 entities QHash -> On a 158s run, CPU time is 112s (70%) free accounts for 26s (23%), malloc 24s (21%) QVector -> On a 190s run, CPU time is 110s (58%) free accounts for 5s (4.5%), malloc 4.7s (4.2%) Change-Id: I880d44b1acf7f051e479ed356864c3caf407f23f Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/render/materialsystem')
-rw-r--r--src/render/materialsystem/shader.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp
index 017deabac..300a71b84 100644
--- a/src/render/materialsystem/shader.cpp
+++ b/src/render/materialsystem/shader.cpp
@@ -244,13 +244,13 @@ void Shader::prepareUniforms(ShaderParameterPack &pack)
{
const PackUniformHash &values = pack.uniforms();
- auto it = values.cbegin();
- const auto end = values.cend();
+ auto it = values.keys.cbegin();
+ const auto end = values.keys.cend();
while (it != end) {
// Find if there's a uniform with the same name id
for (const ShaderUniform &uniform : qAsConst(m_uniforms)) {
- if (uniform.m_nameId == it.key()) {
+ if (uniform.m_nameId == *it) {
pack.setSubmissionUniform(uniform);
break;
}