summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/renderer/renderer.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-11-29 12:01:11 +0100
committerPaul Lemire <paul.lemire@kdab.com>2019-12-03 07:02:41 +0100
commita83d7847eae1c67ae5eb35e62b1d7549c90fae3a (patch)
tree1a4b1e28b06466bc8ffc463ac404d6a14c99da9c /src/render/renderers/opengl/renderer/renderer.cpp
parent5fb374d64c788ed830cc1473cb0b2c855e48e2dc (diff)
Fill as much as what we can when building the RC
Avoids repeating that process over and over again in the submission phase. Change-Id: Ie2fa36842cd7280f7c966381238e90dd2dbaa821 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/renderers/opengl/renderer/renderer.cpp')
-rw-r--r--src/render/renderers/opengl/renderer/renderer.cpp68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/render/renderers/opengl/renderer/renderer.cpp b/src/render/renderers/opengl/renderer/renderer.cpp
index a530c26b0..d79750726 100644
--- a/src/render/renderers/opengl/renderer/renderer.cpp
+++ b/src/render/renderers/opengl/renderer/renderer.cpp
@@ -1019,74 +1019,6 @@ void Renderer::prepareCommandsSubmission(const QVector<RenderView *> &renderView
// Prepare the ShaderParameterPack based on the active uniforms of the shader
shader->prepareUniforms(command.m_parameterPack);
- { // Scoped to show extent
- command.m_isValid = !command.m_activeAttributes.empty();
- if (!command.m_isValid)
- continue;
-
- // Update the draw command with what's going to be needed for the drawing
- uint primitiveCount = rGeometryRenderer->vertexCount();
- uint estimatedCount = 0;
- Attribute *indexAttribute = nullptr;
- Attribute *indirectAttribute = nullptr;
-
- const QVector<Qt3DCore::QNodeId> attributeIds = rGeometry->attributes();
- for (Qt3DCore::QNodeId attributeId : attributeIds) {
- Attribute *attribute = m_nodesManager->attributeManager()->lookupResource(attributeId);
- switch (attribute->attributeType()) {
- case QAttribute::IndexAttribute:
- indexAttribute = attribute;
- break;
- case QAttribute::DrawIndirectAttribute:
- indirectAttribute = attribute;
- break;
- case QAttribute::VertexAttribute: {
- if (command.m_activeAttributes.contains(attribute->nameId()))
- estimatedCount = qMax(attribute->count(), estimatedCount);
- break;
- }
- default:
- Q_UNREACHABLE();
- break;
- }
- }
-
- command.m_drawIndexed = (indexAttribute != nullptr);
- command.m_drawIndirect = (indirectAttribute != nullptr);
-
- // Update the draw command with all the information required for the drawing
- if (command.m_drawIndexed) {
- command.m_indexAttributeDataType = GraphicsContext::glDataTypeFromAttributeDataType(indexAttribute->vertexBaseType());
- command.m_indexAttributeByteOffset = indexAttribute->byteOffset() + rGeometryRenderer->indexBufferByteOffset();
- }
-
- // Note: we only care about the primitiveCount when using direct draw calls
- // For indirect draw calls it is assumed the buffer was properly set already
- if (command.m_drawIndirect) {
- command.m_indirectAttributeByteOffset = indirectAttribute->byteOffset();
- command.m_indirectDrawBuffer = m_nodesManager->bufferManager()->lookupHandle(indirectAttribute->bufferId());
- } else {
- // Use the count specified by the GeometryRender
- // If not specify use the indexAttribute count if present
- // Otherwise tries to use the count from the attribute with the highest count
- if (primitiveCount == 0) {
- if (indexAttribute)
- primitiveCount = indexAttribute->count();
- else
- primitiveCount = estimatedCount;
- }
- }
-
- command.m_primitiveCount = primitiveCount;
- command.m_primitiveType = rGeometryRenderer->primitiveType();
- command.m_primitiveRestartEnabled = rGeometryRenderer->primitiveRestartEnabled();
- command.m_restartIndexValue = rGeometryRenderer->restartIndexValue();
- command.m_firstInstance = rGeometryRenderer->firstInstance();
- command.m_instanceCount = rGeometryRenderer->instanceCount();
- command.m_firstVertex = rGeometryRenderer->firstVertex();
- command.m_indexOffset = rGeometryRenderer->indexOffset();
- command.m_verticesPerPatch = rGeometryRenderer->verticesPerPatch();
- } // scope
} else if (command.m_type == RenderCommand::Compute) {
Shader *shader = m_nodesManager->data<Shader, ShaderManager>(command.m_shader);
Q_ASSERT(shader);