-/**
- * @brief Sets up the depth buffer for reading and writing based on the current render item.
- * The items read and write mode are used if specified.
- * - If AUTO is selected for reading, the decision will be based on the Layer Behavior.
- * - If AUTO is selected for writing, the decision will be based on the items opacity.
- * @param[in] item The RenderItem to set up the depth buffer for.
- * @param[in] context The context used to execute GL commands.
- * @param[in] depthTestEnabled True if depth testing has been enabled.
- * @param[in/out] firstDepthBufferUse Initialise to true on the first call, this method will set it to false afterwards.
- */
-inline void SetupDepthBuffer( const RenderItem& item, Context& context, bool depthTestEnabled, bool& firstDepthBufferUse )
-{
- // Set up whether or not to write to the depth buffer.
- const DepthWriteMode::Type depthWriteMode = item.mRenderer->GetDepthWriteMode();
- // Most common mode (AUTO) is tested first.
- const bool enableDepthWrite = ( ( depthWriteMode == DepthWriteMode::AUTO ) && depthTestEnabled && item.mIsOpaque ) ||
- ( depthWriteMode == DepthWriteMode::ON );
-
- // Set up whether or not to read from (test) the depth buffer.
- const DepthTestMode::Type depthTestMode = item.mRenderer->GetDepthTestMode();
- // Most common mode (AUTO) is tested first.
- const bool enableDepthTest = ( ( depthTestMode == DepthTestMode::AUTO ) && depthTestEnabled ) ||
- ( depthTestMode == DepthTestMode::ON );
-
- // Is the depth buffer in use?
- if( enableDepthWrite || enableDepthTest )
- {
- // The depth buffer must be enabled if either reading or writing.
- context.EnableDepthBuffer( true );
-
- // Set up the depth mask based on our depth write setting.
- context.DepthMask( enableDepthWrite );
-
- // Look-up the GL depth function from the Dali::DepthFunction enum, and set it.
- context.DepthFunc( DaliDepthToGLDepthTable[ item.mRenderer->GetDepthFunction() ] );
-
- // If this is the first use of the depth buffer this RenderTask, perform a clear.
- // Note: We could do this at the beginning of the RenderTask and rely on the
- // context cache to ignore the clear if not required, but, we would have to enable
- // the depth buffer to do so, which could be a redundant enable.
- if( DALI_UNLIKELY( firstDepthBufferUse ) )
- {
- // This is the first time the depth buffer is being written to or read.
- firstDepthBufferUse = false;
-
- // Note: The buffer will only be cleared if written to since a previous clear.
- context.Clear( GL_DEPTH_BUFFER_BIT, Context::CHECK_CACHED_VALUES );
- }
- }
- else
- {
- // The depth buffer is not being used by this renderer, so we must disable it to stop it being tested.
- context.EnableDepthBuffer( false );
- }
-}
-
-/**
- * @brief Process a render-list.
- * @param[in] renderList The render-list to process.
- * @param[in] context The GL context.
- * @param[in] buffer The current render buffer index (previous update buffer)
- * @param[in] viewMatrix The view matrix from the appropriate camera.
- * @param[in] projectionMatrix The projection matrix from the appropriate camera.
- */
-inline void ProcessRenderList(
- const RenderList& renderList,
- Context& context,
- BufferIndex bufferIndex,
- const Matrix& viewMatrix,
- const Matrix& projectionMatrix )