1 #ifndef DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
2 #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include <dali/devel-api/rendering/renderer-devel.h>
21 #include <dali/internal/common/blending-options.h>
22 #include <dali/internal/common/memory-pool-key.h>
23 #include <dali/internal/common/type-abstraction-enums.h>
24 #include <dali/internal/event/common/event-thread-services.h>
25 #include <dali/internal/render/data-providers/render-data-provider.h>
26 #include <dali/internal/render/renderers/render-renderer.h>
27 #include <dali/internal/update/common/animatable-property.h>
28 #include <dali/internal/update/common/property-owner.h>
29 #include <dali/internal/update/common/uniform-map.h>
30 #include <dali/public-api/rendering/geometry.h>
31 #include <dali/public-api/rendering/renderer.h> // Dali::Renderer
45 class SceneController;
51 using RendererKey = MemoryPoolKey<SceneGraph::Renderer>;
53 } // namespace SceneGraph
54 } // namespace Internal
56 // Ensure RendererKey can be used in Dali::Vector
58 struct TypeTraits<Internal::SceneGraph::RendererKey> : public BasicTypes<Internal::SceneGraph::RendererKey>
62 IS_TRIVIAL_TYPE = true
70 using RendererContainer = Dali::Vector<RendererKey>;
71 using RendererIter = RendererContainer::Iterator;
72 using RendererConstIter = RendererContainer::ConstIterator;
74 namespace VisualRenderer
76 struct AnimatableVisualProperties
78 AnimatableVisualProperties()
79 : mTransformOffset(Vector2::ZERO),
80 mTransformSize(Vector2::ONE),
81 mTransformOrigin(Vector2::ZERO),
82 mTransformAnchorPoint(Vector2::ZERO),
83 mTransformOffsetSizeMode(Vector4::ZERO),
84 mExtraSize(Vector2::ZERO),
85 mMixColor(Vector3::ONE),
86 mPreMultipliedAlpha(0.0f),
87 mExtendedPropertiesDeleteFunction(nullptr)
91 ~AnimatableVisualProperties()
93 if(mExtendedProperties && mExtendedPropertiesDeleteFunction)
95 mExtendedPropertiesDeleteFunction(mExtendedProperties);
100 * @brief Cached coefficient value when we calculate visual transformed update size.
101 * It can reduce complexity of calculate the vertex position.
103 * Vector2 vertexPosition = (XA * aPosition + XB) * originalSize + (CA * aPosition + CB) + Vector2(D, D) * aPosition
105 struct VisualTransformedUpdateSizeCoefficientCache
107 Vector2 coefXA{Vector2::ZERO};
108 Vector2 coefXB{Vector2::ZERO};
109 Vector2 coefCA{Vector2::ZERO};
110 Vector2 coefCB{Vector2::ZERO};
114 uint64_t decoratedHash{0u};
116 VisualTransformedUpdateSizeCoefficientCache mCoefficient; ///< Coefficient value to calculate visual transformed update size by VisualProperties more faster.
118 AnimatableProperty<Vector2> mTransformOffset;
119 AnimatableProperty<Vector2> mTransformSize;
120 AnimatableProperty<Vector2> mTransformOrigin;
121 AnimatableProperty<Vector2> mTransformAnchorPoint;
122 AnimatableProperty<Vector4> mTransformOffsetSizeMode;
123 AnimatableProperty<Vector2> mExtraSize;
124 AnimatableProperty<Vector3> mMixColor;
125 AnimatableProperty<float> mPreMultipliedAlpha;
127 void* mExtendedProperties{nullptr}; // Enable derived class to extend properties further
128 void (*mExtendedPropertiesDeleteFunction)(void*){nullptr}; // Derived class's custom delete functor
131 struct AnimatableDecoratedVisualProperties
133 AnimatableDecoratedVisualProperties()
134 : mCornerRadius(Vector4::ZERO),
135 mCornerRadiusPolicy(1.0f),
136 mBorderlineWidth(0.0f),
137 mBorderlineColor(Color::BLACK),
138 mBorderlineOffset(0.0f),
142 ~AnimatableDecoratedVisualProperties()
146 // Delete function of AnimatableDecoratedVisualProperties* converted as void*
147 static void DeleteFunction(void* data)
149 delete static_cast<AnimatableDecoratedVisualProperties*>(data);
152 AnimatableProperty<Vector4> mCornerRadius;
153 AnimatableProperty<float> mCornerRadiusPolicy;
154 AnimatableProperty<float> mBorderlineWidth;
155 AnimatableProperty<Vector4> mBorderlineColor;
156 AnimatableProperty<float> mBorderlineOffset;
157 AnimatableProperty<float> mBlurRadius;
159 } // namespace VisualRenderer
161 class Renderer : public PropertyOwner,
162 public UniformMapDataProvider,
163 public RenderDataProvider
174 * Construct a new Renderer
176 static RendererKey NewKey();
181 ~Renderer() override;
184 * Overriden delete operator
185 * Deletes the renderer from its global memory pool
187 void operator delete(void* ptr);
190 * Get a pointer to the object from the given key.
191 * Used by MemoryPoolKey to provide pointer semantics.
193 static Renderer* Get(RendererKey::KeyType);
196 * Get the key of the given renderer in the associated memory pool.
197 * @param[in] renderer the given renderer
198 * @return The key in the associated memory pool.
200 static RendererKey GetKey(const SceneGraph::Renderer& renderer);
203 * Get the key of the given renderer in the associated memory pool.
204 * @param[in] renderer the given renderer
205 * @return The key in the associated memory pool, or -1 if not
208 static RendererKey GetKey(SceneGraph::Renderer* renderer);
211 * Set the texture set for the renderer
212 * @param[in] textureSet The texture set this renderer will use
214 void SetTextures(TextureSet* textureSet);
217 * Get the associated texture set
218 * @return the texture set.
220 const SceneGraph::TextureSet* GetTextureSet() const
226 * @copydoc RenderDataProvider::GetTextures()
228 const Vector<Render::TextureKey>* GetTextures() const override;
231 * @copydoc RenderDataProvider::GetSamplers()
233 const Vector<Render::Sampler*>* GetSamplers() const override;
236 * Set the shader for the renderer
237 * @param[in] shader The shader this renderer will use
239 void SetShader(Shader* shader);
242 * @copydoc RenderDataProvider::GetShader()
244 const Shader& GetShader() const override
250 * Set the geometry for the renderer
251 * @param[in] geometry The geometry this renderer will use
253 void SetGeometry(Render::Geometry* geometry);
256 * Set the depth index
257 * @param[in] depthIndex the new depth index to use
259 void SetDepthIndex(int depthIndex);
262 * @brief Get the depth index
263 * @return The depth index
265 int GetDepthIndex() const
271 * Set the face culling mode
272 * @param[in] faceCullingMode to use
274 void SetFaceCullingMode(FaceCullingMode::Type faceCullingMode);
277 * Get face culling mode
278 * @return The face culling mode
280 FaceCullingMode::Type GetFaceCullingMode() const;
283 * Set the blending mode
284 * @param[in] blendingMode to use
286 void SetBlendMode(BlendMode::Type blendingMode);
289 * Get the blending mode
290 * @return The the blending mode
292 BlendMode::Type GetBlendMode() const;
295 * Set the blending options. This should only be called from the update thread.
296 * @param[in] options A bitmask of blending options.
298 void SetBlendingOptions(uint32_t options);
301 * Get the blending options
302 * @return The the blending mode
304 uint32_t GetBlendingOptions() const;
307 * Set the blend color for blending operation
308 * @param blendColor to pass to GL
310 void SetBlendColor(const Vector4& blendColor);
313 * Get the blending color
314 * @return The blend color
316 Vector4 GetBlendColor() const;
319 * Set the index of first element for indexed draw
320 * @param[in] firstElement index of first element to draw
322 void SetIndexedDrawFirstElement(uint32_t firstElement);
325 * Get the index of first element for indexed draw
326 * @return The index of first element for indexed draw
328 uint32_t GetIndexedDrawFirstElement() const;
331 * Set the number of elements to draw by indexed draw
332 * @param[in] elementsCount number of elements to draw
334 void SetIndexedDrawElementsCount(uint32_t elementsCount);
337 * Get the number of elements to draw by indexed draw
338 * @return The number of elements to draw by indexed draw
340 uint32_t GetIndexedDrawElementsCount() const;
343 * @brief Set whether the Pre-multiplied Alpha Blending is required
344 * @param[in] preMultipled whether alpha is pre-multiplied.
346 void EnablePreMultipliedAlpha(bool preMultipled);
349 * @brief Query whether alpha is pre-multiplied.
350 * @return True is alpha is pre-multiplied, false otherwise.
352 bool IsPreMultipliedAlphaEnabled() const;
355 * Sets the depth buffer write mode
356 * @param[in] depthWriteMode The depth buffer write mode
358 void SetDepthWriteMode(DepthWriteMode::Type depthWriteMode);
361 * Get the depth buffer write mode
362 * @return The depth buffer write mode
364 DepthWriteMode::Type GetDepthWriteMode() const;
367 * Sets the depth buffer test mode
368 * @param[in] depthTestMode The depth buffer test mode
370 void SetDepthTestMode(DepthTestMode::Type depthTestMode);
373 * Get the depth buffer test mode
374 * @return The depth buffer test mode
376 DepthTestMode::Type GetDepthTestMode() const;
379 * Sets the depth function
380 * @param[in] depthFunction The depth function
382 void SetDepthFunction(DepthFunction::Type depthFunction);
385 * Get the depth function
386 * @return The depth function
388 DepthFunction::Type GetDepthFunction() const;
391 * Sets the render mode
392 * @param[in] mode The render mode
394 void SetRenderMode(RenderMode::Type mode);
397 * Sets the stencil function
398 * @param[in] stencilFunction The stencil function
400 void SetStencilFunction(StencilFunction::Type stencilFunction);
403 * Sets the stencil function mask
404 * @param[in] stencilFunctionMask The stencil function mask
406 void SetStencilFunctionMask(int stencilFunctionMask);
409 * Sets the stencil function reference
410 * @param[in] stencilFunctionReference The stencil function reference
412 void SetStencilFunctionReference(int stencilFunctionReference);
415 * Sets the stencil mask
416 * @param[in] stencilMask The stencil mask
418 void SetStencilMask(int stencilMask);
421 * Sets the stencil operation for when the stencil test fails
422 * @param[in] stencilOperationOnFail The stencil operation
424 void SetStencilOperationOnFail(StencilOperation::Type stencilOperationOnFail);
427 * Sets the stencil operation for when the depth test fails
428 * @param[in] stencilOperationOnZFail The stencil operation
430 void SetStencilOperationOnZFail(StencilOperation::Type stencilOperationOnZFail);
433 * Sets the stencil operation for when the depth test passes
434 * @param[in] stencilOperationOnZPass The stencil operation
436 void SetStencilOperationOnZPass(StencilOperation::Type stencilOperationOnZPass);
439 * Gets the stencil parameters
440 * @return The stencil parameters
442 const Render::Renderer::StencilParameters& GetStencilParameters() const;
446 * @param[in] updateBufferIndex The current update buffer index.
447 * @param[in] opacity The opacity
449 void BakeOpacity(BufferIndex updateBufferIndex, float opacity);
452 * @copydoc RenderDataProvider::GetOpacity()
454 float GetOpacity(BufferIndex updateBufferIndex) const override;
457 * Sets the rendering behavior
458 * @param[in] renderingBehavior The rendering behavior required.
460 void SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior);
463 * Gets the rendering behavior
464 * @return The rendering behavior
466 DevelRenderer::Rendering::Type GetRenderingBehavior() const;
469 * Prepare the object for rendering.
470 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
471 * @param[in] updateBufferIndex The current update buffer index.
472 * @return Whether this renderer has been updated in the current frame
474 bool PrepareRender(BufferIndex updateBufferIndex);
477 * Retrieve the Render thread renderer
478 * @return The associated render thread renderer
480 Render::RendererKey GetRenderer();
483 * Query whether the renderer is fully opaque, fully transparent or transparent.
484 * @param[in] updateBufferIndex The current update buffer index.
485 * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
487 OpacityType GetOpacityType(BufferIndex updateBufferIndex, const Node& node) const;
490 * Connect the object to the scene graph
492 * @param[in] sceneController The scene controller - used for sending messages to render thread
493 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
495 void ConnectToSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
498 * Disconnect the object from the scene graph
499 * @param[in] sceneController The scene controller - used for sending messages to render thread
500 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
502 void DisconnectFromSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
505 * @copydoc RenderDataProvider::GetUniformMapDataProvider()
507 const UniformMapDataProvider& GetUniformMapDataProvider() const override
513 * @copydoc RenderDataProvider::IsUpdated()
515 bool IsUpdated() const override
521 * @copydoc RenderDataProvider::GetVisualTransformedUpdateArea()
523 Vector4 GetVisualTransformedUpdateArea(BufferIndex updateBufferIndex, const Vector4& originalUpdateArea) noexcept override;
526 * Sets RenderCallback object
528 * @param[in] callback Valid pointer to RenderCallback object
530 void SetRenderCallback(RenderCallback* callback);
533 * Returns currently set RenderCallback pointer
535 * @return RenderCallback pointer or nullptr
537 RenderCallback* GetRenderCallback()
539 return mRenderCallback;
543 * Merge shader uniform map into renderer uniform map if any of the
544 * maps have changed. Only update uniform map if added to render
546 * @param[in] updateBufferIndex The current update buffer index.
548 void UpdateUniformMap(BufferIndex updateBufferIndex);
551 * Set the given external draw commands on this renderer.
553 void SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size);
556 * Query whether a renderer is dirty.
557 * @return true if the renderer is dirty.
558 * @note It is used to decide whether to reuse the RenderList. We can't reuse the RenderList if this is dirty.
560 bool IsDirty() const;
563 * Reset both dirty flag and updated flag.
564 * @note This is called after rendering has completed.
566 void ResetDirtyFlag();
569 * Get the capacity of the memory pools
570 * @return the capacity of the memory pools
572 static uint32_t GetMemoryPoolCapacity();
574 public: // PropertyOwner::MappingChanged
576 * @copydoc PropertyOwner::OnMappingChanged
578 void OnMappingChanged() override;
580 public: // PropertyOwner implementation
582 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
584 virtual void ResetDefaultProperties(BufferIndex updateBufferIndex){};
586 public: // From UniformMapDataProvider
588 * @copydoc UniformMapDataProvider::GetCollectedUniformMap
590 const CollectedUniformMap& GetCollectedUniformMap() const override;
592 public: // For VisualProperties
594 * To be used only for 1st stage initialization in event thread.
596 void SetVisualProperties(VisualRenderer::AnimatableVisualProperties* visualProperties)
598 mVisualProperties = visualProperties;
602 * May be accessed from event thread
604 const VisualRenderer::AnimatableVisualProperties* GetVisualProperties() const
606 return mVisualProperties.Get();
611 * Protected constructor; See also Renderer::New()
624 CollectedUniformMap mCollectedUniformMap; ///< Uniform maps collected by the renderer
626 SceneController* mSceneController; ///< Used for initializing renderers
627 Render::RendererKey mRenderer; ///< Key to the renderer (that's owned by RenderManager)
628 TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned)
629 Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned)
630 Shader* mShader; ///< The shader this renderer uses. (Not owned)
632 OwnerPointer<VisualRenderer::AnimatableVisualProperties> mVisualProperties{nullptr}; ///< VisualProperties (optional/owned)
633 OwnerPointer<Vector4> mBlendColor; ///< The blend color for blending operation
635 Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
637 uint64_t mUniformsHash{0}; ///< Hash of uniform map property values
638 uint32_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw
639 uint32_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw
640 uint32_t mBlendBitmask; ///< The bitmask of blending options
641 uint32_t mResendFlag; ///< Indicate whether data should be resent to the renderer
642 UniformMap::SizeType mUniformMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
643 UniformMap::SizeType mShaderMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
645 DepthFunction::Type mDepthFunction : 4; ///< Local copy of the depth function
646 FaceCullingMode::Type mFaceCullingMode : 3; ///< Local copy of the mode of face culling
647 BlendMode::Type mBlendMode : 3; ///< Local copy of the mode of blending
648 DepthWriteMode::Type mDepthWriteMode : 3; ///< Local copy of the depth write mode
649 DepthTestMode::Type mDepthTestMode : 3; ///< Local copy of the depth test mode
650 DevelRenderer::Rendering::Type mRenderingBehavior : 2; ///< The rendering behavior
651 Decay mUpdateDecay : 2; ///< Update decay (aging)
653 bool mRegenerateUniformMap : 1; ///< true if the map should be regenerated
654 bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
655 bool mDirtyFlag : 1; ///< Flag indicating whether the properties are changed
657 std::vector<Dali::DevelRenderer::DrawCommand> mDrawCommands;
658 Dali::RenderCallback* mRenderCallback{nullptr};
661 AnimatableProperty<float> mOpacity; ///< The opacity value
662 int32_t mDepthIndex; ///< Used only in PrepareRenderInstructions
666 inline void SetTexturesMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet)
668 using LocalType = MessageValue1<Renderer, TextureSet*>;
670 // Reserve some memory inside the message queue
671 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
673 // Construct message in the message queue memory; note that delete should not be called on the return value
674 new(slot) LocalType(&renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet));
677 inline void SetGeometryMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry)
679 using LocalType = MessageValue1<Renderer, Render::Geometry*>;
681 // Reserve some memory inside the message queue
682 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
684 // Construct message in the message queue memory; note that delete should not be called on the return value
685 new(slot) LocalType(&renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry));
688 inline void SetShaderMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader)
690 using LocalType = MessageValue1<Renderer, Shader*>;
692 // Reserve some memory inside the message queue
693 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
695 // Construct message in the message queue memory; note that delete should not be called on the return value
696 new(slot) LocalType(&renderer, &Renderer::SetShader, const_cast<Shader*>(&shader));
699 inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex)
701 using LocalType = MessageValue1<Renderer, int>;
703 // Reserve some memory inside the message queue
704 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
706 // Construct message in the message queue memory; note that delete should not be called on the return value
707 new(slot) LocalType(&renderer, &Renderer::SetDepthIndex, depthIndex);
710 inline void SetFaceCullingModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode)
712 using LocalType = MessageValue1<Renderer, FaceCullingMode::Type>;
714 // Reserve some memory inside the message queue
715 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
717 new(slot) LocalType(&renderer, &Renderer::SetFaceCullingMode, faceCullingMode);
720 inline void SetBlendModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode)
722 using LocalType = MessageValue1<Renderer, BlendMode::Type>;
724 // Reserve some memory inside the message queue
725 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
727 new(slot) LocalType(&renderer, &Renderer::SetBlendMode, blendingMode);
730 inline void SetBlendingOptionsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options)
732 using LocalType = MessageValue1<Renderer, uint32_t>;
734 // Reserve some memory inside the message queue
735 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
737 new(slot) LocalType(&renderer, &Renderer::SetBlendingOptions, options);
740 inline void SetBlendColorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor)
742 using LocalType = MessageValue1<Renderer, Vector4>;
744 // Reserve some memory inside the message queue
745 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
747 new(slot) LocalType(&renderer, &Renderer::SetBlendColor, blendColor);
750 inline void SetIndexedDrawFirstElementMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement)
752 using LocalType = MessageValue1<Renderer, uint32_t>;
754 // Reserve some memory inside the message queue
755 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
757 new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawFirstElement, firstElement);
760 inline void SetIndexedDrawElementsCountMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount)
762 using LocalType = MessageValue1<Renderer, uint32_t>;
764 // Reserve some memory inside the message queue
765 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
767 new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount);
770 inline void SetEnablePreMultipliedAlphaMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied)
772 using LocalType = MessageValue1<Renderer, bool>;
774 // Reserve some memory inside the message queue
775 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
777 new(slot) LocalType(&renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied);
780 inline void SetDepthWriteModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode)
782 using LocalType = MessageValue1<Renderer, DepthWriteMode::Type>;
784 // Reserve some memory inside the message queue
785 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
787 new(slot) LocalType(&renderer, &Renderer::SetDepthWriteMode, depthWriteMode);
790 inline void SetDepthTestModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode)
792 using LocalType = MessageValue1<Renderer, DepthTestMode::Type>;
794 // Reserve some memory inside the message queue
795 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
797 new(slot) LocalType(&renderer, &Renderer::SetDepthTestMode, depthTestMode);
800 inline void SetDepthFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction)
802 using LocalType = MessageValue1<Renderer, DepthFunction::Type>;
804 // Reserve some memory inside the message queue
805 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
807 new(slot) LocalType(&renderer, &Renderer::SetDepthFunction, depthFunction);
810 inline void SetRenderModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode)
812 using LocalType = MessageValue1<Renderer, RenderMode::Type>;
814 // Reserve some memory inside the message queue
815 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
817 new(slot) LocalType(&renderer, &Renderer::SetRenderMode, mode);
820 inline void SetStencilFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction)
822 using LocalType = MessageValue1<Renderer, StencilFunction::Type>;
824 // Reserve some memory inside the message queue
825 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
827 new(slot) LocalType(&renderer, &Renderer::SetStencilFunction, stencilFunction);
830 inline void SetStencilFunctionMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int mask)
832 using LocalType = MessageValue1<Renderer, int>;
834 // Reserve some memory inside the message queue
835 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
837 new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionMask, mask);
840 inline void SetStencilFunctionReferenceMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference)
842 using LocalType = MessageValue1<Renderer, int>;
844 // Reserve some memory inside the message queue
845 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
847 new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference);
850 inline void SetStencilMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask)
852 using LocalType = MessageValue1<Renderer, int>;
854 // Reserve some memory inside the message queue
855 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
857 new(slot) LocalType(&renderer, &Renderer::SetStencilMask, stencilMask);
860 inline void SetStencilOperationOnFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
862 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
864 // Reserve some memory inside the message queue
865 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
867 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnFail, stencilOperation);
870 inline void SetStencilOperationOnZFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
872 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
874 // Reserve some memory inside the message queue
875 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
877 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation);
880 inline void SetStencilOperationOnZPassMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
882 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
884 // Reserve some memory inside the message queue
885 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
887 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation);
890 inline void BakeOpacityMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity)
892 using LocalType = MessageDoubleBuffered1<Renderer, float>;
894 // Reserve some memory inside the message queue
895 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
897 new(slot) LocalType(&renderer, &Renderer::BakeOpacity, opacity);
900 inline void SetRenderingBehaviorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DevelRenderer::Rendering::Type renderingBehavior)
902 using LocalType = MessageValue1<Renderer, DevelRenderer::Rendering::Type>;
904 // Reserve some memory inside the message queue
905 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
907 new(slot) LocalType(&renderer, &Renderer::SetRenderingBehavior, renderingBehavior);
910 inline void SetDrawCommandsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size)
912 using LocalType = MessageValue2<Renderer, Dali::DevelRenderer::DrawCommand*, uint32_t>;
914 // Reserve some memory inside the message queue
915 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
917 new(slot) LocalType(&renderer, &Renderer::SetDrawCommands, pDrawCommands, size);
920 inline void SetRenderCallbackMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::RenderCallback* callback)
922 using LocalType = MessageValue1<Renderer, Dali::RenderCallback*>;
924 // Reserve some memory inside the message queue
925 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
927 new(slot) LocalType(&renderer, &Renderer::SetRenderCallback, callback);
930 } // namespace SceneGraph
931 } // namespace Internal
934 #endif // DALI_INTERNAL_SCENE_GRAPH_RENDERER_H