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 RendererContainer = Dali::Vector<Renderer*>;
48 using RendererIter = RendererContainer::Iterator;
49 using RendererConstIter = RendererContainer::ConstIterator;
54 namespace VisualRenderer
56 struct AnimatableVisualProperties
58 AnimatableVisualProperties()
59 : mTransformOffset(Vector2::ZERO),
60 mTransformSize(Vector2::ONE),
61 mTransformOrigin(Vector2::ZERO),
62 mTransformAnchorPoint(Vector2::ZERO),
63 mTransformOffsetSizeMode(Vector4::ZERO),
64 mExtraSize(Vector2::ZERO),
65 mMixColor(Vector3::ONE),
66 mPreMultipliedAlpha(0.0f),
67 mExtendedPropertiesDeleteFunction(nullptr)
71 ~AnimatableVisualProperties()
73 if(mExtendedProperties && mExtendedPropertiesDeleteFunction)
75 mExtendedPropertiesDeleteFunction(mExtendedProperties);
80 * @brief Cached coefficient value when we calculate visual transformed update size.
81 * It can reduce complexity of calculate the vertex position.
83 * Vector2 vertexPosition = (XA * aPosition + XB) * originalSize + (CA * aPosition + CB) + Vector2(D, D) * aPosition
85 struct VisualTransformedUpdateSizeCoefficientCache
87 Vector2 coefXA{Vector2::ZERO};
88 Vector2 coefXB{Vector2::ZERO};
89 Vector2 coefCA{Vector2::ZERO};
90 Vector2 coefCB{Vector2::ZERO};
94 uint64_t decoratedHash{0u};
96 VisualTransformedUpdateSizeCoefficientCache mCoefficient; ///< Coefficient value to calculate visual transformed update size by VisualProperties more faster.
98 AnimatableProperty<Vector2> mTransformOffset;
99 AnimatableProperty<Vector2> mTransformSize;
100 AnimatableProperty<Vector2> mTransformOrigin;
101 AnimatableProperty<Vector2> mTransformAnchorPoint;
102 AnimatableProperty<Vector4> mTransformOffsetSizeMode;
103 AnimatableProperty<Vector2> mExtraSize;
104 AnimatableProperty<Vector3> mMixColor;
105 AnimatableProperty<float> mPreMultipliedAlpha;
107 void* mExtendedProperties{nullptr}; // Enable derived class to extend properties further
108 void (*mExtendedPropertiesDeleteFunction)(void*){nullptr}; // Derived class's custom delete functor
111 struct AnimatableDecoratedVisualProperties
113 AnimatableDecoratedVisualProperties()
114 : mCornerRadius(Vector4::ZERO),
115 mCornerRadiusPolicy(1.0f),
116 mBorderlineWidth(0.0f),
117 mBorderlineColor(Color::BLACK),
118 mBorderlineOffset(0.0f),
122 ~AnimatableDecoratedVisualProperties()
126 // Delete function of AnimatableDecoratedVisualProperties* converted as void*
127 static void DeleteFunction(void* data)
129 delete static_cast<AnimatableDecoratedVisualProperties*>(data);
132 AnimatableProperty<Vector4> mCornerRadius;
133 AnimatableProperty<float> mCornerRadiusPolicy;
134 AnimatableProperty<float> mBorderlineWidth;
135 AnimatableProperty<Vector4> mBorderlineColor;
136 AnimatableProperty<float> mBorderlineOffset;
137 AnimatableProperty<float> mBlurRadius;
139 } // namespace VisualRenderer
141 class Renderer : public PropertyOwner,
142 public UniformMapDataProvider,
143 public RenderDataProvider
154 * Construct a new Renderer
156 static Renderer* New();
161 ~Renderer() override;
164 * Overriden delete operator
165 * Deletes the renderer from its global memory pool
167 void operator delete(void* ptr);
170 * Set the texture set for the renderer
171 * @param[in] textureSet The texture set this renderer will use
173 void SetTextures(TextureSet* textureSet);
175 const SceneGraph::TextureSet* GetTextureSet() const
181 * @copydoc RenderDataProvider::GetTextures()
183 const Vector<Render::Texture*>* GetTextures() const override;
186 * @copydoc RenderDataProvider::GetSamplers()
188 const Vector<Render::Sampler*>* GetSamplers() const override;
191 * Set the shader for the renderer
192 * @param[in] shader The shader this renderer will use
194 void SetShader(Shader* shader);
197 * @copydoc RenderDataProvider::GetShader()
199 const Shader& GetShader() const override
205 * Set the geometry for the renderer
206 * @param[in] geometry The geometry this renderer will use
208 void SetGeometry(Render::Geometry* geometry);
211 * Set the depth index
212 * @param[in] depthIndex the new depth index to use
214 void SetDepthIndex(int depthIndex);
217 * @brief Get the depth index
218 * @return The depth index
220 int GetDepthIndex() const
226 * Set the face culling mode
227 * @param[in] faceCullingMode to use
229 void SetFaceCullingMode(FaceCullingMode::Type faceCullingMode);
232 * Get face culling mode
233 * @return The face culling mode
235 FaceCullingMode::Type GetFaceCullingMode() const;
238 * Set the blending mode
239 * @param[in] blendingMode to use
241 void SetBlendMode(BlendMode::Type blendingMode);
244 * Get the blending mode
245 * @return The the blending mode
247 BlendMode::Type GetBlendMode() const;
250 * Set the blending options. This should only be called from the update thread.
251 * @param[in] options A bitmask of blending options.
253 void SetBlendingOptions(uint32_t options);
256 * Get the blending options
257 * @return The the blending mode
259 uint32_t GetBlendingOptions() const;
262 * Set the blend color for blending operation
263 * @param blendColor to pass to GL
265 void SetBlendColor(const Vector4& blendColor);
268 * Get the blending color
269 * @return The blend color
271 Vector4 GetBlendColor() const;
274 * Set the index of first element for indexed draw
275 * @param[in] firstElement index of first element to draw
277 void SetIndexedDrawFirstElement(uint32_t firstElement);
280 * Get the index of first element for indexed draw
281 * @return The index of first element for indexed draw
283 uint32_t GetIndexedDrawFirstElement() const;
286 * Set the number of elements to draw by indexed draw
287 * @param[in] elementsCount number of elements to draw
289 void SetIndexedDrawElementsCount(uint32_t elementsCount);
292 * Get the number of elements to draw by indexed draw
293 * @return The number of elements to draw by indexed draw
295 uint32_t GetIndexedDrawElementsCount() const;
298 * @brief Set whether the Pre-multiplied Alpha Blending is required
299 * @param[in] preMultipled whether alpha is pre-multiplied.
301 void EnablePreMultipliedAlpha(bool preMultipled);
304 * @brief Query whether alpha is pre-multiplied.
305 * @return True is alpha is pre-multiplied, false otherwise.
307 bool IsPreMultipliedAlphaEnabled() const;
310 * Sets the depth buffer write mode
311 * @param[in] depthWriteMode The depth buffer write mode
313 void SetDepthWriteMode(DepthWriteMode::Type depthWriteMode);
316 * Get the depth buffer write mode
317 * @return The depth buffer write mode
319 DepthWriteMode::Type GetDepthWriteMode() const;
322 * Sets the depth buffer test mode
323 * @param[in] depthTestMode The depth buffer test mode
325 void SetDepthTestMode(DepthTestMode::Type depthTestMode);
328 * Get the depth buffer test mode
329 * @return The depth buffer test mode
331 DepthTestMode::Type GetDepthTestMode() const;
334 * Sets the depth function
335 * @param[in] depthFunction The depth function
337 void SetDepthFunction(DepthFunction::Type depthFunction);
340 * Get the depth function
341 * @return The depth function
343 DepthFunction::Type GetDepthFunction() const;
346 * Sets the render mode
347 * @param[in] mode The render mode
349 void SetRenderMode(RenderMode::Type mode);
352 * Sets the stencil function
353 * @param[in] stencilFunction The stencil function
355 void SetStencilFunction(StencilFunction::Type stencilFunction);
358 * Sets the stencil function mask
359 * @param[in] stencilFunctionMask The stencil function mask
361 void SetStencilFunctionMask(int stencilFunctionMask);
364 * Sets the stencil function reference
365 * @param[in] stencilFunctionReference The stencil function reference
367 void SetStencilFunctionReference(int stencilFunctionReference);
370 * Sets the stencil mask
371 * @param[in] stencilMask The stencil mask
373 void SetStencilMask(int stencilMask);
376 * Sets the stencil operation for when the stencil test fails
377 * @param[in] stencilOperationOnFail The stencil operation
379 void SetStencilOperationOnFail(StencilOperation::Type stencilOperationOnFail);
382 * Sets the stencil operation for when the depth test fails
383 * @param[in] stencilOperationOnZFail The stencil operation
385 void SetStencilOperationOnZFail(StencilOperation::Type stencilOperationOnZFail);
388 * Sets the stencil operation for when the depth test passes
389 * @param[in] stencilOperationOnZPass The stencil operation
391 void SetStencilOperationOnZPass(StencilOperation::Type stencilOperationOnZPass);
394 * Gets the stencil parameters
395 * @return The stencil parameters
397 const Render::Renderer::StencilParameters& GetStencilParameters() const;
401 * @param[in] updateBufferIndex The current update buffer index.
402 * @param[in] opacity The opacity
404 void BakeOpacity(BufferIndex updateBufferIndex, float opacity);
407 * @copydoc RenderDataProvider::GetOpacity()
409 float GetOpacity(BufferIndex updateBufferIndex) const override;
412 * Sets the rendering behavior
413 * @param[in] renderingBehavior The rendering behavior required.
415 void SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior);
418 * Gets the rendering behavior
419 * @return The rendering behavior
421 DevelRenderer::Rendering::Type GetRenderingBehavior() const;
424 * Prepare the object for rendering.
425 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
426 * @param[in] updateBufferIndex The current update buffer index.
427 * @return Whether this renderer has been updated in the current frame
429 bool PrepareRender(BufferIndex updateBufferIndex);
432 * Retrieve the Render thread renderer
433 * @return The associated render thread renderer
435 Render::Renderer& GetRenderer();
438 * Query whether the renderer is fully opaque, fully transparent or transparent.
439 * @param[in] updateBufferIndex The current update buffer index.
440 * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
442 OpacityType GetOpacityType(BufferIndex updateBufferIndex, const Node& node) const;
445 * Connect the object to the scene graph
447 * @param[in] sceneController The scene controller - used for sending messages to render thread
448 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
450 void ConnectToSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
453 * Disconnect the object from the scene graph
454 * @param[in] sceneController The scene controller - used for sending messages to render thread
455 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
457 void DisconnectFromSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
460 * @copydoc RenderDataProvider::GetUniformMapDataProvider()
462 const UniformMapDataProvider& GetUniformMapDataProvider() const override
468 * @copydoc RenderDataProvider::IsUpdated()
470 bool IsUpdated() const override
476 * @copydoc RenderDataProvider::GetVisualTransformedUpdateArea()
478 Vector4 GetVisualTransformedUpdateArea(BufferIndex updateBufferIndex, const Vector4& originalUpdateArea) noexcept override;
481 * Sets RenderCallback object
483 * @param[in] callback Valid pointer to RenderCallback object
485 void SetRenderCallback(RenderCallback* callback);
488 * Returns currently set RenderCallback pointer
490 * @return RenderCallback pointer or nullptr
492 RenderCallback* GetRenderCallback()
494 return mRenderCallback;
498 * Merge shader uniform map into renderer uniform map if any of the
499 * maps have changed. Only update uniform map if added to render
501 * @param[in] updateBufferIndex The current update buffer index.
503 void UpdateUniformMap(BufferIndex updateBufferIndex);
506 * Set the given external draw commands on this renderer.
508 void SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size);
511 * Query whether a renderer is dirty.
512 * @return true if the renderer is dirty.
513 * @note It is used to decide whether to reuse the RenderList. We can't reuse the RenderList if this is dirty.
515 bool IsDirty() const;
518 * Reset both dirty flag and updated flag.
519 * @note This is called after rendering has completed.
521 void ResetDirtyFlag();
524 * Get the capacity of the memory pools
525 * @return the capacity of the memory pools
527 static uint32_t GetMemoryPoolCapacity();
529 public: // PropertyOwner::MappingChanged
531 * @copydoc PropertyOwner::OnMappingChanged
533 void OnMappingChanged() override;
535 public: // PropertyOwner implementation
537 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
539 virtual void ResetDefaultProperties(BufferIndex updateBufferIndex){};
541 public: // From UniformMapDataProvider
543 * @copydoc UniformMapDataProvider::GetCollectedUniformMap
545 const CollectedUniformMap& GetCollectedUniformMap() const override;
547 public: // For VisualProperties
549 * To be used only for 1st stage initialization in event thread.
551 void SetVisualProperties(VisualRenderer::AnimatableVisualProperties* visualProperties)
553 mVisualProperties = visualProperties;
557 * May be accessed from event thread
559 const VisualRenderer::AnimatableVisualProperties* GetVisualProperties() const
561 return mVisualProperties.Get();
566 * Protected constructor; See also Renderer::New()
579 CollectedUniformMap mCollectedUniformMap; ///< Uniform maps collected by the renderer
581 SceneController* mSceneController; ///< Used for initializing renderers
582 Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager)
583 TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned)
584 Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned)
585 Shader* mShader; ///< The shader this renderer uses. (Not owned)
587 OwnerPointer<VisualRenderer::AnimatableVisualProperties> mVisualProperties{nullptr}; ///< VisualProperties (optional/owned)
588 OwnerPointer<Vector4> mBlendColor; ///< The blend color for blending operation
590 Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
592 uint64_t mUniformsHash{0}; ///< Hash of uniform map property values
593 uint32_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw
594 uint32_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw
595 uint32_t mBlendBitmask; ///< The bitmask of blending options
596 uint32_t mResendFlag; ///< Indicate whether data should be resent to the renderer
597 UniformMap::SizeType mUniformMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
598 UniformMap::SizeType mShaderMapChangeCounter{0u}; ///< Value to check if uniform data should be updated
600 DepthFunction::Type mDepthFunction : 4; ///< Local copy of the depth function
601 FaceCullingMode::Type mFaceCullingMode : 3; ///< Local copy of the mode of face culling
602 BlendMode::Type mBlendMode : 3; ///< Local copy of the mode of blending
603 DepthWriteMode::Type mDepthWriteMode : 3; ///< Local copy of the depth write mode
604 DepthTestMode::Type mDepthTestMode : 3; ///< Local copy of the depth test mode
605 DevelRenderer::Rendering::Type mRenderingBehavior : 2; ///< The rendering behavior
606 Decay mUpdateDecay : 2; ///< Update decay (aging)
608 bool mRegenerateUniformMap : 1; ///< true if the map should be regenerated
609 bool mPremultipledAlphaEnabled : 1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
610 bool mDirtyFlag : 1; ///< Flag indicating whether the properties are changed
612 std::vector<Dali::DevelRenderer::DrawCommand> mDrawCommands;
613 Dali::RenderCallback* mRenderCallback{nullptr};
616 AnimatableProperty<float> mOpacity; ///< The opacity value
617 int32_t mDepthIndex; ///< Used only in PrepareRenderInstructions
621 inline void SetTexturesMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet)
623 using LocalType = MessageValue1<Renderer, TextureSet*>;
625 // Reserve some memory inside the message queue
626 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
628 // Construct message in the message queue memory; note that delete should not be called on the return value
629 new(slot) LocalType(&renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet));
632 inline void SetGeometryMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry)
634 using LocalType = MessageValue1<Renderer, Render::Geometry*>;
636 // Reserve some memory inside the message queue
637 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
639 // Construct message in the message queue memory; note that delete should not be called on the return value
640 new(slot) LocalType(&renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry));
643 inline void SetShaderMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader)
645 using LocalType = MessageValue1<Renderer, Shader*>;
647 // Reserve some memory inside the message queue
648 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
650 // Construct message in the message queue memory; note that delete should not be called on the return value
651 new(slot) LocalType(&renderer, &Renderer::SetShader, const_cast<Shader*>(&shader));
654 inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex)
656 using LocalType = MessageValue1<Renderer, int>;
658 // Reserve some memory inside the message queue
659 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
661 // Construct message in the message queue memory; note that delete should not be called on the return value
662 new(slot) LocalType(&renderer, &Renderer::SetDepthIndex, depthIndex);
665 inline void SetFaceCullingModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode)
667 using LocalType = MessageValue1<Renderer, FaceCullingMode::Type>;
669 // Reserve some memory inside the message queue
670 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
672 new(slot) LocalType(&renderer, &Renderer::SetFaceCullingMode, faceCullingMode);
675 inline void SetBlendModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode)
677 using LocalType = MessageValue1<Renderer, BlendMode::Type>;
679 // Reserve some memory inside the message queue
680 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
682 new(slot) LocalType(&renderer, &Renderer::SetBlendMode, blendingMode);
685 inline void SetBlendingOptionsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t options)
687 using LocalType = MessageValue1<Renderer, uint32_t>;
689 // Reserve some memory inside the message queue
690 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
692 new(slot) LocalType(&renderer, &Renderer::SetBlendingOptions, options);
695 inline void SetBlendColorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor)
697 using LocalType = MessageValue1<Renderer, Vector4>;
699 // Reserve some memory inside the message queue
700 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
702 new(slot) LocalType(&renderer, &Renderer::SetBlendColor, blendColor);
705 inline void SetIndexedDrawFirstElementMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t firstElement)
707 using LocalType = MessageValue1<Renderer, uint32_t>;
709 // Reserve some memory inside the message queue
710 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
712 new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawFirstElement, firstElement);
715 inline void SetIndexedDrawElementsCountMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, uint32_t elementsCount)
717 using LocalType = MessageValue1<Renderer, uint32_t>;
719 // Reserve some memory inside the message queue
720 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
722 new(slot) LocalType(&renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount);
725 inline void SetEnablePreMultipliedAlphaMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied)
727 using LocalType = MessageValue1<Renderer, bool>;
729 // Reserve some memory inside the message queue
730 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
732 new(slot) LocalType(&renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied);
735 inline void SetDepthWriteModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode)
737 using LocalType = MessageValue1<Renderer, DepthWriteMode::Type>;
739 // Reserve some memory inside the message queue
740 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
742 new(slot) LocalType(&renderer, &Renderer::SetDepthWriteMode, depthWriteMode);
745 inline void SetDepthTestModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode)
747 using LocalType = MessageValue1<Renderer, DepthTestMode::Type>;
749 // Reserve some memory inside the message queue
750 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
752 new(slot) LocalType(&renderer, &Renderer::SetDepthTestMode, depthTestMode);
755 inline void SetDepthFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction)
757 using LocalType = MessageValue1<Renderer, DepthFunction::Type>;
759 // Reserve some memory inside the message queue
760 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
762 new(slot) LocalType(&renderer, &Renderer::SetDepthFunction, depthFunction);
765 inline void SetRenderModeMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode)
767 using LocalType = MessageValue1<Renderer, RenderMode::Type>;
769 // Reserve some memory inside the message queue
770 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
772 new(slot) LocalType(&renderer, &Renderer::SetRenderMode, mode);
775 inline void SetStencilFunctionMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction)
777 using LocalType = MessageValue1<Renderer, StencilFunction::Type>;
779 // Reserve some memory inside the message queue
780 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
782 new(slot) LocalType(&renderer, &Renderer::SetStencilFunction, stencilFunction);
785 inline void SetStencilFunctionMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int mask)
787 using LocalType = MessageValue1<Renderer, int>;
789 // Reserve some memory inside the message queue
790 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
792 new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionMask, mask);
795 inline void SetStencilFunctionReferenceMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference)
797 using LocalType = MessageValue1<Renderer, int>;
799 // Reserve some memory inside the message queue
800 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
802 new(slot) LocalType(&renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference);
805 inline void SetStencilMaskMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask)
807 using LocalType = MessageValue1<Renderer, int>;
809 // Reserve some memory inside the message queue
810 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
812 new(slot) LocalType(&renderer, &Renderer::SetStencilMask, stencilMask);
815 inline void SetStencilOperationOnFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
817 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
819 // Reserve some memory inside the message queue
820 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
822 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnFail, stencilOperation);
825 inline void SetStencilOperationOnZFailMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
827 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
829 // Reserve some memory inside the message queue
830 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
832 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation);
835 inline void SetStencilOperationOnZPassMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation)
837 using LocalType = MessageValue1<Renderer, StencilOperation::Type>;
839 // Reserve some memory inside the message queue
840 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
842 new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation);
845 inline void BakeOpacityMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity)
847 using LocalType = MessageDoubleBuffered1<Renderer, float>;
849 // Reserve some memory inside the message queue
850 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
852 new(slot) LocalType(&renderer, &Renderer::BakeOpacity, opacity);
855 inline void SetRenderingBehaviorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, DevelRenderer::Rendering::Type renderingBehavior)
857 using LocalType = MessageValue1<Renderer, DevelRenderer::Rendering::Type>;
859 // Reserve some memory inside the message queue
860 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
862 new(slot) LocalType(&renderer, &Renderer::SetRenderingBehavior, renderingBehavior);
865 inline void SetDrawCommandsMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size)
867 using LocalType = MessageValue2<Renderer, Dali::DevelRenderer::DrawCommand*, uint32_t>;
869 // Reserve some memory inside the message queue
870 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
872 new(slot) LocalType(&renderer, &Renderer::SetDrawCommands, pDrawCommands, size);
875 inline void SetRenderCallbackMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Dali::RenderCallback* callback)
877 using LocalType = MessageValue1<Renderer, Dali::RenderCallback*>;
879 // Reserve some memory inside the message queue
880 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
882 new(slot) LocalType(&renderer, &Renderer::SetRenderCallback, callback);
885 } // namespace SceneGraph
886 } // namespace Internal
889 #endif // DALI_INTERNAL_SCENE_GRAPH_RENDERER_H