+inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList,
+ Context& context,
+ BufferIndex bufferIndex,
+ const Matrix& viewMatrix,
+ const Matrix& projectionMatrix )
+{
+ DALI_PRINT_RENDER_LIST( renderList );
+
+ // Note: The depth buffer is enabled or disabled on a per-renderer basis.
+ // Here we pre-calculate the value to use if these modes are set to AUTO.
+ const bool autoDepthTestMode( !( renderList.GetSourceLayer()->IsDepthTestDisabled() ) && renderList.HasColorRenderItems() );
+ const std::size_t count = renderList.Count();
+ uint32_t lastClippingDepth( 0u );
+ uint32_t lastClippingId( 0u );
+ bool usedStencilBuffer( false );
+ bool firstDepthBufferUse( true );
+ mViewportRectangle = context.GetViewport();
+ mHasLayerScissor = false;
+
+ // Setup Scissor testing (for both viewport and per-node scissor)
+ mScissorStack.clear();
+ if( renderList.IsClipping() )
+ {
+ context.SetScissorTest( true );
+ const ClippingBox& layerScissorBox = renderList.GetClippingBox();
+ context.Scissor( layerScissorBox.x, layerScissorBox.y, layerScissorBox.width, layerScissorBox.height );
+ mScissorStack.push_back( layerScissorBox );
+ mHasLayerScissor = true;
+ }
+ else
+ {
+ // We are not performing a layer clip. Add the viewport as the root scissor rectangle.
+ context.SetScissorTest( false );
+ mScissorStack.push_back( mViewportRectangle );
+ }
+
+ // Loop through all RenderList in the RenderList, set up any prerequisites to render them, then perform the render.
+ for( size_t index( 0u ); index < count; ++index )
+ {
+ const RenderItem& item = renderList.GetItem( index );
+ DALI_PRINT_RENDER_ITEM( item );
+
+ // Set up clipping based on both the Renderer and Actor APIs.
+ // The Renderer API will be used if specified. If AUTO, the Actors automatic clipping feature will be used.
+ SetupClipping( item, context, usedStencilBuffer, lastClippingDepth, lastClippingId );
+
+ if( DALI_LIKELY( item.mRenderer ) )
+ {
+ // Set up the depth buffer based on per-renderer flags.
+ // If the per renderer flags are set to "ON" or "OFF", they will always override any Layer depth mode or
+ // draw-mode state, such as Overlays.
+ // If the flags are set to "AUTO", the behavior then depends on the type of renderer. Overlay Renderers will always
+ // disable depth testing and writing. Color Renderers will enable them if the Layer does.
+ SetupDepthBuffer( item, context, autoDepthTestMode, firstDepthBufferUse );
+
+ // Render the item.
+ item.mRenderer->Render( context, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix,
+ viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque );
+ }
+ }
+}
+
+RenderAlgorithms::RenderAlgorithms()
+ : mViewportRectangle(),
+ mHasLayerScissor( false )
+{
+}
+
+void RenderAlgorithms::ProcessRenderInstruction( const RenderInstruction& instruction, Context& context, BufferIndex bufferIndex )