diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2019-11-30 10:43:37 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2019-12-03 06:38:58 +0100 |
commit | 5fb374d64c788ed830cc1473cb0b2c855e48e2dc (patch) | |
tree | 84c462886199efde059ab6820562b40c1b2641fc /src/render/renderers/opengl/renderer/renderview.cpp | |
parent | e5f99df24f4a587e30f9bba08cc5398c6d8354e3 (diff) |
Adequately split work among RenderViewCommandBuilder
Try to give at least 100 entities per worker.
Ideally we'd find a way to only add the required number
of jobs but ThreadPooler doesn't easily allow that.
Change-Id: Ieaf21b66eefd6c3e3b85b949917ea93b73834838
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/renderers/opengl/renderer/renderview.cpp')
-rw-r--r-- | src/render/renderers/opengl/renderer/renderview.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp index e761507ce..2eabec4ea 100644 --- a/src/render/renderers/opengl/renderer/renderview.cpp +++ b/src/render/renderers/opengl/renderer/renderview.cpp @@ -621,13 +621,16 @@ void RenderView::addClearBuffers(const ClearBuffers *cb) { } // If we are there, we know that entity had a GeometryRenderer + Material -EntityRenderCommandData RenderView::buildDrawRenderCommands(const QVector<Entity *> &entities) const +EntityRenderCommandData RenderView::buildDrawRenderCommands(const QVector<Entity *> &entities, + int offset, int count) const { EntityRenderCommandData commands; - commands.reserve(entities.size()); + commands.reserve(count); - for (Entity *entity : entities) { + for (int i = 0; i < count; ++i) { + const int idx = offset + i; + Entity *entity = entities.at(idx); GeometryRenderer *geometryRenderer = nullptr; HGeometryRenderer geometryRendererHandle = entity->componentHandle<GeometryRenderer>(); @@ -672,7 +675,8 @@ EntityRenderCommandData RenderView::buildDrawRenderCommands(const QVector<Entity return commands; } -EntityRenderCommandData RenderView::buildComputeRenderCommands(const QVector<Entity *> &entities) const +EntityRenderCommandData RenderView::buildComputeRenderCommands(const QVector<Entity *> &entities, + int offset, int count) const { // If the RenderView contains only a ComputeDispatch then it cares about // A ComputeDispatch is also implicitely a NoDraw operation @@ -681,9 +685,11 @@ EntityRenderCommandData RenderView::buildComputeRenderCommands(const QVector<Ent // material/effect/technique/parameters/filters/ EntityRenderCommandData commands; - commands.reserve(entities.size()); + commands.reserve(count); - for (Entity *entity : entities) { + for (int i = 0; i < count; ++i) { + const int idx = offset + i; + Entity *entity = entities.at(idx); ComputeCommand *computeJob = nullptr; HComputeCommand computeCommandHandle = entity->componentHandle<ComputeCommand>(); if ((computeJob = nodeManagers()->computeJobManager()->data(computeCommandHandle)) != nullptr |