namespace Internal
{
-
namespace SceneGraph
{
}
}
-} // Anonymous namespace.
-
-
-RenderTaskProcessor::RenderTaskProcessor()
-{
-}
-
-RenderTaskProcessor::~RenderTaskProcessor()
-{
-}
-void RenderTaskProcessor::Process( BufferIndex updateBufferIndex,
- RenderTaskList& renderTasks,
- Layer& rootNode,
- SortedLayerPointers& sortedLayers,
- RenderInstructionContainer& instructions )
+/**
+ * Process the list of render-tasks; the output is a series of render instructions.
+ * @note When ProcessRenderTasks is called, the layers should already the transparent/opaque renderers which are ready to render.
+ * If there is only one default render-task, then no further processing is required.
+ * @param[in] updateBufferIndex The current update buffer index.
+ * @param[in] taskContainer The container of render-tasks.
+ * @param[in] rootNode The root node of the scene-graph.
+ * @param[in] sortedLayers The layers containing lists of opaque / transparent renderables.
+ * @param[out] instructions The instructions for rendering the next frame.
+ * @param[in] renderInstructionProcessor An instance of the RenderInstructionProcessor used to sort and handle the renderers for each layer.
+ * @param[in] processOffscreen Whether the offscreen render tasks are the ones processed. Otherwise it processes the onscreen tasks.
+ */
+void ProcessTasks( BufferIndex updateBufferIndex,
+ RenderTaskList::RenderTaskContainer& taskContainer,
+ Layer& rootNode,
+ SortedLayerPointers& sortedLayers,
+ RenderInstructionContainer& instructions,
+ RenderInstructionProcessor& renderInstructionProcessor,
+ bool processOffscreen )
{
- RenderTaskList::RenderTaskContainer& taskContainer = renderTasks.GetTasks();
-
- if( taskContainer.IsEmpty() )
- {
- // Early-exit if there are no tasks to process
- return;
- }
-
- // For each render-task:
- // 1) Prepare the render-task
- // 2) Clear the layer-stored lists of renderers (TODO check if the layer is not changed and don't clear in this case)
- // 3) Traverse the scene-graph, filling the lists for the current render-task
- // 4) Prepare render-instructions
-
- DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "RenderTaskProcessor::Process() Offscreens first\n" );
-
- // First process off screen render tasks - we may need the results of these for the on screen renders
uint32_t clippingId = 0u;
bool hasClippingNodes = false;
- RenderTaskList::RenderTaskContainer::ConstIterator endIter = taskContainer.End();
- for( RenderTaskList::RenderTaskContainer::Iterator iter = taskContainer.Begin(); endIter != iter; ++iter )
+ for( RenderTaskList::RenderTaskContainer::Iterator iter = taskContainer.Begin(), endIter = taskContainer.End(); endIter != iter; ++iter )
{
RenderTask& renderTask = **iter;
- // Off screen only.
- if( ( renderTask.GetFrameBuffer() == 0 ) || ( !renderTask.ReadyToRender( updateBufferIndex ) ) )
+ const bool hasFrameBuffer = renderTask.GetFrameBuffer() != 0;
+
+ if( ( !processOffscreen && hasFrameBuffer ) ||
+ ( processOffscreen && !hasFrameBuffer ) ||
+ !renderTask.ReadyToRender( updateBufferIndex ) )
{
// Skip to next task.
continue;
DALI_ASSERT_DEBUG( NULL != sourceNode ); // Otherwise Prepare() should return false
// Check that the source node is not exclusive to another task.
- if( ! CheckExclusivity( *sourceNode, renderTask ) )
+ if( !CheckExclusivity( *sourceNode, renderTask ) )
{
continue;
}
if( renderTask.IsRenderRequired() )
{
- size_t layerCount( sortedLayers.size() );
- for( size_t i(0); i<layerCount; ++i )
+ for( size_t i = 0u, layerCount = sortedLayers.size(); i < layerCount; ++i )
{
sortedLayers[i]->ClearRenderables();
}
0u,
hasClippingNodes );
- mRenderInstructionProcessor.Prepare( updateBufferIndex,
- sortedLayers,
- renderTask,
- renderTask.GetCullMode(),
- hasClippingNodes,
- instructions );
+ renderInstructionProcessor.Prepare( updateBufferIndex,
+ sortedLayers,
+ renderTask,
+ renderTask.GetCullMode(),
+ hasClippingNodes,
+ instructions );
}
}
+}
- DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "RenderTaskProcessor::Process() Onscreen\n" );
+} // Anonymous namespace.
- // Now that the off screen renders are done we can process on screen render tasks.
- // Reset the clipping Id for the OnScreen render tasks.
- clippingId = 0u;
- hasClippingNodes = false;
- for ( RenderTaskList::RenderTaskContainer::Iterator iter = taskContainer.Begin(); endIter != iter; ++iter )
- {
- RenderTask& renderTask = **iter;
+RenderTaskProcessor::RenderTaskProcessor()
+{
+}
- // On screen only.
- if( ( renderTask.GetFrameBuffer() != 0 ) || ( !renderTask.ReadyToRender( updateBufferIndex ) ) )
- {
- // Skip to next task.
- continue;
- }
+RenderTaskProcessor::~RenderTaskProcessor()
+{
+}
- Node* sourceNode = renderTask.GetSourceNode();
- DALI_ASSERT_DEBUG( NULL != sourceNode ); // Otherwise Prepare() should return false.
+void RenderTaskProcessor::Process( BufferIndex updateBufferIndex,
+ RenderTaskList& renderTasks,
+ Layer& rootNode,
+ SortedLayerPointers& sortedLayers,
+ RenderInstructionContainer& instructions )
+{
+ RenderTaskList::RenderTaskContainer& taskContainer = renderTasks.GetTasks();
- // Check that the source node is not exclusive to another task.
- if( ! CheckExclusivity( *sourceNode, renderTask ) )
- {
- continue;
- }
+ if( taskContainer.IsEmpty() )
+ {
+ // Early-exit if there are no tasks to process
+ return;
+ }
- Layer* layer = FindLayer( *sourceNode );
- if( !layer )
- {
- // Skip to next task as no layer.
- continue;
- }
+ // For each render-task:
+ // 1) Prepare the render-task
+ // 2) Clear the layer-stored lists of renderers (TODO check if the layer is not changed and don't clear in this case)
+ // 3) Traverse the scene-graph, filling the lists for the current render-task
+ // 4) Prepare render-instructions
- if( renderTask.IsRenderRequired() )
- {
- size_t layerCount( sortedLayers.size() );
- for( size_t i(0); i < layerCount; ++i )
- {
- sortedLayers[i]->ClearRenderables();
- }
+ DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "RenderTaskProcessor::Process() Offscreens first\n" );
- AddRenderablesForTask( updateBufferIndex,
- *sourceNode,
- *layer,
- renderTask,
- sourceNode->GetDrawMode(),
- clippingId,
- 0u,
- 0u,
- hasClippingNodes );
+ // First process off screen render tasks - we may need the results of these for the on screen renders
- mRenderInstructionProcessor.Prepare( updateBufferIndex,
- sortedLayers,
- renderTask,
- renderTask.GetCullMode(),
- hasClippingNodes,
- instructions );
- }
- }
-}
+ ProcessTasks( updateBufferIndex,
+ taskContainer,
+ rootNode,
+ sortedLayers,
+ instructions,
+ mRenderInstructionProcessor,
+ true );
+ DALI_LOG_INFO( gRenderTaskLogFilter, Debug::General, "RenderTaskProcessor::Process() Onscreen\n" );
+
+ // Now that the off screen renders are done we can process on screen render tasks.
+ // Reset the clipping Id for the OnScreen render tasks.
+ ProcessTasks( updateBufferIndex,
+ taskContainer,
+ rootNode,
+ sortedLayers,
+ instructions,
+ mRenderInstructionProcessor,
+ false );
+}
} // SceneGraph