Revert "[Tizen] Add codes for Dali Windows Backend"
[platform/core/uifw/dali-core.git] / dali / internal / update / rendering / scene-graph-renderer.h
1 #ifndef DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
2 #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
20 #include <dali/public-api/rendering/geometry.h>
21 #include <dali/public-api/rendering/renderer.h> // Dali::Renderer
22 #include <dali/internal/common/blending-options.h>
23 #include <dali/internal/common/type-abstraction-enums.h>
24 #include <dali/internal/event/common/event-thread-services.h>
25 #include <dali/internal/update/common/property-owner.h>
26 #include <dali/internal/update/common/uniform-map.h>
27 #include <dali/internal/update/common/scene-graph-connection-change-propagator.h>
28 #include <dali/internal/update/common/animatable-property.h>
29 #include <dali/internal/render/data-providers/render-data-provider.h>
30 #include <dali/internal/render/renderers/render-renderer.h>
31
32 namespace Dali
33 {
34
35 namespace Internal
36 {
37
38 namespace Render
39 {
40 class Renderer;
41 class Geometry;
42 }
43
44 namespace SceneGraph
45 {
46 class SceneController;
47
48 class Renderer;
49 typedef Dali::Vector< Renderer* > RendererContainer;
50 typedef RendererContainer::Iterator RendererIter;
51 typedef RendererContainer::ConstIterator RendererConstIter;
52
53 class TextureSet;
54 class Geometry;
55
56 class Renderer :  public PropertyOwner,
57                   public UniformMapDataProvider,
58                   public UniformMap::Observer,
59                   public ConnectionChangePropagator::Observer
60 {
61 public:
62
63   enum OpacityType
64   {
65     OPAQUE,
66     TRANSPARENT,
67     TRANSLUCENT
68   };
69
70   /**
71    * Construct a new Renderer
72    */
73   static Renderer* New();
74
75   /**
76    * Destructor
77    */
78   virtual ~Renderer();
79
80   /**
81    * Overriden delete operator
82    * Deletes the renderer from its global memory pool
83    */
84   void operator delete( void* ptr );
85
86   /**
87    * Set the texture set for the renderer
88    * @param[in] textureSet The texture set this renderer will use
89    */
90   void SetTextures( TextureSet* textureSet );
91
92   /**
93    * Returns current texture set object
94    * @return Pointer to the texture set
95    */
96   const TextureSet* GetTextures() const
97   {
98     return mTextureSet;
99   }
100
101   /**
102    * Set the shader for the renderer
103    * @param[in] shader The shader this renderer will use
104    */
105   void SetShader( Shader* shader );
106
107   /**
108    * Get the shader used by this renderer
109    * @return the shader this renderer uses
110    */
111   const Shader& GetShader() const
112   {
113     return *mShader;
114   }
115
116   /**
117    * Set the geometry for the renderer
118    * @param[in] geometry The geometry this renderer will use
119    */
120   void SetGeometry( Render::Geometry* geometry );
121
122   /**
123    * Set the depth index
124    * @param[in] depthIndex the new depth index to use
125    */
126   void SetDepthIndex( int depthIndex );
127
128   /**
129    * @brief Get the depth index
130    * @return The depth index
131    */
132   int GetDepthIndex() const
133   {
134     return mDepthIndex;
135   }
136
137   /**
138    * Set the face culling mode
139    * @param[in] faceCullingMode to use
140    */
141   void SetFaceCullingMode( FaceCullingMode::Type faceCullingMode );
142
143   /**
144    * Get face culling mode
145    * @return The face culling mode
146    */
147   FaceCullingMode::Type GetFaceCullingMode() const;
148
149   /**
150    * Set the blending mode
151    * @param[in] blendingMode to use
152    */
153   void SetBlendMode( BlendMode::Type blendingMode );
154
155   /**
156    * Get the blending mode
157    * @return The the blending mode
158    */
159   BlendMode::Type GetBlendMode() const;
160
161   /**
162    * Set the blending options. This should only be called from the update thread.
163    * @param[in] options A bitmask of blending options.
164    */
165   void SetBlendingOptions( unsigned int options );
166
167   /**
168    * Get the blending options
169    * @return The the blending mode
170    */
171   unsigned int GetBlendingOptions() const;
172
173   /**
174    * Set the blend color for blending operation
175    * @param blendColor to pass to GL
176    */
177   void SetBlendColor( const Vector4& blendColor );
178
179   /**
180    * Get the blending color
181    * @return The blend color
182    */
183   Vector4 GetBlendColor() const;
184
185   /**
186    * Set the index of first element for indexed draw
187    * @param[in] firstElement index of first element to draw
188    */
189   void SetIndexedDrawFirstElement( size_t firstElement );
190
191   /**
192    * Get the index of first element for indexed draw
193    * @return The index of first element for indexed draw
194    */
195   size_t GetIndexedDrawFirstElement() const;
196
197   /**
198    * Set the number of elements to draw by indexed draw
199    * @param[in] elementsCount number of elements to draw
200    */
201   void SetIndexedDrawElementsCount( size_t elementsCount );
202
203   /**
204    * Get the number of elements to draw by indexed draw
205    * @return The number of elements to draw by indexed draw
206    */
207   size_t GetIndexedDrawElementsCount() const;
208
209   /**
210    * @brief Set whether the Pre-multiplied Alpha Blending is required
211    * @param[in] preMultipled whether alpha is pre-multiplied.
212    */
213   void EnablePreMultipliedAlpha( bool preMultipled );
214
215   /**
216    * @brief Query whether alpha is pre-multiplied.
217    * @return True is alpha is pre-multiplied, false otherwise.
218    */
219   bool IsPreMultipliedAlphaEnabled() const;
220
221   /**
222    * Sets the depth buffer write mode
223    * @param[in] depthWriteMode The depth buffer write mode
224    */
225   void SetDepthWriteMode( DepthWriteMode::Type depthWriteMode );
226
227   /**
228    * Get the depth buffer write mode
229    * @return The depth buffer write mode
230    */
231   DepthWriteMode::Type GetDepthWriteMode() const;
232
233   /**
234    * Sets the depth buffer test mode
235    * @param[in] depthTestMode The depth buffer test mode
236    */
237   void SetDepthTestMode( DepthTestMode::Type depthTestMode );
238
239   /**
240    * Get the depth buffer test mode
241    * @return The depth buffer test mode
242    */
243   DepthTestMode::Type GetDepthTestMode() const;
244
245   /**
246    * Sets the depth function
247    * @param[in] depthFunction The depth function
248    */
249   void SetDepthFunction( DepthFunction::Type depthFunction );
250
251   /**
252    * Get the depth function
253    * @return The depth function
254    */
255   DepthFunction::Type GetDepthFunction() const;
256
257   /**
258    * Sets the render mode
259    * @param[in] mode The render mode
260    */
261   void SetRenderMode( RenderMode::Type mode );
262
263   /**
264    * Sets the stencil function
265    * @param[in] stencilFunction The stencil function
266    */
267   void SetStencilFunction( StencilFunction::Type stencilFunction );
268
269   /**
270    * Sets the stencil function mask
271    * @param[in] stencilFunctionMask The stencil function mask
272    */
273   void SetStencilFunctionMask( int stencilFunctionMask );
274
275   /**
276    * Sets the stencil function reference
277    * @param[in] stencilFunctionReference The stencil function reference
278    */
279   void SetStencilFunctionReference( int stencilFunctionReference );
280
281   /**
282    * Sets the stencil mask
283    * @param[in] stencilMask The stencil mask
284    */
285   void SetStencilMask( int stencilMask );
286
287   /**
288    * Sets the stencil operation for when the stencil test fails
289    * @param[in] stencilOperationOnFail The stencil operation
290    */
291   void SetStencilOperationOnFail( StencilOperation::Type stencilOperationOnFail );
292
293   /**
294    * Sets the stencil operation for when the depth test fails
295    * @param[in] stencilOperationOnZFail The stencil operation
296    */
297   void SetStencilOperationOnZFail( StencilOperation::Type stencilOperationOnZFail );
298
299   /**
300    * Sets the stencil operation for when the depth test passes
301    * @param[in] stencilOperationOnZPass The stencil operation
302    */
303   void SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass );
304
305   /**
306    * Gets the stencil parameters
307    * @return The stencil parameters
308    */
309   const Render::Renderer::StencilParameters& GetStencilParameters() const;
310
311   /**
312    * Bakes the opacity
313    * @param[in] updateBufferIndex The current update buffer index.
314    * @param[in] opacity The opacity
315    */
316   void BakeOpacity( BufferIndex updateBufferIndex, float opacity );
317
318   /**
319    * Gets the opacity
320    * @param[in] bufferIndex The buffer to read from.
321    * @return The opacity
322    */
323   float GetOpacity( BufferIndex updateBufferIndex ) const;
324
325   /**
326    * Prepare the object for rendering.
327    * This is called by the UpdateManager when an object is due to be rendered in the current frame.
328    * @param[in] updateBufferIndex The current update buffer index.
329    */
330   void PrepareRender( BufferIndex updateBufferIndex );
331
332   /**
333    * Retrieve the Render thread renderer
334    * @return The associated render thread renderer
335    */
336   Render::Renderer& GetRenderer();
337
338   /**
339    * Query whether the renderer is fully opaque, fully transparent or transparent.
340    * @param[in] updateBufferIndex The current update buffer index.
341    * @return OPAQUE if fully opaque, TRANSPARENT if fully transparent and TRANSLUCENT if in between
342    */
343   OpacityType GetOpacityType( BufferIndex updateBufferIndex, const Node& node ) const;
344
345   /**
346    * Called by the TextureSet to notify to the renderer that it has changed
347    */
348   void TextureSetChanged();
349
350   /**
351    * Called by the TextureSet to notify to the renderer that it is about to be deleted
352    */
353   void TextureSetDeleted();
354
355   /**
356    * Connect the object to the scene graph
357    *
358    * @param[in] sceneController The scene controller - used for sending messages to render thread
359    * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
360    */
361   void ConnectToSceneGraph( SceneController& sceneController, BufferIndex bufferIndex );
362
363   /**
364    * Disconnect the object from the scene graph
365    * @param[in] sceneController The scene controller - used for sending messages to render thread
366    * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
367    */
368   void DisconnectFromSceneGraph( SceneController& sceneController, BufferIndex bufferIndex );
369
370 public: // Implementation of ConnectionChangePropagator
371   /**
372    * @copydoc ConnectionChangePropagator::AddObserver
373    */
374   void AddConnectionObserver(ConnectionChangePropagator::Observer& observer){};
375
376   /**
377    * @copydoc ConnectionChangePropagator::RemoveObserver
378    */
379   void RemoveConnectionObserver(ConnectionChangePropagator::Observer& observer){};
380
381 public: // UniformMap::Observer
382   /**
383    * @copydoc UniformMap::Observer::UniformMappingsChanged
384    */
385   virtual void UniformMappingsChanged( const UniformMap& mappings );
386
387 public: // ConnectionChangePropagator::Observer
388
389   /**
390    * @copydoc ConnectionChangePropagator::ConnectionsChanged
391    */
392   virtual void ConnectionsChanged( PropertyOwner& owner );
393
394   /**
395    * @copydoc ConnectionChangePropagator::ConnectedUniformMapChanged
396    */
397   virtual void ConnectedUniformMapChanged( );
398
399   /**
400    * @copydoc ConnectionChangePropagator::ConnectedUniformMapChanged
401    */
402   virtual void ObservedObjectDestroyed(PropertyOwner& owner);
403
404 public: // PropertyOwner implementation
405   /**
406    * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
407    */
408   virtual void ResetDefaultProperties( BufferIndex updateBufferIndex ){};
409
410 public: // From UniformMapDataProvider
411
412   /**
413    * @copydoc UniformMapDataProvider::GetUniformMapChanged
414    */
415   virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const{ return mUniformMapChanged[bufferIndex];}
416
417   /**
418    * @copydoc UniformMapDataProvider::GetUniformMap
419    */
420   virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const;
421
422 private:
423
424   /**
425    * Protected constructor; See also Renderer::New()
426    */
427   Renderer();
428
429   /**
430    * Update texture set to the render data provider
431    */
432   void UpdateTextureSet();
433
434 private:
435
436   CollectedUniformMap          mCollectedUniformMap[2];           ///< Uniform maps collected by the renderer
437
438   SceneController*             mSceneController;                  ///< Used for initializing renderers
439   Render::Renderer*            mRenderer;                         ///< Raw pointer to the renderer (that's owned by RenderManager)
440   TextureSet*                  mTextureSet;                       ///< The texture set this renderer uses. (Not owned)
441   Render::Geometry*            mGeometry;                         ///< The geometry this renderer uses. (Not owned)
442   Shader*                      mShader;                           ///< The shader this renderer uses. (Not owned)
443   RenderDataProvider*          mRenderDataProvider;               ///< The render data provider
444   OwnerPointer< Vector4 >      mBlendColor;                       ///< The blend color for blending operation
445
446   Dali::Internal::Render::Renderer::StencilParameters mStencilParameters;         ///< Struct containing all stencil related options
447
448   size_t                       mIndexedDrawFirstElement;          ///< first element index to be drawn using indexed draw
449   size_t                       mIndexedDrawElementsCount;         ///< number of elements to be drawn using indexed draw
450   unsigned int                 mBlendBitmask;                     ///< The bitmask of blending options
451   unsigned int                 mRegenerateUniformMap;             ///< 2 if the map should be regenerated, 1 if it should be copied.
452   unsigned int                 mResendFlag;                       ///< Indicate whether data should be resent to the renderer
453
454   DepthFunction::Type          mDepthFunction:3;                  ///< Local copy of the depth function
455   FaceCullingMode::Type        mFaceCullingMode:2;                ///< Local copy of the mode of face culling
456   BlendMode::Type              mBlendMode:2;                      ///< Local copy of the mode of blending
457   DepthWriteMode::Type         mDepthWriteMode:2;                 ///< Local copy of the depth write mode
458   DepthTestMode::Type          mDepthTestMode:2;                  ///< Local copy of the depth test mode
459
460   bool                         mUniformMapChanged[2];             ///< Records if the uniform map has been altered this frame
461   bool                         mPremultipledAlphaEnabled:1;       ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
462
463 public:
464
465   AnimatableProperty< float >  mOpacity;                          ///< The opacity value
466   int                          mDepthIndex;                       ///< Used only in PrepareRenderInstructions
467
468 };
469
470
471 /// Messages
472 inline void SetTexturesMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const TextureSet& textureSet )
473 {
474   typedef MessageValue1< Renderer, TextureSet* > LocalType;
475
476   // Reserve some memory inside the message queue
477   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
478
479   // Construct message in the message queue memory; note that delete should not be called on the return value
480   new (slot) LocalType( &renderer, &Renderer::SetTextures, const_cast<TextureSet*>(&textureSet) );
481 }
482
483 inline void SetGeometryMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const Render::Geometry& geometry )
484 {
485   typedef MessageValue1< Renderer, Render::Geometry* > LocalType;
486
487   // Reserve some memory inside the message queue
488   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
489
490   // Construct message in the message queue memory; note that delete should not be called on the return value
491   new (slot) LocalType( &renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry) );
492 }
493
494 inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, Shader& shader )
495 {
496   typedef MessageValue1< Renderer, Shader* > LocalType;
497
498   // Reserve some memory inside the message queue
499   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
500
501   // Construct message in the message queue memory; note that delete should not be called on the return value
502   new (slot) LocalType( &renderer, &Renderer::SetShader, &shader );
503 }
504
505 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex )
506 {
507   typedef MessageValue1< Renderer, int > LocalType;
508
509   // Reserve some memory inside the message queue
510   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
511
512   // Construct message in the message queue memory; note that delete should not be called on the return value
513   new (slot) LocalType( &renderer, &Renderer::SetDepthIndex, depthIndex );
514 }
515
516 inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, FaceCullingMode::Type faceCullingMode )
517 {
518   typedef MessageValue1< Renderer, FaceCullingMode::Type > LocalType;
519
520   // Reserve some memory inside the message queue
521   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
522
523   new (slot) LocalType( &renderer, &Renderer::SetFaceCullingMode, faceCullingMode );
524 }
525
526 inline void SetBlendModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, BlendMode::Type blendingMode )
527 {
528   typedef MessageValue1< Renderer, BlendMode::Type > LocalType;
529
530   // Reserve some memory inside the message queue
531   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
532
533   new (slot) LocalType( &renderer, &Renderer::SetBlendMode, blendingMode );
534 }
535
536 inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, unsigned int options )
537 {
538   typedef MessageValue1< Renderer, unsigned int > LocalType;
539
540   // Reserve some memory inside the message queue
541   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
542
543   new (slot) LocalType( &renderer, &Renderer::SetBlendingOptions, options );
544 }
545
546 inline void SetBlendColorMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const Vector4& blendColor )
547 {
548   typedef MessageValue1< Renderer, Vector4 > LocalType;
549
550   // Reserve some memory inside the message queue
551   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
552
553   new (slot) LocalType( &renderer, &Renderer::SetBlendColor, blendColor );
554 }
555
556 inline void SetIndexedDrawFirstElementMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, size_t firstElement )
557 {
558   typedef MessageValue1< Renderer, size_t > LocalType;
559
560   // Reserve some memory inside the message queue
561   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
562
563   new (slot) LocalType( &renderer, &Renderer::SetIndexedDrawFirstElement, firstElement );
564 }
565
566 inline void SetIndexedDrawElementsCountMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, size_t elementsCount )
567 {
568   typedef MessageValue1< Renderer, size_t > LocalType;
569
570   // Reserve some memory inside the message queue
571   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
572
573   new (slot) LocalType( &renderer, &Renderer::SetIndexedDrawElementsCount, elementsCount );
574 }
575
576 inline void SetEnablePreMultipliedAlphaMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, bool preMultiplied )
577 {
578   typedef MessageValue1< Renderer, bool > LocalType;
579
580   // Reserve some memory inside the message queue
581   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
582
583   new (slot) LocalType( &renderer, &Renderer::EnablePreMultipliedAlpha, preMultiplied );
584 }
585
586 inline void SetDepthWriteModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthWriteMode::Type depthWriteMode )
587 {
588   typedef MessageValue1< Renderer, DepthWriteMode::Type > LocalType;
589
590   // Reserve some memory inside the message queue
591   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
592
593   new (slot) LocalType( &renderer, &Renderer::SetDepthWriteMode, depthWriteMode );
594 }
595
596 inline void SetDepthTestModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthTestMode::Type depthTestMode )
597 {
598   typedef MessageValue1< Renderer, DepthTestMode::Type > LocalType;
599
600   // Reserve some memory inside the message queue
601   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
602
603   new (slot) LocalType( &renderer, &Renderer::SetDepthTestMode, depthTestMode );
604 }
605
606 inline void SetDepthFunctionMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, DepthFunction::Type depthFunction )
607 {
608   typedef MessageValue1< Renderer, DepthFunction::Type > LocalType;
609
610   // Reserve some memory inside the message queue
611   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
612
613   new (slot) LocalType( &renderer, &Renderer::SetDepthFunction, depthFunction );
614 }
615
616 inline void SetRenderModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode )
617 {
618   typedef MessageValue1< Renderer, RenderMode::Type > LocalType;
619
620   // Reserve some memory inside the message queue
621   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
622
623   new (slot) LocalType( &renderer, &Renderer::SetRenderMode, mode );
624 }
625
626 inline void SetStencilFunctionMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction )
627 {
628   typedef MessageValue1< Renderer, StencilFunction::Type > LocalType;
629
630   // Reserve some memory inside the message queue
631   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
632
633   new (slot) LocalType( &renderer, &Renderer::SetStencilFunction, stencilFunction );
634 }
635
636 inline void SetStencilFunctionMaskMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int mask )
637 {
638   typedef MessageValue1< Renderer, int > LocalType;
639
640   // Reserve some memory inside the message queue
641   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
642
643   new (slot) LocalType( &renderer, &Renderer::SetStencilFunctionMask, mask );
644 }
645
646 inline void SetStencilFunctionReferenceMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilFunctionReference )
647 {
648   typedef MessageValue1< Renderer, int > LocalType;
649
650   // Reserve some memory inside the message queue
651   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
652
653   new (slot) LocalType( &renderer, &Renderer::SetStencilFunctionReference, stencilFunctionReference );
654 }
655
656 inline void SetStencilMaskMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int stencilMask )
657 {
658   typedef MessageValue1< Renderer, int > LocalType;
659
660   // Reserve some memory inside the message queue
661   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
662
663   new (slot) LocalType( &renderer, &Renderer::SetStencilMask, stencilMask );
664 }
665
666 inline void SetStencilOperationOnFailMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation )
667 {
668   typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
669
670   // Reserve some memory inside the message queue
671   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
672
673   new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnFail, stencilOperation );
674 }
675
676 inline void SetStencilOperationOnZFailMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation )
677 {
678   typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
679
680   // Reserve some memory inside the message queue
681   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
682
683   new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZFail, stencilOperation );
684 }
685
686 inline void SetStencilOperationOnZPassMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilOperation::Type stencilOperation )
687 {
688   typedef MessageValue1< Renderer, StencilOperation::Type > LocalType;
689
690   // Reserve some memory inside the message queue
691   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
692
693   new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation );
694 }
695
696 inline void BakeOpacityMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity )
697 {
698   typedef MessageDoubleBuffered1< Renderer, float > LocalType;
699
700   // Reserve some memory inside the message queue
701   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
702
703   new (slot) LocalType( &renderer, &Renderer::BakeOpacity, opacity );
704 }
705
706 } // namespace SceneGraph
707 } // namespace Internal
708 } // namespace Dali
709
710 #endif //  DALI_INTERNAL_SCENE_GRAPH_RENDERER_H