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 Renderer* New();
178 static RendererKey NewKey();
183 ~Renderer() override;
186 * Overriden delete operator
187 * Deletes the renderer from its global memory pool
189 void operator delete(void* ptr);
191 static Renderer* Get(RendererKey::KeyType);
194 * Get the key of the given renderer in the associated memory pool.
195 * @param[in] renderer the given renderer
196 * @return The key in the associated memory pool.
198 static RendererKey GetKey(const SceneGraph::Renderer& renderer);
201 * Get the key of the given renderer in the associated memory pool.
202 * @param[in] renderer the given renderer
203 * @return The key in the associated memory pool, or -1 if not
206 static RendererKey GetKey(SceneGraph::Renderer* renderer);
209 * Set the texture set for the renderer
210 * @param[in] textureSet The texture set this renderer will use
212 void SetTextures(TextureSet* textureSet);
215 * Get the associated texture set
216 * @return the texture set.
218 const SceneGraph::TextureSet* GetTextureSet() const
224 * @copydoc RenderDataProvider::GetTextures()
226 const Vector<Render::TextureKey>* GetTextures() const override;
229 * @copydoc RenderDataProvider::GetSamplers()
231 const Vector<Render::Sampler*>* GetSamplers() const override;
234 * Set the shader for the renderer
235 * @param[in] shader The shader this renderer will use
237 void SetShader(Shader* shader);
240 * @copydoc RenderDataProvider::GetShader()
242 const Shader& GetShader() const override
248 * Set the geometry for the renderer
249 * @param[in] geometry The geometry this renderer will use
251 void SetGeometry(Render::Geometry* geometry);
254 * Set the depth index
255 * @param[in] depthIndex the new depth index to use
257 void SetDepthIndex(int depthIndex);
260 * @brief Get the depth index
261 * @return The depth index
263 int GetDepthIndex() const
269 * Set the face culling mode
270 * @param[in] faceCullingMode to use
272 void SetFaceCullingMode(FaceCullingMode::Type faceCullingMode);
275 * Get face culling mode
276 * @return The face culling mode
278 FaceCullingMode::Type GetFaceCullingMode() const;
281 * Set the blending mode
282 * @param[in] blendingMode to use
284 void SetBlendMode(BlendMode::Type blendingMode);
287 * Get the blending mode
288 * @return The the blending mode
290 BlendMode::Type GetBlendMode() const;
293 * Set the blending options. This should only be called from the update thread.
294 * @param[in] options A bitmask of blending options.
296 void SetBlendingOptions(uint32_t options);
299 * Get the blending options
300 * @return The the blending mode
302 uint32_t GetBlendingOptions() const;
305 * Set the blend color for blending operation
306 * @param blendColor to pass to GL
308 void SetBlendColor(const Vector4& blendColor);
311 * Get the blending color
312 * @return The blend color
314 Vector4 GetBlendColor() const;
317 * Set the index of first element for indexed draw
318 * @param[in] firstElement index of first element to draw
320 void SetIndexedDrawFirstElement(uint32_t firstElement);
323 * Get the index of first element for indexed draw
324 * @return The index of first element for indexed draw
326 uint32_t GetIndexedDrawFirstElement() const;
329 * Set the number of elements to draw by indexed draw
330 * @param[in] elementsCount number of elements to draw
332 void SetIndexedDrawElementsCount(uint32_t elementsCount);
335 * Get the number of elements to draw by indexed draw
336 * @return The number of elements to draw by indexed draw
338 uint32_t GetIndexedDrawElementsCount() const;
341 * @brief Set whether the Pre-multiplied Alpha Blending is required
342 * @param[in] preMultipled whether alpha is pre-multiplied.
344 void EnablePreMultipliedAlpha(bool preMultipled);
347 * @brief Query whether alpha is pre-multiplied.
348 * @return True is alpha is pre-multiplied, false otherwise.
350 bool IsPreMultipliedAlphaEnabled() const;
353 * Sets the depth buffer write mode
354 * @param[in] depthWriteMode The depth buffer write mode
356 void SetDepthWriteMode(DepthWriteMode::Type depthWriteMode);
359 * Get the depth buffer write mode
360 * @return The depth buffer write mode
362 DepthWriteMode::Type GetDepthWriteMode() const;
365 * Sets the depth buffer test mode
366 * @param[in] depthTestMode The depth buffer test mode
368 void SetDepthTestMode(DepthTestMode::Type depthTestMode);
371 * Get the depth buffer test mode
372 * @return The depth buffer test mode
374 DepthTestMode::Type GetDepthTestMode() const;
377 * Sets the depth function
378 * @param[in] depthFunction The depth function
380 void SetDepthFunction(DepthFunction::Type depthFunction);
383 * Get the depth function
384 * @return The depth function
386 DepthFunction::Type GetDepthFunction() const;
389 * Sets the render mode
390 * @param[in] mode The render mode
392 void SetRenderMode(RenderMode::Type mode);
395 * Sets the stencil function
396 * @param[in] stencilFunction The stencil function
398 void SetStencilFunction(StencilFunction::Type stencilFunction);
401 * Sets the stencil function mask
402 * @param[in] stencilFunctionMask The stencil function mask
404 void SetStencilFunctionMask(int stencilFunctionMask);
407 * Sets the stencil function reference
408 * @param[in] stencilFunctionReference The stencil function reference
410 void SetStencilFunctionReference(int stencilFunctionReference);
413 * Sets the stencil mask
414 * @param[in] stencilMask The stencil mask
416 void SetStencilMask(int stencilMask);
419 * Sets the stencil operation for when the stencil test fails
420 * @param[in] stencilOperationOnFail The stencil operation
422 void SetStencilOperationOnFail(StencilOperation::Type stencilOperationOnFail);
425 * Sets the stencil operation for when the depth test fails
426 * @param[in] stencilOperationOnZFail The stencil operation
428 void SetStencilOperationOnZFail(StencilOperation::Type stencilOperationOnZFail);
431 * Sets the stencil operation for when the depth test passes
432 * @param[in] stencilOperationOnZPass The stencil operation
434 void SetStencilOperationOnZPass(StencilOperation::Type stencilOperationOnZPass);
437 * Gets the stencil parameters
438 * @return The stencil parameters
440 const Render::Renderer::StencilParameters& GetStencilParameters() const;
444 * @param[in] updateBufferIndex The current update buffer index.
445 * @param[in] opacity The opacity
447 void BakeOpacity(BufferIndex updateBufferIndex, float opacity);
450 * @copydoc RenderDataProvider::GetOpacity()
452 float GetOpacity(BufferIndex updateBufferIndex) const override;
455 * Sets the rendering behavior
456 * @param[in] renderingBehavior The rendering behavior required.
458 void SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior);
461 * Gets the rendering behavior
462 * @return The rendering behavior
464 DevelRenderer::Rendering::Type GetRenderingBehavior() const;
467 * Prepare the object for rendering.
468 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
469 * @param[in] updateBufferIndex The current update buffer index.
470 * @return Whether this renderer has been updated in the current frame
472 bool PrepareRender(BufferIndex updateBufferIndex);
475 * Retrieve the Render thread renderer
476 * @return The associated render thread renderer
478 Render::Renderer& GetRenderer();
481 * Query whether the renderer is fully opaque, fully transparent or transparent.
482 * @param[in] updateBufferIndex The current update buffer index.
483 * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
485 OpacityType GetOpacityType(BufferIndex updateBufferIndex, const Node& node) const;
488 * Connect the object to the scene graph
490 * @param[in] sceneController The scene controller - used for sending messages to render thread
491 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
493 void ConnectToSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
496 * Disconnect the object from the scene graph
497 * @param[in] sceneController The scene controller - used for sending messages to render thread
498 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
500 void DisconnectFromSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
503 * @copydoc RenderDataProvider::GetUniformMapDataProvider()
505 const UniformMapDataProvider& GetUniformMapDataProvider() const override
511 * @copydoc RenderDataProvider::IsUpdated()
513 bool IsUpdated() const override
519 * @copydoc RenderDataProvider::GetVisualTransformedUpdateArea()
521 Vector4 GetVisualTransformedUpdateArea(BufferIndex updateBufferIndex, const Vector4& originalUpdateArea) noexcept override;
524 * Sets RenderCallback object
526 * @param[in] callback Valid pointer to RenderCallback object
528 void SetRenderCallback(RenderCallback* callback);
531 * Returns currently set RenderCallback pointer
533 * @return RenderCallback pointer or nullptr
535 RenderCallback* GetRenderCallback()
537 return mRenderCallback;
541 * Merge shader uniform map into renderer uniform map if any of the
542 * maps have changed. Only update uniform map if added to render
544 * @param[in] updateBufferIndex The current update buffer index.
546 void UpdateUniformMap(BufferIndex updateBufferIndex);
549 * Set the given external draw commands on this renderer.
551 void SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size);
554 * Query whether a renderer is dirty.
555 * @return true if the renderer is dirty.
556 * @note It is used to decide whether to reuse the RenderList. We can't reuse the RenderList if this is dirty.
558 bool IsDirty() const;
561 * Reset both dirty flag and updated flag.
562 * @note This is called after rendering has completed.
564 void ResetDirtyFlag();
567 * Get the capacity of the memory pools
568 * @return the capacity of the memory pools
570 static uint32_t GetMemoryPoolCapacity();
572 public: // PropertyOwner::MappingChanged
574 * @copydoc PropertyOwner::OnMappingChanged
576 void OnMappingChanged() override;
578 public: // PropertyOwner implementation
580 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
582 virtual void ResetDefaultProperties(BufferIndex updateBufferIndex){};
584 public: // From UniformMapDataProvider
586 * @copydoc UniformMapDataProvider::GetCollectedUniformMap
588 const CollectedUniformMap& GetCollectedUniformMap() const override;
590 public: // For VisualProperties
592 * To be used only for 1st stage initialization in event thread.
594 void SetVisualProperties(VisualRenderer::AnimatableVisualProperties* visualProperties)
596 mVisualProperties = visualProperties;
600 * May be accessed from event thread
602 const VisualRenderer::AnimatableVisualProperties* GetVisualProperties() const
604 return mVisualProperties.Get();
609 * Protected constructor; See also Renderer::New()
622 CollectedUniformMap mCollectedUniformMap; ///< Uniform maps collected by the renderer
624 SceneController* mSceneController; ///< Used for initializing renderers
625 Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager)
626 TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned)
627 Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned)
628 Shader* mShader; ///< The shader this renderer uses. (Not owned)
630 OwnerPointer<VisualRenderer::AnimatableVisualProperties> mVisualProperties{nullptr}; ///< VisualProperties (optional/owned)
631 OwnerPointer<Vector4> mBlendColor; ///< The blend color for blending operation
633 Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
635 uint64_t mUniformsHash{0}; ///< Hash of uniform map property values
636 uint32_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw
637 uint32_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw
638 uint32_t mBlendBitmask; ///< The bitmask of blending options
639 uint32_t mResendFlag; ///< Indicate whether data should be resent to the renderer
640 UniformMap::SizeType mUniformMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
641 UniformMap::SizeType mShaderMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
643 DepthFunction::Type mDepthFunction : 4; ///< Local copy of the depth function
644 FaceCullingMode::Type mFaceCullingMode : 3; ///< Local copy of the mode of face culling
645 BlendMode::Type mBlendMode : 3; ///< Local copy of the mode of blending
646 DepthWriteMode::Type mDepthWriteMode : 3; ///< Local copy of the depth write mode
647 DepthTestMode::Type mDepthTestMode : 3; ///< Local copy of the depth test mode
648 DevelRenderer::Rendering::Type mRenderingBehavior : 2; ///< The rendering behavior
649 Decay mUpdateDecay : 2; ///< Update decay (aging)
651 bool mRegenerateUniformMap : 1; ///< true if the map should be regenerated
652 bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
653 bool mDirtyFlag : 1; ///< Flag indicating whether the properties are changed
655 std::vector<Dali::DevelRenderer::DrawCommand> mDrawCommands;
656 Dali::RenderCallback* mRenderCallback{nullptr};
659 AnimatableProperty<float> mOpacity; ///< The opacity value
660 int32_t mDepthIndex; ///< Used only in PrepareRenderInstructions
664 inline void SetTexturesMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet)
666 using LocalType = MessageValue1<Renderer, TextureSet*>;
668 // Reserve some memory inside the message queue
669 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
671 // Construct message in the message queue memory; note that delete should not be called on the return value
672 new(slot) LocalType(&renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet));
675 inline void SetGeometryMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry)
677 using LocalType = MessageValue1<Renderer, Render::Geometry*>;
679 // Reserve some memory inside the message queue
680 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
682 // Construct message in the message queue memory; note that delete should not be called on the return value
683 new(slot) LocalType(&renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry));
686 inline void SetShaderMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader)
688 using LocalType = MessageValue1<Renderer, Shader*>;
690 // Reserve some memory inside the message queue
691 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
693 // Construct message in the message queue memory; note that delete should not be called on the return value
694 new(slot) LocalType(&renderer, &Renderer::SetShader, const_cast<Shader*>(&shader));
697 inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex)
699 using LocalType = MessageValue1<Renderer, int>;
701 // Reserve some memory inside the message queue
702 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
704 // Construct message in the message queue memory; note that delete should not be called on the return value
705 new(slot) LocalType(&renderer, &Renderer::SetDepthIndex, depthIndex);
708 inline void SetFaceCullingModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode)
710 using LocalType = MessageValue1<Renderer, FaceCullingMode::Type>;
712 // Reserve some memory inside the message queue
713 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
715 new(slot) LocalType(&renderer, &Renderer::SetFaceCullingMode, faceCullingMode);
718 inline void SetBlendModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode)
720 using LocalType = MessageValue1<Renderer, BlendMode::Type>;
722 // Reserve some memory inside the message queue
723 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
725 new(slot) LocalType(&renderer, &Renderer::SetBlendMode, blendingMode);
728 inline void SetBlendingOptionsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options)
730 using LocalType = MessageValue1<Renderer, uint32_t>;
732 // Reserve some memory inside the message queue
733 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
735 new(slot) LocalType(&renderer, &Renderer::SetBlendingOptions, options);
738 inline void SetBlendColorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor)
740 using LocalType = MessageValue1<Renderer, Vector4>;
742 // Reserve some memory inside the message queue
743 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
745 new(slot) LocalType(&renderer, &Renderer::SetBlendColor, blendColor);
748 inline void SetIndexedDrawFirstElementMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement)
750 using LocalType = MessageValue1<Renderer, uint32_t>;
752 // Reserve some memory inside the message queue
753 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
755 new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawFirstElement, firstElement);
758 inline void SetIndexedDrawElementsCountMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount)
760 using LocalType = MessageValue1<Renderer, uint32_t>;
762 // Reserve some memory inside the message queue
763 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
765 new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount);
768 inline void SetEnablePreMultipliedAlphaMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied)
770 using LocalType = MessageValue1<Renderer, bool>;
772 // Reserve some memory inside the message queue
773 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
775 new(slot) LocalType(&renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied);
778 inline void SetDepthWriteModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode)
780 using LocalType = MessageValue1<Renderer, DepthWriteMode::Type>;
782 // Reserve some memory inside the message queue
783 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
785 new(slot) LocalType(&renderer, &Renderer::SetDepthWriteMode, depthWriteMode);
788 inline void SetDepthTestModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode)
790 using LocalType = MessageValue1<Renderer, DepthTestMode::Type>;
792 // Reserve some memory inside the message queue
793 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
795 new(slot) LocalType(&renderer, &Renderer::SetDepthTestMode, depthTestMode);
798 inline void SetDepthFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction)
800 using LocalType = MessageValue1<Renderer, DepthFunction::Type>;
802 // Reserve some memory inside the message queue
803 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
805 new(slot) LocalType(&renderer, &Renderer::SetDepthFunction, depthFunction);
808 inline void SetRenderModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode)
810 using LocalType = MessageValue1<Renderer, RenderMode::Type>;
812 // Reserve some memory inside the message queue
813 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
815 new(slot) LocalType(&renderer, &Renderer::SetRenderMode, mode);
818 inline void SetStencilFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction)
820 using LocalType = MessageValue1<Renderer, StencilFunction::Type>;
822 // Reserve some memory inside the message queue
823 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
825 new(slot) LocalType(&renderer, &Renderer::SetStencilFunction, stencilFunction);
828 inline void SetStencilFunctionMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int mask)
830 using LocalType = MessageValue1<Renderer, int>;
832 // Reserve some memory inside the message queue
833 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
835 new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionMask, mask);
838 inline void SetStencilFunctionReferenceMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference)
840 using LocalType = MessageValue1<Renderer, int>;
842 // Reserve some memory inside the message queue
843 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
845 new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference);
848 inline void SetStencilMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask)
850 using LocalType = MessageValue1<Renderer, int>;
852 // Reserve some memory inside the message queue
853 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
855 new(slot) LocalType(&renderer, &Renderer::SetStencilMask, stencilMask);
858 inline void SetStencilOperationOnFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
860 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
862 // Reserve some memory inside the message queue
863 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
865 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnFail, stencilOperation);
868 inline void SetStencilOperationOnZFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
870 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
872 // Reserve some memory inside the message queue
873 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
875 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation);
878 inline void SetStencilOperationOnZPassMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
880 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
882 // Reserve some memory inside the message queue
883 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
885 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation);
888 inline void BakeOpacityMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity)
890 using LocalType = MessageDoubleBuffered1<Renderer, float>;
892 // Reserve some memory inside the message queue
893 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
895 new(slot) LocalType(&renderer, &Renderer::BakeOpacity, opacity);
898 inline void SetRenderingBehaviorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DevelRenderer::Rendering::Type renderingBehavior)
900 using LocalType = MessageValue1<Renderer, DevelRenderer::Rendering::Type>;
902 // Reserve some memory inside the message queue
903 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
905 new(slot) LocalType(&renderer, &Renderer::SetRenderingBehavior, renderingBehavior);
908 inline void SetDrawCommandsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size)
910 using LocalType = MessageValue2<Renderer, Dali::DevelRenderer::DrawCommand*, uint32_t>;
912 // Reserve some memory inside the message queue
913 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
915 new(slot) LocalType(&renderer, &Renderer::SetDrawCommands, pDrawCommands, size);
918 inline void SetRenderCallbackMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::RenderCallback* callback)
920 using LocalType = MessageValue1<Renderer, Dali::RenderCallback*>;
922 // Reserve some memory inside the message queue
923 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
925 new(slot) LocalType(&renderer, &Renderer::SetRenderCallback, callback);
928 } // namespace SceneGraph
929 } // namespace Internal
932 #endif // DALI_INTERNAL_SCENE_GRAPH_RENDERER_H