X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Frendering%2Fscene-graph-renderer.h;h=b7c1aeff07bf9136468513c9e4bdfb7e0f14e1f2;hb=9d8818db1ee5ad9497cb7698be2a4752f6ecf50e;hp=f1ef2a729a9cc88d88db203ac1c2d19f54949afc;hpb=d5e2b535713c01724dd3ff49309c861fbd1a467c;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/rendering/scene-graph-renderer.h b/dali/internal/update/rendering/scene-graph-renderer.h index f1ef2a7..b7c1aef 100644 --- a/dali/internal/update/rendering/scene-graph-renderer.h +++ b/dali/internal/update/rendering/scene-graph-renderer.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -17,49 +17,49 @@ * limitations under the License. */ -#include -#include // Dali::Renderer +#include #include #include #include -#include -#include -#include -#include +#include #include #include +#include +#include +#include +#include +#include +#include // Dali::Renderer namespace Dali { - namespace Internal { - namespace Render { class Renderer; class Geometry; -} +} // namespace Render namespace SceneGraph { class SceneController; class Renderer; -typedef Dali::Vector< Renderer* > RendererContainer; -typedef RendererContainer::Iterator RendererIter; -typedef RendererContainer::ConstIterator RendererConstIter; +using RendererContainer = Dali::Vector; +using RendererIter = RendererContainer::Iterator; +using RendererConstIter = RendererContainer::ConstIterator; class TextureSet; class Geometry; -class Renderer : public PropertyOwner, - public UniformMapDataProvider, - public UniformMap::Observer, - public ConnectionChangePropagator::Observer +class Renderer : public PropertyOwner, + public UniformMapDataProvider, + public RenderDataProvider, + public UniformMap::Observer, + public ConnectionChangePropagator::Observer { public: - enum OpacityType { OPAQUE, @@ -75,40 +75,45 @@ public: /** * Destructor */ - virtual ~Renderer(); + ~Renderer() override; /** * Overriden delete operator * Deletes the renderer from its global memory pool */ - void operator delete( void* ptr ); + void operator delete(void* ptr); /** * Set the texture set for the renderer * @param[in] textureSet The texture set this renderer will use */ - void SetTextures( TextureSet* textureSet ); + void SetTextures(TextureSet* textureSet); - /** - * Returns current texture set object - * @return Pointer to the texture set - */ - const TextureSet* GetTextures() const + const SceneGraph::TextureSet* GetTextureSet() const { return mTextureSet; } /** + * @copydoc RenderDataProvider::GetTextures() + */ + const Vector* GetTextures() const override; + + /** + * @copydoc RenderDataProvider::GetSamplers() + */ + const Vector* GetSamplers() const override; + + /** * Set the shader for the renderer * @param[in] shader The shader this renderer will use */ - void SetShader( Shader* shader ); + void SetShader(Shader* shader); /** - * Get the shader used by this renderer - * @return the shader this renderer uses + * @copydoc RenderDataProvider::GetShader() */ - const Shader& GetShader() const + const Shader& GetShader() const override { return *mShader; } @@ -117,13 +122,13 @@ public: * Set the geometry for the renderer * @param[in] geometry The geometry this renderer will use */ - void SetGeometry( Render::Geometry* geometry ); + void SetGeometry(Render::Geometry* geometry); /** * Set the depth index * @param[in] depthIndex the new depth index to use */ - void SetDepthIndex( int depthIndex ); + void SetDepthIndex(int depthIndex); /** * @brief Get the depth index @@ -138,7 +143,7 @@ public: * Set the face culling mode * @param[in] faceCullingMode to use */ - void SetFaceCullingMode( FaceCullingMode::Type faceCullingMode ); + void SetFaceCullingMode(FaceCullingMode::Type faceCullingMode); /** * Get face culling mode @@ -150,7 +155,7 @@ public: * Set the blending mode * @param[in] blendingMode to use */ - void SetBlendMode( BlendMode::Type blendingMode ); + void SetBlendMode(BlendMode::Type blendingMode); /** * Get the blending mode @@ -162,19 +167,19 @@ public: * Set the blending options. This should only be called from the update thread. * @param[in] options A bitmask of blending options. */ - void SetBlendingOptions( unsigned int options ); + void SetBlendingOptions(uint32_t options); /** * Get the blending options * @return The the blending mode */ - unsigned int GetBlendingOptions() const; + uint32_t GetBlendingOptions() const; /** * Set the blend color for blending operation * @param blendColor to pass to GL */ - void SetBlendColor( const Vector4& blendColor ); + void SetBlendColor(const Vector4& blendColor); /** * Get the blending color @@ -186,31 +191,31 @@ public: * Set the index of first element for indexed draw * @param[in] firstElement index of first element to draw */ - void SetIndexedDrawFirstElement( size_t firstElement ); + void SetIndexedDrawFirstElement(uint32_t firstElement); /** * Get the index of first element for indexed draw * @return The index of first element for indexed draw */ - size_t GetIndexedDrawFirstElement() const; + uint32_t GetIndexedDrawFirstElement() const; /** * Set the number of elements to draw by indexed draw * @param[in] elementsCount number of elements to draw */ - void SetIndexedDrawElementsCount( size_t elementsCount ); + void SetIndexedDrawElementsCount(uint32_t elementsCount); /** * Get the number of elements to draw by indexed draw * @return The number of elements to draw by indexed draw */ - size_t GetIndexedDrawElementsCount() const; + uint32_t GetIndexedDrawElementsCount() const; /** * @brief Set whether the Pre-multiplied Alpha Blending is required * @param[in] preMultipled whether alpha is pre-multiplied. */ - void EnablePreMultipliedAlpha( bool preMultipled ); + void EnablePreMultipliedAlpha(bool preMultipled); /** * @brief Query whether alpha is pre-multiplied. @@ -222,7 +227,7 @@ public: * Sets the depth buffer write mode * @param[in] depthWriteMode The depth buffer write mode */ - void SetDepthWriteMode( DepthWriteMode::Type depthWriteMode ); + void SetDepthWriteMode(DepthWriteMode::Type depthWriteMode); /** * Get the depth buffer write mode @@ -234,7 +239,7 @@ public: * Sets the depth buffer test mode * @param[in] depthTestMode The depth buffer test mode */ - void SetDepthTestMode( DepthTestMode::Type depthTestMode ); + void SetDepthTestMode(DepthTestMode::Type depthTestMode); /** * Get the depth buffer test mode @@ -246,7 +251,7 @@ public: * Sets the depth function * @param[in] depthFunction The depth function */ - void SetDepthFunction( DepthFunction::Type depthFunction ); + void SetDepthFunction(DepthFunction::Type depthFunction); /** * Get the depth function @@ -258,49 +263,49 @@ public: * Sets the render mode * @param[in] mode The render mode */ - void SetRenderMode( RenderMode::Type mode ); + void SetRenderMode(RenderMode::Type mode); /** * Sets the stencil function * @param[in] stencilFunction The stencil function */ - void SetStencilFunction( StencilFunction::Type stencilFunction ); + void SetStencilFunction(StencilFunction::Type stencilFunction); /** * Sets the stencil function mask * @param[in] stencilFunctionMask The stencil function mask */ - void SetStencilFunctionMask( int stencilFunctionMask ); + void SetStencilFunctionMask(int stencilFunctionMask); /** * Sets the stencil function reference * @param[in] stencilFunctionReference The stencil function reference */ - void SetStencilFunctionReference( int stencilFunctionReference ); + void SetStencilFunctionReference(int stencilFunctionReference); /** * Sets the stencil mask * @param[in] stencilMask The stencil mask */ - void SetStencilMask( int stencilMask ); + void SetStencilMask(int stencilMask); /** * Sets the stencil operation for when the stencil test fails * @param[in] stencilOperationOnFail The stencil operation */ - void SetStencilOperationOnFail( StencilOperation::Type stencilOperationOnFail ); + void SetStencilOperationOnFail(StencilOperation::Type stencilOperationOnFail); /** * Sets the stencil operation for when the depth test fails * @param[in] stencilOperationOnZFail The stencil operation */ - void SetStencilOperationOnZFail( StencilOperation::Type stencilOperationOnZFail ); + void SetStencilOperationOnZFail(StencilOperation::Type stencilOperationOnZFail); /** * Sets the stencil operation for when the depth test passes * @param[in] stencilOperationOnZPass The stencil operation */ - void SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass ); + void SetStencilOperationOnZPass(StencilOperation::Type stencilOperationOnZPass); /** * Gets the stencil parameters @@ -313,21 +318,32 @@ public: * @param[in] updateBufferIndex The current update buffer index. * @param[in] opacity The opacity */ - void BakeOpacity( BufferIndex updateBufferIndex, float opacity ); + void BakeOpacity(BufferIndex updateBufferIndex, float opacity); + + /** + * @copydoc RenderDataProvider::GetOpacity() + */ + float GetOpacity(BufferIndex updateBufferIndex) const override; /** - * Gets the opacity - * @param[in] bufferIndex The buffer to read from. - * @return The opacity + * Sets the rendering behavior + * @param[in] renderingBehavior The rendering behavior required. */ - float GetOpacity( BufferIndex updateBufferIndex ) const; + void SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior); + + /** + * Gets the rendering behavior + * @return The rendering behavior + */ + DevelRenderer::Rendering::Type GetRenderingBehavior() const; /** * Prepare the object for rendering. * This is called by the UpdateManager when an object is due to be rendered in the current frame. * @param[in] updateBufferIndex The current update buffer index. + * @return Whether this renderer has been updated in the current frame */ - void PrepareRender( BufferIndex updateBufferIndex ); + bool PrepareRender(BufferIndex updateBufferIndex); /** * Retrieve the Render thread renderer @@ -340,17 +356,7 @@ public: * @param[in] updateBufferIndex The current update buffer index. * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between */ - OpacityType GetOpacityType( BufferIndex updateBufferIndex, const Node& node ) const; - - /** - * Called by the TextureSet to notify to the renderer that it has changed - */ - void TextureSetChanged(); - - /** - * Called by the TextureSet to notify to the renderer that it is about to be deleted - */ - void TextureSetDeleted(); + OpacityType GetOpacityType(BufferIndex updateBufferIndex, const Node& node) const; /** * Connect the object to the scene graph @@ -358,14 +364,39 @@ public: * @param[in] sceneController The scene controller - used for sending messages to render thread * @param[in] bufferIndex The current buffer index - used for sending messages to render thread */ - void ConnectToSceneGraph( SceneController& sceneController, BufferIndex bufferIndex ); + void ConnectToSceneGraph(SceneController& sceneController, BufferIndex bufferIndex); /** * Disconnect the object from the scene graph * @param[in] sceneController The scene controller - used for sending messages to render thread * @param[in] bufferIndex The current buffer index - used for sending messages to render thread */ - void DisconnectFromSceneGraph( SceneController& sceneController, BufferIndex bufferIndex ); + void DisconnectFromSceneGraph(SceneController& sceneController, BufferIndex bufferIndex); + + /** + * @copydoc RenderDataProvider::GetUniformMapDataProvider() + */ + const UniformMapDataProvider& GetUniformMapDataProvider() const override + { + return *this; + }; + + /** + * Sets RenderCallback object + * + * @param[in] callback Valid pointer to RenderCallback object + */ + void SetRenderCallback(RenderCallback* callback); + + /** + * Returns currently set RenderCallback pointer + * + * @return RenderCallback pointer or nullptr + */ + RenderCallback* GetRenderCallback() + { + return mRenderCallback; + } public: // Implementation of ConnectionChangePropagator /** @@ -382,325 +413,368 @@ public: // UniformMap::Observer /** * @copydoc UniformMap::Observer::UniformMappingsChanged */ - virtual void UniformMappingsChanged( const UniformMap& mappings ); + void UniformMappingsChanged(const UniformMap& mappings) override; public: // ConnectionChangePropagator::Observer - /** * @copydoc ConnectionChangePropagator::ConnectionsChanged */ - virtual void ConnectionsChanged( PropertyOwner& owner ); + void ConnectionsChanged(PropertyOwner& owner) override; /** * @copydoc ConnectionChangePropagator::ConnectedUniformMapChanged */ - virtual void ConnectedUniformMapChanged( ); + void ConnectedUniformMapChanged() override; /** * @copydoc ConnectionChangePropagator::ConnectedUniformMapChanged */ - virtual void ObservedObjectDestroyed(PropertyOwner& owner); + void ObservedObjectDestroyed(PropertyOwner& owner) override; public: // PropertyOwner implementation /** * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties() */ - virtual void ResetDefaultProperties( BufferIndex updateBufferIndex ){}; + virtual void ResetDefaultProperties(BufferIndex updateBufferIndex){}; public: // From UniformMapDataProvider - /** * @copydoc UniformMapDataProvider::GetUniformMapChanged */ - virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const{ return mUniformMapChanged[bufferIndex];} + bool GetUniformMapChanged(BufferIndex bufferIndex) const override + { + return mUniformMapChanged[bufferIndex]; + } /** * @copydoc UniformMapDataProvider::GetUniformMap */ - virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const; + const CollectedUniformMap& GetUniformMap(BufferIndex bufferIndex) const override; -private: + void SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size); +public: // For VisualProperties /** - * Protected constructor; See also Renderer::New() + * To be used only for 1st stage initialization in event thread. */ - Renderer(); + void SetVisualProperties(Internal::VisualRenderer::AnimatableVisualProperties* visualProperties) + { + mVisualProperties = visualProperties; + } /** - * Update texture set to the render data provider + * May be accessed from event thread + */ + const Internal::VisualRenderer::AnimatableVisualProperties* GetVisualProperties() const + { + return mVisualProperties; + } + +private: + /** + * Protected constructor; See also Renderer::New() */ - void UpdateTextureSet(); + Renderer(); private: + CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps collected by the renderer + + SceneController* mSceneController; ///< Used for initializing renderers + Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager) + TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned) + Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned) + Shader* mShader; ///< The shader this renderer uses. (Not owned) + VisualRenderer::AnimatableVisualProperties* mVisualProperties{nullptr}; ///< VisualProperties (optional/owned) + OwnerPointer mBlendColor; ///< The blend color for blending operation + + Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options + + uint32_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw + uint32_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw + uint32_t mBlendBitmask; ///< The bitmask of blending options + uint32_t mRegenerateUniformMap; ///< 2 if the map should be regenerated, 1 if it should be copied. + uint32_t mResendFlag; ///< Indicate whether data should be resent to the renderer + + DepthFunction::Type mDepthFunction : 4; ///< Local copy of the depth function + FaceCullingMode::Type mFaceCullingMode : 3; ///< Local copy of the mode of face culling + BlendMode::Type mBlendMode : 3; ///< Local copy of the mode of blending + DepthWriteMode::Type mDepthWriteMode : 3; ///< Local copy of the depth write mode + DepthTestMode::Type mDepthTestMode : 3; ///< Local copy of the depth test mode + DevelRenderer::Rendering::Type mRenderingBehavior : 2; ///< The rendering behavior + bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame + bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required + + std::vector mDrawCommands; + Dali::RenderCallback* mRenderCallback{nullptr}; - CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps collected by the renderer +public: + AnimatableProperty mOpacity; ///< The opacity value + int32_t mDepthIndex; ///< Used only in PrepareRenderInstructions +}; - SceneController* mSceneController; ///< Used for initializing renderers - Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager) - TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned) - Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned) - Shader* mShader; ///< The shader this renderer uses. (Not owned) - RenderDataProvider* mRenderDataProvider; ///< The render data provider - OwnerPointer< Vector4 > mBlendColor; ///< The blend color for blending operation +/// Messages +inline void SetTexturesMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet) +{ + using LocalType = MessageValue1; - Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - size_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw - size_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw - unsigned int mBlendBitmask; ///< The bitmask of blending options - unsigned int mRegenerateUniformMap; ///< 2 if the map should be regenerated, 1 if it should be copied. - unsigned int mResendFlag; ///< Indicate whether data should be resent to the renderer + // Construct message in the message queue memory; note that delete should not be called on the return value + new(slot) LocalType(&renderer, &Renderer::SetTextures, const_cast(&textureSet)); +} - DepthFunction::Type mDepthFunction:3; ///< Local copy of the depth function - FaceCullingMode::Type mFaceCullingMode:2; ///< Local copy of the mode of face culling - BlendMode::Type mBlendMode:2; ///< Local copy of the mode of blending - DepthWriteMode::Type mDepthWriteMode:2; ///< Local copy of the depth write mode - DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode +inline void SetGeometryMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry) +{ + using LocalType = MessageValue1; - bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame - bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); -public: + // Construct message in the message queue memory; note that delete should not be called on the return value + new(slot) LocalType(&renderer, &Renderer::SetGeometry, const_cast(&geometry)); +} - AnimatableProperty< float > mOpacity; ///< The opacity value - int mDepthIndex; ///< Used only in PrepareRenderInstructions +inline void SetShaderMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader) +{ + using LocalType = MessageValue1; -}; + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); + // Construct message in the message queue memory; note that delete should not be called on the return value + new(slot) LocalType(&renderer, &Renderer::SetShader, const_cast(&shader)); +} -/// Messages -inline void SetTexturesMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet ) +inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex) { - typedef MessageValue1< Renderer, TextureSet* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &renderer, &Renderer::SetTextures, const_cast(&textureSet) ); + new(slot) LocalType(&renderer, &Renderer::SetDepthIndex, depthIndex); } -inline void SetGeometryMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry ) +inline void SetFaceCullingModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode) { - typedef MessageValue1< Renderer, Render::Geometry* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &renderer, &Renderer::SetGeometry, const_cast(&geometry) ); + new(slot) LocalType(&renderer, &Renderer::SetFaceCullingMode, faceCullingMode); } -inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, Shader& shader ) +inline void SetBlendModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode) { - typedef MessageValue1< Renderer, Shader* > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &renderer, &Renderer::SetShader, &shader ); + new(slot) LocalType(&renderer, &Renderer::SetBlendMode, blendingMode); } -inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex ) +inline void SetBlendingOptionsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options) { - typedef MessageValue1< Renderer, int > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &renderer, &Renderer::SetDepthIndex, depthIndex ); + new(slot) LocalType(&renderer, &Renderer::SetBlendingOptions, options); } -inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode ) +inline void SetBlendColorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor) { - typedef MessageValue1< Renderer, FaceCullingMode::Type > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetFaceCullingMode, faceCullingMode ); + new(slot) LocalType(&renderer, &Renderer::SetBlendColor, blendColor); } -inline void SetBlendModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode ) +inline void SetIndexedDrawFirstElementMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement) { - typedef MessageValue1< Renderer, BlendMode::Type > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetBlendMode, blendingMode ); + new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawFirstElement, firstElement); } -inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, unsigned int options ) +inline void SetIndexedDrawElementsCountMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount) { - typedef MessageValue1< Renderer, unsigned int > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetBlendingOptions, options ); + new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount); } -inline void SetBlendColorMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor ) +inline void SetEnablePreMultipliedAlphaMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied) { - typedef MessageValue1< Renderer, Vector4 > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetBlendColor, blendColor ); + new(slot) LocalType(&renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied); } -inline void SetIndexedDrawFirstElementMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, size_t firstElement ) +inline void SetDepthWriteModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode) { - typedef MessageValue1< Renderer, size_t > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetIndexedDrawFirstElement, firstElement ); + new(slot) LocalType(&renderer, &Renderer::SetDepthWriteMode, depthWriteMode); } -inline void SetIndexedDrawElementsCountMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, size_t elementsCount ) +inline void SetDepthTestModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode) { - typedef MessageValue1< Renderer, size_t > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount ); + new(slot) LocalType(&renderer, &Renderer::SetDepthTestMode, depthTestMode); } -inline void SetEnablePreMultipliedAlphaMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied ) +inline void SetDepthFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction) { - typedef MessageValue1< Renderer, bool > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied ); + new(slot) LocalType(&renderer, &Renderer::SetDepthFunction, depthFunction); } -inline void SetDepthWriteModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode ) +inline void SetRenderModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode) { - typedef MessageValue1< Renderer, DepthWriteMode::Type > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetDepthWriteMode, depthWriteMode ); + new(slot) LocalType(&renderer, &Renderer::SetRenderMode, mode); } -inline void SetDepthTestModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode ) +inline void SetStencilFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction) { - typedef MessageValue1< Renderer, DepthTestMode::Type > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetDepthTestMode, depthTestMode ); + new(slot) LocalType(&renderer, &Renderer::SetStencilFunction, stencilFunction); } -inline void SetDepthFunctionMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction ) +inline void SetStencilFunctionMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int mask) { - typedef MessageValue1< Renderer, DepthFunction::Type > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetDepthFunction, depthFunction ); + new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionMask, mask); } -inline void SetRenderModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode ) +inline void SetStencilFunctionReferenceMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference) { - typedef MessageValue1< Renderer, RenderMode::Type > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetRenderMode, mode ); + new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference); } -inline void SetStencilFunctionMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction ) +inline void SetStencilMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask) { - typedef MessageValue1< Renderer, StencilFunction::Type > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetStencilFunction, stencilFunction ); + new(slot) LocalType(&renderer, &Renderer::SetStencilMask, stencilMask); } -inline void SetStencilFunctionMaskMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int mask ) +inline void SetStencilOperationOnFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation) { - typedef MessageValue1< Renderer, int > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetStencilFunctionMask, mask ); + new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnFail, stencilOperation); } -inline void SetStencilFunctionReferenceMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference ) +inline void SetStencilOperationOnZFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation) { - typedef MessageValue1< Renderer, int > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference ); + new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation); } -inline void SetStencilMaskMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask ) +inline void SetStencilOperationOnZPassMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation) { - typedef MessageValue1< Renderer, int > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetStencilMask, stencilMask ); + new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation); } -inline void SetStencilOperationOnFailMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation ) +inline void BakeOpacityMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity) { - typedef MessageValue1< Renderer, StencilOperation::Type > LocalType; + using LocalType = MessageDoubleBuffered1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnFail, stencilOperation ); + new(slot) LocalType(&renderer, &Renderer::BakeOpacity, opacity); } -inline void SetStencilOperationOnZFailMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation ) +inline void SetRenderingBehaviorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DevelRenderer::Rendering::Type renderingBehavior) { - typedef MessageValue1< Renderer, StencilOperation::Type > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation ); + new(slot) LocalType(&renderer, &Renderer::SetRenderingBehavior, renderingBehavior); } -inline void SetStencilOperationOnZPassMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation ) +inline void SetDrawCommandsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size) { - typedef MessageValue1< Renderer, StencilOperation::Type > LocalType; + using LocalType = MessageValue2; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation ); + new(slot) LocalType(&renderer, &Renderer::SetDrawCommands, pDrawCommands, size); } -inline void BakeOpacityMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity ) +inline void SetRenderCallbackMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::RenderCallback* callback) { - typedef MessageDoubleBuffered1< Renderer, float > LocalType; + using LocalType = MessageValue1; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); - new (slot) LocalType( &renderer, &Renderer::BakeOpacity, opacity ); + new(slot) LocalType(&renderer, &Renderer::SetRenderCallback, callback); } } // namespace SceneGraph