/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Layer* FindLayer( Node& node )
{
Node* currentNode( &node );
- Layer* layer( NULL );
+ Layer* layer( nullptr );
while( currentNode )
{
- if( ( layer = currentNode->GetLayer() ) != NULL )
+ if( ( layer = currentNode->GetLayer() ) != nullptr )
{
return layer;
}
currentNode = currentNode->GetParent();
}
- return NULL;
+ return nullptr;
}
/**
* @param[in] clippingDepth The current stencil clipping depth
* @param[in] clippingDepth The current scissor clipping depth
* @param[out] clippingUsed Gets set to true if any clipping nodes have been found
+ * @return true if rendering should be kept, false otherwise.
*/
-void AddRenderablesForTask( BufferIndex updateBufferIndex,
+bool AddRenderablesForTask( BufferIndex updateBufferIndex,
Node& node,
Layer& currentLayer,
RenderTask& renderTask,
uint32_t scissorDepth,
bool& clippingUsed )
{
+ bool keepRendering = false;
+
// Short-circuit for invisible nodes
if( !node.IsVisible( updateBufferIndex ) )
{
- return;
+ return keepRendering;
}
// Check whether node is exclusive to a different render-task
const RenderTask* exclusiveTo = node.GetExclusiveRenderTask();
if( exclusiveTo && ( exclusiveTo != &renderTask ) )
{
- return;
+ return keepRendering;
}
// Assume all children go to this layer (if this node is a layer).
DALI_ASSERT_DEBUG( NULL != layer );
- const unsigned int count = node.GetRendererCount();
+ const uint32_t count = node.GetRendererCount();
// Update the clipping Id and depth for this node (if clipping is enabled).
const Dali::ClippingMode::Type clippingMode = node.GetClippingMode();
// Set the information in the node.
node.SetClippingInformation( currentClippingId, clippingDepth, scissorDepth );
- for( unsigned int i = 0; i < count; ++i )
+ for( uint32_t i = 0; i < count; ++i )
{
SceneGraph::Renderer* renderer = node.GetRendererAt( i );
{
layer->overlayRenderables.PushBack( Renderable( &node, renderer ) );
}
+
+ if( renderer->GetRenderingBehavior() == DevelRenderer::Rendering::CONTINUOUSLY )
+ {
+ keepRendering = true;
+ }
}
// Recurse children.
for( NodeIter iter = children.Begin(); iter != endIter; ++iter )
{
Node& child = **iter;
- AddRenderablesForTask( updateBufferIndex, child, *layer, renderTask, inheritedDrawMode, currentClippingId, clippingDepth, scissorDepth, clippingUsed );
+ keepRendering |= AddRenderablesForTask( updateBufferIndex, child, *layer, renderTask, inheritedDrawMode, currentClippingId, clippingDepth, scissorDepth, clippingUsed );
}
+
+ return keepRendering;
}
/**
* @param[in] renderToFboEnabled Whether rendering into the Frame Buffer Object is enabled (used to measure FPS above 60)
* @param[in] isRenderingToFbo Whether this frame is being rendered into the Frame Buffer Object (used to measure FPS above 60)
* @param[in] processOffscreen Whether the offscreen render tasks are the ones processed. Otherwise it processes the onscreen tasks.
+ * @return true if rendering should be kept, false otherwise.
*/
-void ProcessTasks( BufferIndex updateBufferIndex,
+bool ProcessTasks( BufferIndex updateBufferIndex,
RenderTaskList::RenderTaskContainer& taskContainer,
Layer& rootNode,
SortedLayerPointers& sortedLayers,
bool hasClippingNodes = false;
bool isFirstRenderTask = true;
+ bool keepRendering = false;
for( RenderTaskList::RenderTaskContainer::Iterator iter = taskContainer.Begin(), endIter = taskContainer.End(); endIter != iter; ++iter )
{
RenderTask& renderTask = **iter;
- const bool hasFrameBuffer = NULL != renderTask.GetFrameBuffer();
+ const bool hasFrameBuffer = nullptr != renderTask.GetFrameBuffer();
const bool isDefaultRenderTask = isFirstRenderTask;
isFirstRenderTask = false;
continue;
}
- const unsigned int currentNumberOfInstructions = instructions.Count( updateBufferIndex );
+ const uint32_t currentNumberOfInstructions = instructions.Count( updateBufferIndex );
if( renderTask.IsRenderRequired() )
{
- for( size_t i = 0u, layerCount = sortedLayers.size(); i < layerCount; ++i )
+ for( auto&& sortedLayer : sortedLayers )
{
- sortedLayers[i]->ClearRenderables();
+ sortedLayer->ClearRenderables();
}
- AddRenderablesForTask( updateBufferIndex,
- *sourceNode,
- *layer,
- renderTask,
- sourceNode->GetDrawMode(),
- clippingId,
- 0u,
- 0u,
- hasClippingNodes );
+ keepRendering |= AddRenderablesForTask( updateBufferIndex,
+ *sourceNode,
+ *layer,
+ renderTask,
+ sourceNode->GetDrawMode(),
+ clippingId,
+ 0u,
+ 0u,
+ hasClippingNodes );
renderInstructionProcessor.Prepare( updateBufferIndex,
sortedLayers,
if( !processOffscreen && isDefaultRenderTask && renderToFboEnabled && !isRenderingToFbo && hasFrameBuffer )
{
// Traverse the instructions of the default render task and mark them to be rendered into the frame buffer.
- for( unsigned int index = currentNumberOfInstructions, count = instructions.Count( updateBufferIndex ); index < count; ++index )
+ const uint32_t count = instructions.Count( updateBufferIndex );
+ for( uint32_t index = currentNumberOfInstructions; index < count; ++index )
{
RenderInstruction& instruction = instructions.At( updateBufferIndex, index );
instruction.mIgnoreRenderToFbo = true;
}
}
}
+
+ return keepRendering;
}
} // Anonymous namespace.
{
}
-void RenderTaskProcessor::Process( BufferIndex updateBufferIndex,
+bool RenderTaskProcessor::Process( BufferIndex updateBufferIndex,
RenderTaskList& renderTasks,
Layer& rootNode,
SortedLayerPointers& sortedLayers,
bool isRenderingToFbo )
{
RenderTaskList::RenderTaskContainer& taskContainer = renderTasks.GetTasks();
+ bool keepRendering = false;
if( taskContainer.IsEmpty() )
{
// Early-exit if there are no tasks to process
- return;
+ return keepRendering;
}
// For each render-task:
// First process off screen render tasks - we may need the results of these for the on screen renders
- ProcessTasks( updateBufferIndex,
- taskContainer,
- rootNode,
- sortedLayers,
- instructions,
- mRenderInstructionProcessor,
- renderToFboEnabled,
- isRenderingToFbo,
- true );
+ keepRendering = ProcessTasks( updateBufferIndex,
+ taskContainer,
+ rootNode,
+ sortedLayers,
+ instructions,
+ mRenderInstructionProcessor,
+ renderToFboEnabled,
+ isRenderingToFbo,
+ 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,
- renderToFboEnabled,
- isRenderingToFbo,
- false );
+ keepRendering |= ProcessTasks( updateBufferIndex,
+ taskContainer,
+ rootNode,
+ sortedLayers,
+ instructions,
+ mRenderInstructionProcessor,
+ renderToFboEnabled,
+ isRenderingToFbo,
+ false );
+
+ return keepRendering;
}
} // SceneGraph