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