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/type-abstraction-enums.h>
23 #include <dali/internal/event/common/event-thread-services.h>
24 #include <dali/internal/render/data-providers/render-data-provider.h>
25 #include <dali/internal/render/renderers/render-renderer.h>
26 #include <dali/internal/update/common/animatable-property.h>
27 #include <dali/internal/update/common/property-owner.h>
28 #include <dali/internal/update/common/uniform-map.h>
29 #include <dali/public-api/rendering/geometry.h>
30 #include <dali/public-api/rendering/renderer.h> // Dali::Renderer
44 class SceneController;
47 using RendererIndex = uint32_t;
48 using RendererContainer = Dali::Vector<RendererIndex>;
49 using RendererIter = RendererContainer::Iterator;
50 using RendererConstIter = RendererContainer::ConstIterator;
55 namespace VisualRenderer
57 struct AnimatableVisualProperties
59 AnimatableVisualProperties()
60 : mTransformOffset(Vector2::ZERO),
61 mTransformSize(Vector2::ONE),
62 mTransformOrigin(Vector2::ZERO),
63 mTransformAnchorPoint(Vector2::ZERO),
64 mTransformOffsetSizeMode(Vector4::ZERO),
65 mExtraSize(Vector2::ZERO),
66 mMixColor(Vector3::ONE),
67 mPreMultipliedAlpha(0.0f),
68 mExtendedPropertiesDeleteFunction(nullptr)
72 ~AnimatableVisualProperties()
74 if(mExtendedProperties && mExtendedPropertiesDeleteFunction)
76 mExtendedPropertiesDeleteFunction(mExtendedProperties);
81 * @brief Cached coefficient value when we calculate visual transformed update size.
82 * It can reduce complexity of calculate the vertex position.
84 * Vector2 vertexPosition = (XA * aPosition + XB) * originalSize + (CA * aPosition + CB) + Vector2(D, D) * aPosition
86 struct VisualTransformedUpdateSizeCoefficientCache
88 Vector2 coefXA{Vector2::ZERO};
89 Vector2 coefXB{Vector2::ZERO};
90 Vector2 coefCA{Vector2::ZERO};
91 Vector2 coefCB{Vector2::ZERO};
95 uint64_t decoratedHash{0u};
97 VisualTransformedUpdateSizeCoefficientCache mCoefficient; ///< Coefficient value to calculate visual transformed update size by VisualProperties more faster.
99 AnimatableProperty<Vector2> mTransformOffset;
100 AnimatableProperty<Vector2> mTransformSize;
101 AnimatableProperty<Vector2> mTransformOrigin;
102 AnimatableProperty<Vector2> mTransformAnchorPoint;
103 AnimatableProperty<Vector4> mTransformOffsetSizeMode;
104 AnimatableProperty<Vector2> mExtraSize;
105 AnimatableProperty<Vector3> mMixColor;
106 AnimatableProperty<float> mPreMultipliedAlpha;
108 void* mExtendedProperties{nullptr}; // Enable derived class to extend properties further
109 void (*mExtendedPropertiesDeleteFunction)(void*){nullptr}; // Derived class's custom delete functor
112 struct AnimatableDecoratedVisualProperties
114 AnimatableDecoratedVisualProperties()
115 : mCornerRadius(Vector4::ZERO),
116 mCornerRadiusPolicy(1.0f),
117 mBorderlineWidth(0.0f),
118 mBorderlineColor(Color::BLACK),
119 mBorderlineOffset(0.0f),
123 ~AnimatableDecoratedVisualProperties()
127 // Delete function of AnimatableDecoratedVisualProperties* converted as void*
128 static void DeleteFunction(void* data)
130 delete static_cast<AnimatableDecoratedVisualProperties*>(data);
133 AnimatableProperty<Vector4> mCornerRadius;
134 AnimatableProperty<float> mCornerRadiusPolicy;
135 AnimatableProperty<float> mBorderlineWidth;
136 AnimatableProperty<Vector4> mBorderlineColor;
137 AnimatableProperty<float> mBorderlineOffset;
138 AnimatableProperty<float> mBlurRadius;
140 } // namespace VisualRenderer
142 class Renderer : public PropertyOwner,
143 public UniformMapDataProvider,
144 public RenderDataProvider
155 * Construct a new Renderer
157 static Renderer* New();
159 static RendererIndex NewKey();
164 ~Renderer() override;
167 * Overriden delete operator
168 * Deletes the renderer from its global memory pool
170 void operator delete(void* ptr);
173 * Get pointer to a renderer at the given index.
174 * @param[in] rendererIndex Index of renderer to retrieve object
175 * @return The object's address, or nullptr if not found
177 static Renderer* Get(RendererIndex rendererIndex);
179 static RendererIndex GetIndex(const Renderer& renderer);
180 static RendererIndex GetIndex(Renderer* renderer);
183 * Set the texture set for the renderer
184 * @param[in] textureSet The texture set this renderer will use
186 void SetTextures(TextureSet* textureSet);
188 const SceneGraph::TextureSet* GetTextureSet() const
194 * @copydoc RenderDataProvider::GetTextures()
196 const Vector<Render::Texture*>* GetTextures() const override;
199 * @copydoc RenderDataProvider::GetSamplers()
201 const Vector<Render::Sampler*>* GetSamplers() const override;
204 * Set the shader for the renderer
205 * @param[in] shader The shader this renderer will use
207 void SetShader(Shader* shader);
210 * @copydoc RenderDataProvider::GetShader()
212 const Shader& GetShader() const override
218 * Set the geometry for the renderer
219 * @param[in] geometry The geometry this renderer will use
221 void SetGeometry(Render::Geometry* geometry);
224 * Set the depth index
225 * @param[in] depthIndex the new depth index to use
227 void SetDepthIndex(int depthIndex);
230 * @brief Get the depth index
231 * @return The depth index
233 int GetDepthIndex() const
239 * Set the face culling mode
240 * @param[in] faceCullingMode to use
242 void SetFaceCullingMode(FaceCullingMode::Type faceCullingMode);
245 * Get face culling mode
246 * @return The face culling mode
248 FaceCullingMode::Type GetFaceCullingMode() const;
251 * Set the blending mode
252 * @param[in] blendingMode to use
254 void SetBlendMode(BlendMode::Type blendingMode);
257 * Get the blending mode
258 * @return The the blending mode
260 BlendMode::Type GetBlendMode() const;
263 * Set the blending options. This should only be called from the update thread.
264 * @param[in] options A bitmask of blending options.
266 void SetBlendingOptions(uint32_t options);
269 * Get the blending options
270 * @return The the blending mode
272 uint32_t GetBlendingOptions() const;
275 * Set the blend color for blending operation
276 * @param blendColor to pass to GL
278 void SetBlendColor(const Vector4& blendColor);
281 * Get the blending color
282 * @return The blend color
284 Vector4 GetBlendColor() const;
287 * Set the index of first element for indexed draw
288 * @param[in] firstElement index of first element to draw
290 void SetIndexedDrawFirstElement(uint32_t firstElement);
293 * Get the index of first element for indexed draw
294 * @return The index of first element for indexed draw
296 uint32_t GetIndexedDrawFirstElement() const;
299 * Set the number of elements to draw by indexed draw
300 * @param[in] elementsCount number of elements to draw
302 void SetIndexedDrawElementsCount(uint32_t elementsCount);
305 * Get the number of elements to draw by indexed draw
306 * @return The number of elements to draw by indexed draw
308 uint32_t GetIndexedDrawElementsCount() const;
311 * @brief Set whether the Pre-multiplied Alpha Blending is required
312 * @param[in] preMultipled whether alpha is pre-multiplied.
314 void EnablePreMultipliedAlpha(bool preMultipled);
317 * @brief Query whether alpha is pre-multiplied.
318 * @return True is alpha is pre-multiplied, false otherwise.
320 bool IsPreMultipliedAlphaEnabled() const;
323 * Sets the depth buffer write mode
324 * @param[in] depthWriteMode The depth buffer write mode
326 void SetDepthWriteMode(DepthWriteMode::Type depthWriteMode);
329 * Get the depth buffer write mode
330 * @return The depth buffer write mode
332 DepthWriteMode::Type GetDepthWriteMode() const;
335 * Sets the depth buffer test mode
336 * @param[in] depthTestMode The depth buffer test mode
338 void SetDepthTestMode(DepthTestMode::Type depthTestMode);
341 * Get the depth buffer test mode
342 * @return The depth buffer test mode
344 DepthTestMode::Type GetDepthTestMode() const;
347 * Sets the depth function
348 * @param[in] depthFunction The depth function
350 void SetDepthFunction(DepthFunction::Type depthFunction);
353 * Get the depth function
354 * @return The depth function
356 DepthFunction::Type GetDepthFunction() const;
359 * Sets the render mode
360 * @param[in] mode The render mode
362 void SetRenderMode(RenderMode::Type mode);
365 * Sets the stencil function
366 * @param[in] stencilFunction The stencil function
368 void SetStencilFunction(StencilFunction::Type stencilFunction);
371 * Sets the stencil function mask
372 * @param[in] stencilFunctionMask The stencil function mask
374 void SetStencilFunctionMask(int stencilFunctionMask);
377 * Sets the stencil function reference
378 * @param[in] stencilFunctionReference The stencil function reference
380 void SetStencilFunctionReference(int stencilFunctionReference);
383 * Sets the stencil mask
384 * @param[in] stencilMask The stencil mask
386 void SetStencilMask(int stencilMask);
389 * Sets the stencil operation for when the stencil test fails
390 * @param[in] stencilOperationOnFail The stencil operation
392 void SetStencilOperationOnFail(StencilOperation::Type stencilOperationOnFail);
395 * Sets the stencil operation for when the depth test fails
396 * @param[in] stencilOperationOnZFail The stencil operation
398 void SetStencilOperationOnZFail(StencilOperation::Type stencilOperationOnZFail);
401 * Sets the stencil operation for when the depth test passes
402 * @param[in] stencilOperationOnZPass The stencil operation
404 void SetStencilOperationOnZPass(StencilOperation::Type stencilOperationOnZPass);
407 * Gets the stencil parameters
408 * @return The stencil parameters
410 const Render::Renderer::StencilParameters& GetStencilParameters() const;
414 * @param[in] updateBufferIndex The current update buffer index.
415 * @param[in] opacity The opacity
417 void BakeOpacity(BufferIndex updateBufferIndex, float opacity);
420 * @copydoc RenderDataProvider::GetOpacity()
422 float GetOpacity(BufferIndex updateBufferIndex) const override;
425 * Sets the rendering behavior
426 * @param[in] renderingBehavior The rendering behavior required.
428 void SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior);
431 * Gets the rendering behavior
432 * @return The rendering behavior
434 DevelRenderer::Rendering::Type GetRenderingBehavior() const;
437 * Prepare the object for rendering.
438 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
439 * @param[in] updateBufferIndex The current update buffer index.
440 * @return Whether this renderer has been updated in the current frame
442 bool PrepareRender(BufferIndex updateBufferIndex);
445 * Retrieve the Render thread renderer
446 * @return The associated render thread renderer
448 Render::Renderer& GetRenderer();
451 * Query whether the renderer is fully opaque, fully transparent or transparent.
452 * @param[in] updateBufferIndex The current update buffer index.
453 * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
455 OpacityType GetOpacityType(BufferIndex updateBufferIndex, const Node& node) const;
458 * Connect the object to the scene graph
460 * @param[in] sceneController The scene controller - used for sending messages to render thread
461 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
463 void ConnectToSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
466 * Disconnect the object from the scene graph
467 * @param[in] sceneController The scene controller - used for sending messages to render thread
468 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
470 void DisconnectFromSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
473 * @copydoc RenderDataProvider::GetUniformMapDataProvider()
475 const UniformMapDataProvider& GetUniformMapDataProvider() const override
481 * @copydoc RenderDataProvider::IsUpdated()
483 bool IsUpdated() const override
489 * @copydoc RenderDataProvider::GetVisualTransformedUpdateArea()
491 Vector4 GetVisualTransformedUpdateArea(BufferIndex updateBufferIndex, const Vector4& originalUpdateArea) noexcept override;
494 * Sets RenderCallback object
496 * @param[in] callback Valid pointer to RenderCallback object
498 void SetRenderCallback(RenderCallback* callback);
501 * Returns currently set RenderCallback pointer
503 * @return RenderCallback pointer or nullptr
505 RenderCallback* GetRenderCallback()
507 return mRenderCallback;
511 * Merge shader uniform map into renderer uniform map if any of the
512 * maps have changed. Only update uniform map if added to render
514 * @param[in] updateBufferIndex The current update buffer index.
516 void UpdateUniformMap(BufferIndex updateBufferIndex);
519 * Set the given external draw commands on this renderer.
521 void SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size);
524 * Query whether a renderer is dirty.
525 * @return true if the renderer is dirty.
526 * @note It is used to decide whether to reuse the RenderList. We can't reuse the RenderList if this is dirty.
528 bool IsDirty() const;
531 * Reset both dirty flag and updated flag.
532 * @note This is called after rendering has completed.
534 void ResetDirtyFlag();
537 * Get the capacity of the memory pools
538 * @return the capacity of the memory pools
540 static uint32_t GetMemoryPoolCapacity();
542 public: // PropertyOwner::MappingChanged
544 * @copydoc PropertyOwner::OnMappingChanged
546 void OnMappingChanged() override;
548 public: // PropertyOwner implementation
550 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
552 virtual void ResetDefaultProperties(BufferIndex updateBufferIndex){};
554 public: // From UniformMapDataProvider
556 * @copydoc UniformMapDataProvider::GetCollectedUniformMap
558 const CollectedUniformMap& GetCollectedUniformMap() const override;
560 public: // For VisualProperties
562 * To be used only for 1st stage initialization in event thread.
564 void SetVisualProperties(VisualRenderer::AnimatableVisualProperties* visualProperties)
566 mVisualProperties = visualProperties;
570 * May be accessed from event thread
572 const VisualRenderer::AnimatableVisualProperties* GetVisualProperties() const
574 return mVisualProperties.Get();
579 * Protected constructor; See also Renderer::New()
592 CollectedUniformMap mCollectedUniformMap; ///< Uniform maps collected by the renderer
594 SceneController* mSceneController; ///< Used for initializing renderers
595 Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager)
596 TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned)
597 Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned)
598 Shader* mShader; ///< The shader this renderer uses. (Not owned)
600 OwnerPointer<VisualRenderer::AnimatableVisualProperties> mVisualProperties{nullptr}; ///< VisualProperties (optional/owned)
601 OwnerPointer<Vector4> mBlendColor; ///< The blend color for blending operation
603 Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
605 uint64_t mUniformsHash{0}; ///< Hash of uniform map property values
606 uint32_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw
607 uint32_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw
608 uint32_t mBlendBitmask; ///< The bitmask of blending options
609 uint32_t mResendFlag; ///< Indicate whether data should be resent to the renderer
610 UniformMap::SizeType mUniformMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
611 UniformMap::SizeType mShaderMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
613 DepthFunction::Type mDepthFunction : 4; ///< Local copy of the depth function
614 FaceCullingMode::Type mFaceCullingMode : 3; ///< Local copy of the mode of face culling
615 BlendMode::Type mBlendMode : 3; ///< Local copy of the mode of blending
616 DepthWriteMode::Type mDepthWriteMode : 3; ///< Local copy of the depth write mode
617 DepthTestMode::Type mDepthTestMode : 3; ///< Local copy of the depth test mode
618 DevelRenderer::Rendering::Type mRenderingBehavior : 2; ///< The rendering behavior
619 Decay mUpdateDecay : 2; ///< Update decay (aging)
621 bool mRegenerateUniformMap : 1; ///< true if the map should be regenerated
622 bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
623 bool mDirtyFlag : 1; ///< Flag indicating whether the properties are changed
625 std::vector<Dali::DevelRenderer::DrawCommand> mDrawCommands;
626 Dali::RenderCallback* mRenderCallback{nullptr};
629 AnimatableProperty<float> mOpacity; ///< The opacity value
630 int32_t mDepthIndex; ///< Used only in PrepareRenderInstructions
634 inline void SetTexturesMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet)
636 using LocalType = MessageValue1<Renderer, TextureSet*>;
638 // Reserve some memory inside the message queue
639 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
641 // Construct message in the message queue memory; note that delete should not be called on the return value
642 new(slot) LocalType(&renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet));
645 inline void SetGeometryMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry)
647 using LocalType = MessageValue1<Renderer, Render::Geometry*>;
649 // Reserve some memory inside the message queue
650 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
652 // Construct message in the message queue memory; note that delete should not be called on the return value
653 new(slot) LocalType(&renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry));
656 inline void SetShaderMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader)
658 using LocalType = MessageValue1<Renderer, Shader*>;
660 // Reserve some memory inside the message queue
661 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
663 // Construct message in the message queue memory; note that delete should not be called on the return value
664 new(slot) LocalType(&renderer, &Renderer::SetShader, const_cast<Shader*>(&shader));
667 inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex)
669 using LocalType = MessageValue1<Renderer, int>;
671 // Reserve some memory inside the message queue
672 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
674 // Construct message in the message queue memory; note that delete should not be called on the return value
675 new(slot) LocalType(&renderer, &Renderer::SetDepthIndex, depthIndex);
678 inline void SetFaceCullingModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode)
680 using LocalType = MessageValue1<Renderer, FaceCullingMode::Type>;
682 // Reserve some memory inside the message queue
683 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
685 new(slot) LocalType(&renderer, &Renderer::SetFaceCullingMode, faceCullingMode);
688 inline void SetBlendModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode)
690 using LocalType = MessageValue1<Renderer, BlendMode::Type>;
692 // Reserve some memory inside the message queue
693 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
695 new(slot) LocalType(&renderer, &Renderer::SetBlendMode, blendingMode);
698 inline void SetBlendingOptionsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options)
700 using LocalType = MessageValue1<Renderer, uint32_t>;
702 // Reserve some memory inside the message queue
703 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
705 new(slot) LocalType(&renderer, &Renderer::SetBlendingOptions, options);
708 inline void SetBlendColorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor)
710 using LocalType = MessageValue1<Renderer, Vector4>;
712 // Reserve some memory inside the message queue
713 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
715 new(slot) LocalType(&renderer, &Renderer::SetBlendColor, blendColor);
718 inline void SetIndexedDrawFirstElementMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement)
720 using LocalType = MessageValue1<Renderer, uint32_t>;
722 // Reserve some memory inside the message queue
723 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
725 new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawFirstElement, firstElement);
728 inline void SetIndexedDrawElementsCountMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount)
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::SetIndexedDrawElementsCount, elementsCount);
738 inline void SetEnablePreMultipliedAlphaMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied)
740 using LocalType = MessageValue1<Renderer, bool>;
742 // Reserve some memory inside the message queue
743 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
745 new(slot) LocalType(&renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied);
748 inline void SetDepthWriteModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode)
750 using LocalType = MessageValue1<Renderer, DepthWriteMode::Type>;
752 // Reserve some memory inside the message queue
753 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
755 new(slot) LocalType(&renderer, &Renderer::SetDepthWriteMode, depthWriteMode);
758 inline void SetDepthTestModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode)
760 using LocalType = MessageValue1<Renderer, DepthTestMode::Type>;
762 // Reserve some memory inside the message queue
763 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
765 new(slot) LocalType(&renderer, &Renderer::SetDepthTestMode, depthTestMode);
768 inline void SetDepthFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction)
770 using LocalType = MessageValue1<Renderer, DepthFunction::Type>;
772 // Reserve some memory inside the message queue
773 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
775 new(slot) LocalType(&renderer, &Renderer::SetDepthFunction, depthFunction);
778 inline void SetRenderModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode)
780 using LocalType = MessageValue1<Renderer, RenderMode::Type>;
782 // Reserve some memory inside the message queue
783 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
785 new(slot) LocalType(&renderer, &Renderer::SetRenderMode, mode);
788 inline void SetStencilFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction)
790 using LocalType = MessageValue1<Renderer, StencilFunction::Type>;
792 // Reserve some memory inside the message queue
793 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
795 new(slot) LocalType(&renderer, &Renderer::SetStencilFunction, stencilFunction);
798 inline void SetStencilFunctionMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int mask)
800 using LocalType = MessageValue1<Renderer, int>;
802 // Reserve some memory inside the message queue
803 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
805 new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionMask, mask);
808 inline void SetStencilFunctionReferenceMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference)
810 using LocalType = MessageValue1<Renderer, int>;
812 // Reserve some memory inside the message queue
813 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
815 new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference);
818 inline void SetStencilMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask)
820 using LocalType = MessageValue1<Renderer, int>;
822 // Reserve some memory inside the message queue
823 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
825 new(slot) LocalType(&renderer, &Renderer::SetStencilMask, stencilMask);
828 inline void SetStencilOperationOnFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
830 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
832 // Reserve some memory inside the message queue
833 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
835 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnFail, stencilOperation);
838 inline void SetStencilOperationOnZFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
840 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
842 // Reserve some memory inside the message queue
843 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
845 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation);
848 inline void SetStencilOperationOnZPassMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
850 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
852 // Reserve some memory inside the message queue
853 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
855 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation);
858 inline void BakeOpacityMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity)
860 using LocalType = MessageDoubleBuffered1<Renderer, float>;
862 // Reserve some memory inside the message queue
863 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
865 new(slot) LocalType(&renderer, &Renderer::BakeOpacity, opacity);
868 inline void SetRenderingBehaviorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DevelRenderer::Rendering::Type renderingBehavior)
870 using LocalType = MessageValue1<Renderer, DevelRenderer::Rendering::Type>;
872 // Reserve some memory inside the message queue
873 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
875 new(slot) LocalType(&renderer, &Renderer::SetRenderingBehavior, renderingBehavior);
878 inline void SetDrawCommandsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size)
880 using LocalType = MessageValue2<Renderer, Dali::DevelRenderer::DrawCommand*, uint32_t>;
882 // Reserve some memory inside the message queue
883 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
885 new(slot) LocalType(&renderer, &Renderer::SetDrawCommands, pDrawCommands, size);
888 inline void SetRenderCallbackMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::RenderCallback* callback)
890 using LocalType = MessageValue1<Renderer, Dali::RenderCallback*>;
892 // Reserve some memory inside the message queue
893 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
895 new(slot) LocalType(&renderer, &Renderer::SetRenderCallback, callback);
898 } // namespace SceneGraph
899 } // namespace Internal
902 #endif // DALI_INTERNAL_SCENE_GRAPH_RENDERER_H