summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-04-17 11:04:04 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-04-20 14:37:13 +0200
commit0dfd9a3164390b1aab8e6a660eac0f5154ce237f (patch)
tree8af86fba045520921a73172013ca5823352feae5
parente9a3b616bec7708e9b84afa7ce14e6ff32256d57 (diff)
Perform the prepareUniform step when building the commands
This is something we might as well parallelize rather than only doing them in the single threaded blocking rendering step. This gives a me a 3fps gain on bigscene-cpp whose bottleneck is still the submission currently. Change-Id: I4d7f3bfd395eef9fef6dc18f30445cfa7d6145ee Reviewed-by: Mike Krus <mike.krus@kdab.com>
-rw-r--r--src/plugins/renderers/opengl/renderer/renderer.cpp7
-rw-r--r--src/plugins/renderers/opengl/renderer/renderview.cpp3
-rw-r--r--src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp1
3 files changed, 4 insertions, 7 deletions
diff --git a/src/plugins/renderers/opengl/renderer/renderer.cpp b/src/plugins/renderers/opengl/renderer/renderer.cpp
index 35f1d6bf4..cbfa0515f 100644
--- a/src/plugins/renderers/opengl/renderer/renderer.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderer.cpp
@@ -995,16 +995,9 @@ void Renderer::prepareCommandsSubmission(const QVector<RenderView *> &renderView
// so we cannot unset its dirtiness at this point
if (rGeometryRenderer->isDirty())
rGeometryRenderer->unsetDirty();
-
- // Prepare the ShaderParameterPack based on the active uniforms of the shader
- shader->prepareUniforms(command.m_parameterPack);
-
} else if (command.m_type == RenderCommand::Compute) {
GLShader *shader = command.m_glShader;
Q_ASSERT(shader);
-
- // Prepare the ShaderParameterPack based on the active uniforms of the shader
- shader->prepareUniforms(command.m_parameterPack);
}
}
}
diff --git a/src/plugins/renderers/opengl/renderer/renderview.cpp b/src/plugins/renderers/opengl/renderer/renderview.cpp
index 048ceef7b..6707c6c2f 100644
--- a/src/plugins/renderers/opengl/renderer/renderview.cpp
+++ b/src/plugins/renderers/opengl/renderer/renderview.cpp
@@ -1177,6 +1177,9 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
}
setUniformValue(command->m_parameterPack, StringToInt::lookupId(QStringLiteral("envLightCount")), envLightCount);
}
+
+ // Prepare the ShaderParameterPack based on the active uniforms of the shader
+ shader->prepareUniforms(command->m_parameterPack);
}
}
diff --git a/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp b/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
index 082220349..1d0fd6d9c 100644
--- a/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
+++ b/src/plugins/renderers/opengl/renderer/shaderparameterpack.cpp
@@ -63,6 +63,7 @@ ShaderParameterPack::~ShaderParameterPack()
void ShaderParameterPack::reserve(int uniformCount)
{
m_uniforms.reserve(uniformCount);
+ m_submissionUniforms.reserve(uniformCount);
}
void ShaderParameterPack::setUniform(const int glslNameId, const UniformValue &val)