summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/renderer/renderview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/renderers/opengl/renderer/renderview.cpp')
-rw-r--r--src/render/renderers/opengl/renderer/renderview.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp
index b102de9de..97d494370 100644
--- a/src/render/renderers/opengl/renderer/renderview.cpp
+++ b/src/render/renderers/opengl/renderer/renderview.cpp
@@ -621,11 +621,11 @@ void RenderView::addClearBuffers(const ClearBuffers *cb) {
}
// If we are there, we know that entity had a GeometryRenderer + Material
-QVector<EntityRenderCommandData> RenderView::buildDrawRenderCommands(const QVector<Entity *> &entities) const
+EntityRenderCommandData RenderView::buildDrawRenderCommands(const QVector<Entity *> &entities) const
{
- QVector<EntityRenderCommandData> commands;
- commands.reserve(entities.size());
+ EntityRenderCommandData commands;
+ commands.reserve(entities.size());
for (Entity *entity : entities) {
GeometryRenderer *geometryRenderer = nullptr;
@@ -662,8 +662,9 @@ QVector<EntityRenderCommandData> RenderView::buildDrawRenderCommands(const QVect
}
command.m_shader = m_manager->lookupHandle<Shader, ShaderManager, HShader>(pass->shaderProgram());
- const EntityRenderCommandData commandData = { entity, command, passData };
- commands.append(commandData);
+ commands.push_back(entity,
+ std::move(command),
+ std::move(passData));
}
}
}
@@ -671,15 +672,17 @@ QVector<EntityRenderCommandData> RenderView::buildDrawRenderCommands(const QVect
return commands;
}
-QVector<EntityRenderCommandData> RenderView::buildComputeRenderCommands(const QVector<Entity *> &entities) const
+EntityRenderCommandData RenderView::buildComputeRenderCommands(const QVector<Entity *> &entities) const
{
// If the RenderView contains only a ComputeDispatch then it cares about
// A ComputeDispatch is also implicitely a NoDraw operation
// enabled flag
// layer component
// material/effect/technique/parameters/filters/
- QVector<EntityRenderCommandData> commands;
+ EntityRenderCommandData commands;
+
commands.reserve(entities.size());
+
for (Entity *entity : entities) {
ComputeCommand *computeJob = nullptr;
HComputeCommand computeCommandHandle = entity->componentHandle<ComputeCommand>();
@@ -712,8 +715,9 @@ QVector<EntityRenderCommandData> RenderView::buildComputeRenderCommands(const QV
command.m_workGroups[1] = std::max(m_workGroups[1], computeJob->y());
command.m_workGroups[2] = std::max(m_workGroups[2], computeJob->z());
- const EntityRenderCommandData commandData = { entity, command, passData };
- commands.append(commandData);
+ commands.push_back(entity,
+ std::move(command),
+ std::move(passData));
}
}
}
@@ -721,7 +725,7 @@ QVector<EntityRenderCommandData> RenderView::buildComputeRenderCommands(const QV
return commands;
}
-void RenderView::updateRenderCommand(QVector<EntityRenderCommandData *> &renderCommandData)
+void RenderView::updateRenderCommand(EntityRenderCommandData &renderCommandData)
{
// Note: since many threads can be building render commands
// we need to ensure that the UniformBlockValueBuilder they are using
@@ -731,10 +735,10 @@ void RenderView::updateRenderCommand(QVector<EntityRenderCommandData *> &renderC
builder->textureManager = m_manager->textureManager();
m_localData.setLocalData(builder);
- for (EntityRenderCommandData *commandData : renderCommandData) {
- Entity *entity = commandData->entity;
- RenderPassParameterData passData = commandData->passData;
- RenderCommand &command = commandData->command;
+ for (int i = 0, m = renderCommandData.size(); i < m; ++i) {
+ Entity *entity = renderCommandData.entities.at(i);
+ const RenderPassParameterData passData = renderCommandData.passesData.at(i);
+ RenderCommand &command = renderCommandData.commands[i];
// Pick which lights to take in to account.
// For now decide based on the distance by taking the MAX_LIGHTS closest lights.