1 #ifndef DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
2 #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
5 * Copyright (c) 2022 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,
144 public UniformMap::Observer
155 * Construct a new Renderer
157 static Renderer* New();
162 ~Renderer() override;
165 * Overriden delete operator
166 * Deletes the renderer from its global memory pool
168 void operator delete(void* ptr);
171 * Set the texture set for the renderer
172 * @param[in] textureSet The texture set this renderer will use
174 void SetTextures(TextureSet* textureSet);
176 const SceneGraph::TextureSet* GetTextureSet() const
182 * @copydoc RenderDataProvider::GetTextures()
184 const Vector<Render::Texture*>* GetTextures() const override;
187 * @copydoc RenderDataProvider::GetSamplers()
189 const Vector<Render::Sampler*>* GetSamplers() const override;
192 * Set the shader for the renderer
193 * @param[in] shader The shader this renderer will use
195 void SetShader(Shader* shader);
198 * @copydoc RenderDataProvider::GetShader()
200 const Shader& GetShader() const override
206 * Set the geometry for the renderer
207 * @param[in] geometry The geometry this renderer will use
209 void SetGeometry(Render::Geometry* geometry);
212 * Set the depth index
213 * @param[in] depthIndex the new depth index to use
215 void SetDepthIndex(int depthIndex);
218 * @brief Get the depth index
219 * @return The depth index
221 int GetDepthIndex() const
227 * Set the face culling mode
228 * @param[in] faceCullingMode to use
230 void SetFaceCullingMode(FaceCullingMode::Type faceCullingMode);
233 * Get face culling mode
234 * @return The face culling mode
236 FaceCullingMode::Type GetFaceCullingMode() const;
239 * Set the blending mode
240 * @param[in] blendingMode to use
242 void SetBlendMode(BlendMode::Type blendingMode);
245 * Get the blending mode
246 * @return The the blending mode
248 BlendMode::Type GetBlendMode() const;
251 * Set the blending options. This should only be called from the update thread.
252 * @param[in] options A bitmask of blending options.
254 void SetBlendingOptions(uint32_t options);
257 * Get the blending options
258 * @return The the blending mode
260 uint32_t GetBlendingOptions() const;
263 * Set the blend color for blending operation
264 * @param blendColor to pass to GL
266 void SetBlendColor(const Vector4& blendColor);
269 * Get the blending color
270 * @return The blend color
272 Vector4 GetBlendColor() const;
275 * Set the index of first element for indexed draw
276 * @param[in] firstElement index of first element to draw
278 void SetIndexedDrawFirstElement(uint32_t firstElement);
281 * Get the index of first element for indexed draw
282 * @return The index of first element for indexed draw
284 uint32_t GetIndexedDrawFirstElement() const;
287 * Set the number of elements to draw by indexed draw
288 * @param[in] elementsCount number of elements to draw
290 void SetIndexedDrawElementsCount(uint32_t elementsCount);
293 * Get the number of elements to draw by indexed draw
294 * @return The number of elements to draw by indexed draw
296 uint32_t GetIndexedDrawElementsCount() const;
299 * @brief Set whether the Pre-multiplied Alpha Blending is required
300 * @param[in] preMultipled whether alpha is pre-multiplied.
302 void EnablePreMultipliedAlpha(bool preMultipled);
305 * @brief Query whether alpha is pre-multiplied.
306 * @return True is alpha is pre-multiplied, false otherwise.
308 bool IsPreMultipliedAlphaEnabled() const;
311 * Sets the depth buffer write mode
312 * @param[in] depthWriteMode The depth buffer write mode
314 void SetDepthWriteMode(DepthWriteMode::Type depthWriteMode);
317 * Get the depth buffer write mode
318 * @return The depth buffer write mode
320 DepthWriteMode::Type GetDepthWriteMode() const;
323 * Sets the depth buffer test mode
324 * @param[in] depthTestMode The depth buffer test mode
326 void SetDepthTestMode(DepthTestMode::Type depthTestMode);
329 * Get the depth buffer test mode
330 * @return The depth buffer test mode
332 DepthTestMode::Type GetDepthTestMode() const;
335 * Sets the depth function
336 * @param[in] depthFunction The depth function
338 void SetDepthFunction(DepthFunction::Type depthFunction);
341 * Get the depth function
342 * @return The depth function
344 DepthFunction::Type GetDepthFunction() const;
347 * Sets the render mode
348 * @param[in] mode The render mode
350 void SetRenderMode(RenderMode::Type mode);
353 * Sets the stencil function
354 * @param[in] stencilFunction The stencil function
356 void SetStencilFunction(StencilFunction::Type stencilFunction);
359 * Sets the stencil function mask
360 * @param[in] stencilFunctionMask The stencil function mask
362 void SetStencilFunctionMask(int stencilFunctionMask);
365 * Sets the stencil function reference
366 * @param[in] stencilFunctionReference The stencil function reference
368 void SetStencilFunctionReference(int stencilFunctionReference);
371 * Sets the stencil mask
372 * @param[in] stencilMask The stencil mask
374 void SetStencilMask(int stencilMask);
377 * Sets the stencil operation for when the stencil test fails
378 * @param[in] stencilOperationOnFail The stencil operation
380 void SetStencilOperationOnFail(StencilOperation::Type stencilOperationOnFail);
383 * Sets the stencil operation for when the depth test fails
384 * @param[in] stencilOperationOnZFail The stencil operation
386 void SetStencilOperationOnZFail(StencilOperation::Type stencilOperationOnZFail);
389 * Sets the stencil operation for when the depth test passes
390 * @param[in] stencilOperationOnZPass The stencil operation
392 void SetStencilOperationOnZPass(StencilOperation::Type stencilOperationOnZPass);
395 * Gets the stencil parameters
396 * @return The stencil parameters
398 const Render::Renderer::StencilParameters& GetStencilParameters() const;
402 * @param[in] updateBufferIndex The current update buffer index.
403 * @param[in] opacity The opacity
405 void BakeOpacity(BufferIndex updateBufferIndex, float opacity);
408 * @copydoc RenderDataProvider::GetOpacity()
410 float GetOpacity(BufferIndex updateBufferIndex) const override;
413 * Sets the rendering behavior
414 * @param[in] renderingBehavior The rendering behavior required.
416 void SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior);
419 * Gets the rendering behavior
420 * @return The rendering behavior
422 DevelRenderer::Rendering::Type GetRenderingBehavior() const;
425 * Prepare the object for rendering.
426 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
427 * @param[in] updateBufferIndex The current update buffer index.
428 * @return Whether this renderer has been updated in the current frame
430 bool PrepareRender(BufferIndex updateBufferIndex);
433 * Retrieve the Render thread renderer
434 * @return The associated render thread renderer
436 Render::Renderer& GetRenderer();
439 * Query whether the renderer is fully opaque, fully transparent or transparent.
440 * @param[in] updateBufferIndex The current update buffer index.
441 * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
443 OpacityType GetOpacityType(BufferIndex updateBufferIndex, const Node& node) const;
446 * Connect the object to the scene graph
448 * @param[in] sceneController The scene controller - used for sending messages to render thread
449 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
451 void ConnectToSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
454 * Disconnect the object from the scene graph
455 * @param[in] sceneController The scene controller - used for sending messages to render thread
456 * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
458 void DisconnectFromSceneGraph(SceneController& sceneController, BufferIndex bufferIndex);
461 * @copydoc RenderDataProvider::GetUniformMapDataProvider()
463 const UniformMapDataProvider& GetUniformMapDataProvider() const override
469 * @copydoc RenderDataProvider::IsUpdated()
471 bool IsUpdated() const override
477 * @copydoc RenderDataProvider::GetVisualTransformedUpdateArea()
479 Vector4 GetVisualTransformedUpdateArea(BufferIndex updateBufferIndex, const Vector4& originalUpdateArea) noexcept override;
482 * Sets RenderCallback object
484 * @param[in] callback Valid pointer to RenderCallback object
486 void SetRenderCallback(RenderCallback* callback);
489 * Returns currently set RenderCallback pointer
491 * @return RenderCallback pointer or nullptr
493 RenderCallback* GetRenderCallback()
495 return mRenderCallback;
499 * Merge shader uniform map into renderer uniform map if any of the
500 * maps have changed. Only update uniform map if added to render
502 * @param[in] updateBufferIndex The current update buffer index.
504 void UpdateUniformMap(BufferIndex updateBufferIndex);
507 * Set the given external draw commands on this renderer.
509 void SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands, uint32_t size);
512 * Query whether a renderer is dirty.
513 * @return true if the renderer is dirty.
514 * @note It is used to decide whether to reuse the RenderList. We can't reuse the RenderList if this is dirty.
516 bool IsDirty() const;
519 * Reset both dirty flag and updated flag.
520 * @note This is called after rendering has completed.
522 void ResetDirtyFlag();
525 * Get the capacity of the memory pools
526 * @return the capacity of the memory pools
528 static uint32_t GetMemoryPoolCapacity();
530 public: // UniformMap::Observer
532 * @copydoc UniformMap::Observer::UniformMappingsChanged
534 void UniformMappingsChanged(const UniformMap& mappings) override;
536 public: // PropertyOwner implementation
538 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
540 virtual void ResetDefaultProperties(BufferIndex updateBufferIndex){};
542 public: // From UniformMapDataProvider
544 * @copydoc UniformMapDataProvider::GetCollectedUniformMap
546 const CollectedUniformMap& GetCollectedUniformMap() const override;
548 public: // For VisualProperties
550 * To be used only for 1st stage initialization in event thread.
552 void SetVisualProperties(VisualRenderer::AnimatableVisualProperties* visualProperties)
554 mVisualProperties = visualProperties;
558 * May be accessed from event thread
560 const VisualRenderer::AnimatableVisualProperties* GetVisualProperties() const
562 return mVisualProperties.Get();
567 * Protected constructor; See also Renderer::New()
580 CollectedUniformMap mCollectedUniformMap; ///< Uniform maps collected by the renderer
582 SceneController* mSceneController; ///< Used for initializing renderers
583 Render::Renderer* mRenderer; ///< Raw pointer to the renderer (that's owned by RenderManager)
584 TextureSet* mTextureSet; ///< The texture set this renderer uses. (Not owned)
585 Render::Geometry* mGeometry; ///< The geometry this renderer uses. (Not owned)
586 Shader* mShader; ///< The shader this renderer uses. (Not owned)
588 OwnerPointer<VisualRenderer::AnimatableVisualProperties> mVisualProperties{nullptr}; ///< VisualProperties (optional/owned)
589 OwnerPointer<Vector4> mBlendColor; ///< The blend color for blending operation
591 Dali::Internal::Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
593 uint64_t mUniformsHash{0}; ///< Hash of uniform map property values
594 uint32_t mIndexedDrawFirstElement; ///< first element index to be drawn using indexed draw
595 uint32_t mIndexedDrawElementsCount; ///< number of elements to be drawn using indexed draw
596 uint32_t mBlendBitmask; ///< The bitmask of blending options
597 uint32_t mResendFlag; ///< Indicate whether data should be resent to the renderer
598 uint32_t mUniformMapChangeCounter{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