summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/graphicshelpers
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/renderers/opengl/graphicshelpers
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/renderers/opengl/graphicshelpers')
-rw-r--r--src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
index 991a8533d..47779dded 100644
--- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp
@@ -1171,7 +1171,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack)
if (uniformValues.contains(namedTex.glslNameId)) {
GLTexture *t = manager->glTextureManager()->lookupResource(namedTex.nodeId);
if (t != nullptr) {
- UniformValue &texUniform = uniformValues[namedTex.glslNameId];
+ UniformValue &texUniform = uniformValues.value(namedTex.glslNameId);
if (texUniform.valueType() == UniformValue::TextureValue) {
const int texUnit = m_textureContext.activateTexture(TextureSubmissionContext::TextureScopeMaterial, m_gl, t);
texUniform.data<int>()[namedTex.uniformArrayIndex] = texUnit;
@@ -1201,7 +1201,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack)
qCWarning(Backend) << "Shader Image referencing invalid texture";
continue;
} else {
- UniformValue &imgUniform = uniformValues[namedTex.glslNameId];
+ UniformValue &imgUniform = uniformValues.value(namedTex.glslNameId);
if (imgUniform.valueType() == UniformValue::ShaderImageValue) {
const int imgUnit = m_imageContext.activateImage(img, t);
imgUniform.data<int>()[namedTex.uniformArrayIndex] = imgUnit;
@@ -1260,7 +1260,7 @@ bool SubmissionContext::setParameters(ShaderParameterPack &parameterPack)
for (const ShaderUniform &uniform : activeUniforms) {
// We can use [] as we are sure the the uniform wouldn't
// be un activeUniforms if there wasn't a matching value
- const UniformValue &v = values[uniform.m_nameId];
+ const UniformValue &v = values.value(uniform.m_nameId);
// skip invalid textures/images
if ((v.valueType() == UniformValue::TextureValue ||