Merge "Making DALi core internals typesafe using guaranteed types; uint8_t, uint32_t...
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / renderer-impl.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/rendering/renderer-impl.h> // Dali::Internal::Renderer
20
21 // INTERNAL INCLUDES
22 #include <dali/devel-api/scripting/scripting.h>
23 #include <dali/devel-api/rendering/renderer-devel.h>
24 #include <dali/public-api/object/type-registry.h>
25 #include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
26 #include <dali/internal/event/common/property-helper.h>    // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
27 #include <dali/internal/event/common/property-input-impl.h>
28 #include <dali/internal/render/renderers/render-geometry.h>
29 #include <dali/internal/update/manager/update-manager.h>
30 #include <dali/internal/update/rendering/scene-graph-renderer.h>
31
32 namespace Dali
33 {
34 namespace Internal
35 {
36
37 namespace
38 {
39
40 /**
41  * Properties: |name                              |type     |writable|animatable|constraint-input|enum for index-checking|
42  */
43 DALI_PROPERTY_TABLE_BEGIN
44 DALI_PROPERTY( "depthIndex",                      INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_INDEX )
45 DALI_PROPERTY( "faceCullingMode",                 INTEGER,   true, false,  false, Dali::Renderer::Property::FACE_CULLING_MODE )
46 DALI_PROPERTY( "blendMode",                       INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_MODE )
47 DALI_PROPERTY( "blendEquationRgb",                INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_EQUATION_RGB )
48 DALI_PROPERTY( "blendEquationAlpha",              INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_EQUATION_ALPHA )
49 DALI_PROPERTY( "blendFactorSrcRgb",               INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB )
50 DALI_PROPERTY( "blendFactorDestRgb",              INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB )
51 DALI_PROPERTY( "blendFactorSrcAlpha",             INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA )
52 DALI_PROPERTY( "blendFactorDestAlpha",            INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA )
53 DALI_PROPERTY( "blendColor",                      VECTOR4,   true, false,  false, Dali::Renderer::Property::BLEND_COLOR )
54 DALI_PROPERTY( "blendPreMultipliedAlpha",         BOOLEAN,   true, false,  false, Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA )
55 DALI_PROPERTY( "indexRangeFirst",                 INTEGER,   true, false,  false, Dali::Renderer::Property::INDEX_RANGE_FIRST )
56 DALI_PROPERTY( "indexRangeCount",                 INTEGER,   true, false,  false, Dali::Renderer::Property::INDEX_RANGE_COUNT )
57 DALI_PROPERTY( "depthWriteMode",                  INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_WRITE_MODE )
58 DALI_PROPERTY( "depthFunction",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_FUNCTION )
59 DALI_PROPERTY( "depthTestMode",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_TEST_MODE )
60 DALI_PROPERTY( "renderMode",                      INTEGER,   true, false,  false, Dali::Renderer::Property::RENDER_MODE )
61 DALI_PROPERTY( "stencilFunction",                 INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION )
62 DALI_PROPERTY( "stencilFunctionMask",             INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK )
63 DALI_PROPERTY( "stencilFunctionReference",        INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE )
64 DALI_PROPERTY( "stencilMask",                     INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_MASK )
65 DALI_PROPERTY( "stencilOperationOnFail",          INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
66 DALI_PROPERTY( "stencilOperationOnZFail",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
67 DALI_PROPERTY( "stencilOperationOnZPass",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
68 DALI_PROPERTY( "opacity",                         FLOAT,     true, true,   true,  Dali::DevelRenderer::Property::OPACITY )
69 DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX )
70
71 // Property string to enumeration tables:
72
73 DALI_ENUM_TO_STRING_TABLE_BEGIN( FACE_CULLING_MODE )
74 DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, NONE )
75 DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, FRONT )
76 DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, BACK )
77 DALI_ENUM_TO_STRING_WITH_SCOPE( FaceCullingMode, FRONT_AND_BACK )
78 DALI_ENUM_TO_STRING_TABLE_END( FACE_CULLING_MODE )
79
80 DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_MODE )
81 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, OFF )
82 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, AUTO )
83 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendMode, ON )
84 DALI_ENUM_TO_STRING_TABLE_END( BLEND_MODE )
85
86 DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_EQUATION )
87 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, ADD )
88 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, SUBTRACT )
89 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendEquation, REVERSE_SUBTRACT )
90 DALI_ENUM_TO_STRING_TABLE_END( BLEND_EQUATION )
91
92 DALI_ENUM_TO_STRING_TABLE_BEGIN( BLEND_FACTOR )
93 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ZERO )
94 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE )
95 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_COLOR )
96 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_SRC_COLOR )
97 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_ALPHA )
98 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_SRC_ALPHA )
99 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, DST_ALPHA )
100 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_DST_ALPHA )
101 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, DST_COLOR )
102 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_DST_COLOR )
103 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, SRC_ALPHA_SATURATE )
104 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, CONSTANT_COLOR )
105 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_CONSTANT_COLOR )
106 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, CONSTANT_ALPHA )
107 DALI_ENUM_TO_STRING_WITH_SCOPE( BlendFactor, ONE_MINUS_CONSTANT_ALPHA )
108 DALI_ENUM_TO_STRING_TABLE_END( BLEND_FACTOR )
109
110 DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_WRITE_MODE )
111 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, OFF )
112 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, AUTO )
113 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthWriteMode, ON )
114 DALI_ENUM_TO_STRING_TABLE_END( DEPTH_WRITE_MODE )
115
116 DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_TEST_MODE )
117 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, OFF )
118 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, AUTO )
119 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthTestMode, ON )
120 DALI_ENUM_TO_STRING_TABLE_END( DEPTH_TEST_MODE )
121
122 DALI_ENUM_TO_STRING_TABLE_BEGIN( DEPTH_FUNCTION )
123 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, NEVER )
124 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, ALWAYS )
125 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, LESS )
126 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, GREATER )
127 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, EQUAL )
128 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, NOT_EQUAL )
129 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, LESS_EQUAL )
130 DALI_ENUM_TO_STRING_WITH_SCOPE( DepthFunction, GREATER_EQUAL )
131 DALI_ENUM_TO_STRING_TABLE_END( DEPTH_FUNCTION )
132
133 DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_FUNCTION )
134 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, NEVER )
135 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, LESS )
136 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, EQUAL )
137 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, LESS_EQUAL )
138 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, GREATER )
139 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, NOT_EQUAL )
140 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, GREATER_EQUAL )
141 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, ALWAYS )
142 DALI_ENUM_TO_STRING_TABLE_END( STENCIL_FUNCTION )
143
144 DALI_ENUM_TO_STRING_TABLE_BEGIN( RENDER_MODE )
145 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, NONE )
146 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, AUTO )
147 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, COLOR )
148 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, STENCIL )
149 DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, COLOR_STENCIL )
150 DALI_ENUM_TO_STRING_TABLE_END( RENDER_MODE )
151
152 DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_OPERATION )
153 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, ZERO )
154 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, KEEP )
155 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, REPLACE )
156 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INCREMENT )
157 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT )
158 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INVERT )
159 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, INCREMENT_WRAP )
160 DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, DECREMENT_WRAP )
161 DALI_ENUM_TO_STRING_TABLE_END( STENCIL_OPERATION )
162
163 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS, DEFAULT_RENDERER_PROPERTY_START_INDEX };
164
165 BaseHandle Create()
166 {
167   return Dali::BaseHandle();
168 }
169
170 TypeRegistration mType( typeid( Dali::Renderer ), typeid( Dali::Handle ), Create );
171
172 } // unnamed namespace
173
174 RendererPtr Renderer::New()
175 {
176   RendererPtr rendererPtr( new Renderer() );
177   rendererPtr->Initialize();
178   return rendererPtr;
179 }
180
181 void Renderer::SetGeometry( Geometry& geometry )
182 {
183   mGeometry = &geometry;
184
185   const Render::Geometry* geometrySceneObject = geometry.GetRenderObject();
186   SetGeometryMessage( GetEventThreadServices(), *mSceneObject, *geometrySceneObject );
187 }
188
189 Geometry* Renderer::GetGeometry() const
190 {
191   return mGeometry.Get();
192 }
193
194 void Renderer::SetTextures( TextureSet& textureSet )
195 {
196   mTextureSet = &textureSet;
197   const SceneGraph::TextureSet* textureSetSceneObject = textureSet.GetTextureSetSceneObject();
198   SetTexturesMessage( GetEventThreadServices(), *mSceneObject, *textureSetSceneObject );
199 }
200
201 TextureSet* Renderer::GetTextures() const
202 {
203   return mTextureSet.Get();
204 }
205
206 void Renderer::SetShader( Shader& shader )
207 {
208   mShader = &shader;
209   SceneGraph::Shader& sceneGraphShader = *shader.GetShaderSceneObject();
210   SceneGraph::SetShaderMessage( GetEventThreadServices(), *mSceneObject, sceneGraphShader );
211 }
212
213 Shader* Renderer::GetShader() const
214 {
215   return mShader.Get();
216 }
217
218 void Renderer::SetDepthIndex( int depthIndex )
219 {
220   if ( mDepthIndex != depthIndex )
221   {
222     mDepthIndex = depthIndex;
223     SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex );
224   }
225 }
226
227 int Renderer::GetDepthIndex() const
228 {
229   return mDepthIndex;
230 }
231
232 void Renderer::SetBlendMode( BlendMode::Type mode )
233 {
234   if( mBlendMode != mode )
235   {
236     mBlendMode = mode;
237
238     SetBlendModeMessage( GetEventThreadServices(), *mSceneObject, mBlendMode );
239   }
240 }
241
242 BlendMode::Type Renderer::GetBlendMode() const
243 {
244   return mBlendMode;
245 }
246
247 void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba )
248 {
249   mBlendingOptions.SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba );
250   SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
251 }
252
253 void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgb,
254                              BlendFactor::Type destFactorRgb,
255                              BlendFactor::Type srcFactorAlpha,
256                              BlendFactor::Type destFactorAlpha )
257 {
258   mBlendingOptions.SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
259   SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
260 }
261
262 void Renderer::GetBlendFunc( BlendFactor::Type& srcFactorRgb,
263                              BlendFactor::Type& destFactorRgb,
264                              BlendFactor::Type& srcFactorAlpha,
265                              BlendFactor::Type& destFactorAlpha ) const
266 {
267   srcFactorRgb    = mBlendingOptions.GetBlendSrcFactorRgb();
268   destFactorRgb   = mBlendingOptions.GetBlendDestFactorRgb();
269   srcFactorAlpha  = mBlendingOptions.GetBlendSrcFactorAlpha();
270   destFactorAlpha = mBlendingOptions.GetBlendDestFactorAlpha();
271 }
272
273 void Renderer::SetBlendEquation( BlendEquation::Type equationRgba )
274 {
275   mBlendingOptions.SetBlendEquation( equationRgba, equationRgba );
276   SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
277 }
278
279 void Renderer::SetBlendEquation( BlendEquation::Type equationRgb,
280                                  BlendEquation::Type equationAlpha )
281 {
282   mBlendingOptions.SetBlendEquation( equationRgb, equationAlpha );
283   SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
284 }
285
286 void Renderer::GetBlendEquation( BlendEquation::Type& equationRgb,
287                                  BlendEquation::Type& equationAlpha ) const
288 {
289   // These are not animatable, the cached values are up-to-date.
290   equationRgb   = mBlendingOptions.GetBlendEquationRgb();
291   equationAlpha = mBlendingOptions.GetBlendEquationAlpha();
292 }
293
294 void Renderer::SetIndexedDrawFirstElement( uint32_t firstElement )
295 {
296   if( firstElement != mIndexedDrawFirstElement )
297   {
298     mIndexedDrawFirstElement = firstElement;
299     SetIndexedDrawFirstElementMessage( GetEventThreadServices(), *mSceneObject, mIndexedDrawFirstElement );
300   }
301 }
302
303 void Renderer::SetIndexedDrawElementsCount( uint32_t elementsCount )
304 {
305   if( elementsCount != mIndexedDrawElementCount )
306   {
307     mIndexedDrawElementCount = elementsCount;
308     SetIndexedDrawElementsCountMessage( GetEventThreadServices(), *mSceneObject, mIndexedDrawElementCount );
309   }
310 }
311
312
313 void Renderer::EnablePreMultipliedAlpha( bool preMultipled )
314 {
315   if(  mPremultipledAlphaEnabled != preMultipled )
316   {
317     if( preMultipled )
318     {
319       SetBlendFunc( BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA );
320     }
321     else
322     {
323       SetBlendFunc( BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA );
324     }
325     mPremultipledAlphaEnabled = preMultipled;
326     SetEnablePreMultipliedAlphaMessage( GetEventThreadServices(), *mSceneObject, mPremultipledAlphaEnabled );
327   }
328 }
329
330 bool Renderer::IsPreMultipliedAlphaEnabled() const
331 {
332   return mPremultipledAlphaEnabled;
333 }
334
335 SceneGraph::Renderer* Renderer::GetRendererSceneObject()
336 {
337   return mSceneObject;
338 }
339
340 uint32_t Renderer::GetDefaultPropertyCount() const
341 {
342   return RENDERER_IMPL.GetDefaultPropertyCount();
343 }
344
345 void Renderer::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
346 {
347   RENDERER_IMPL.GetDefaultPropertyIndices( indices );
348 }
349
350 const char* Renderer::GetDefaultPropertyName(Property::Index index) const
351 {
352   return RENDERER_IMPL.GetDefaultPropertyName( index );
353 }
354
355 Property::Index Renderer::GetDefaultPropertyIndex( const std::string& name ) const
356 {
357   return RENDERER_IMPL.GetDefaultPropertyIndex( name );
358 }
359
360 bool Renderer::IsDefaultPropertyWritable( Property::Index index ) const
361 {
362   return RENDERER_IMPL.IsDefaultPropertyWritable( index );
363 }
364
365 bool Renderer::IsDefaultPropertyAnimatable( Property::Index index ) const
366 {
367   return RENDERER_IMPL.IsDefaultPropertyAnimatable( index );
368 }
369
370 bool Renderer::IsDefaultPropertyAConstraintInput( Property::Index index ) const
371 {
372   return RENDERER_IMPL.IsDefaultPropertyAConstraintInput( index );
373 }
374
375 Property::Type Renderer::GetDefaultPropertyType( Property::Index index ) const
376 {
377   return RENDERER_IMPL.GetDefaultPropertyType( index );
378 }
379
380 void Renderer::SetDefaultProperty( Property::Index index,
381                                    const Property::Value& propertyValue )
382 {
383   switch( index )
384   {
385     case Dali::Renderer::Property::DEPTH_INDEX:
386     {
387       SetDepthIndex( propertyValue.Get<int>() );
388       break;
389     }
390     case Dali::Renderer::Property::FACE_CULLING_MODE:
391     {
392       FaceCullingMode::Type convertedValue = mFaceCullingMode;
393       if( Scripting::GetEnumerationProperty< FaceCullingMode::Type >( propertyValue, FACE_CULLING_MODE_TABLE, FACE_CULLING_MODE_TABLE_COUNT, convertedValue ) )
394       {
395         mFaceCullingMode = convertedValue;
396         SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
397       }
398       break;
399     }
400     case Dali::Renderer::Property::BLEND_MODE:
401     {
402       BlendMode::Type convertedValue = mBlendMode;
403       if( Scripting::GetEnumerationProperty< BlendMode::Type >( propertyValue, BLEND_MODE_TABLE, BLEND_MODE_TABLE_COUNT, convertedValue ) )
404       {
405         SetBlendMode( convertedValue );
406       }
407       break;
408     }
409     case Dali::Renderer::Property::BLEND_EQUATION_RGB:
410     {
411       BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb();
412
413       if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
414       {
415         BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
416         mBlendingOptions.SetBlendEquation( convertedValue, alphaEquation );
417         SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
418       }
419       break;
420     }
421     case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
422     {
423       BlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationAlpha();
424
425       if( Scripting::GetEnumerationProperty< BlendEquation::Type >( propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue ) )
426       {
427         BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
428         mBlendingOptions.SetBlendEquation( rgbEquation, convertedValue );
429         SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
430       }
431       break;
432     }
433     case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
434     {
435       BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
436       GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
437
438       if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorRgb ) )
439       {
440         SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
441       }
442       break;
443     }
444     case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
445     {
446       BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
447       GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
448
449       if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorRgb ) )
450       {
451         SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
452       }
453       break;
454     }
455     case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
456     {
457       BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
458       GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
459
460       if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorAlpha ) )
461       {
462         SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
463       }
464       break;
465     }
466     case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
467     {
468       BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
469       GetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
470
471       if( Scripting::GetEnumerationProperty< BlendFactor::Type >( propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorAlpha ) )
472       {
473         SetBlendFunc( sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha );
474       }
475       break;
476     }
477     case Dali::Renderer::Property::BLEND_COLOR:
478     {
479       Vector4 blendColor;
480       if( propertyValue.Get( blendColor ) )
481       {
482         SetBlendColor( blendColor );
483       }
484       break;
485     }
486     case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
487     {
488       bool preMultipled;
489       if( propertyValue.Get( preMultipled ) )
490       {
491         EnablePreMultipliedAlpha( preMultipled );
492       }
493       break;
494     }
495     case Dali::Renderer::Property::INDEX_RANGE_FIRST:
496     {
497       int firstElement;
498       if( propertyValue.Get( firstElement ) )
499       {
500         SetIndexedDrawFirstElement( firstElement );
501       }
502       break;
503     }
504     case Dali::Renderer::Property::INDEX_RANGE_COUNT:
505     {
506       int elementsCount;
507       if( propertyValue.Get( elementsCount ) )
508       {
509         SetIndexedDrawElementsCount( elementsCount );
510       }
511       break;
512     }
513     case Dali::Renderer::Property::DEPTH_WRITE_MODE:
514     {
515       DepthWriteMode::Type convertedValue = mDepthWriteMode;
516       if( Scripting::GetEnumerationProperty< DepthWriteMode::Type >( propertyValue, DEPTH_WRITE_MODE_TABLE, DEPTH_WRITE_MODE_TABLE_COUNT, convertedValue ) )
517       {
518         mDepthWriteMode = convertedValue;
519         SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
520       }
521       break;
522     }
523     case Dali::Renderer::Property::DEPTH_FUNCTION:
524     {
525       DepthFunction::Type convertedValue = mDepthFunction;
526       if( Scripting::GetEnumerationProperty< DepthFunction::Type >( propertyValue, DEPTH_FUNCTION_TABLE, DEPTH_FUNCTION_TABLE_COUNT, convertedValue ) )
527       {
528         mDepthFunction = convertedValue;
529         SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
530       }
531       break;
532     }
533     case Dali::Renderer::Property::DEPTH_TEST_MODE:
534     {
535       DepthTestMode::Type convertedValue = mDepthTestMode;
536       if( Scripting::GetEnumerationProperty< DepthTestMode::Type >( propertyValue, DEPTH_TEST_MODE_TABLE, DEPTH_TEST_MODE_TABLE_COUNT, convertedValue ) )
537       {
538         mDepthTestMode = convertedValue;
539         SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
540       }
541       break;
542     }
543     case Dali::Renderer::Property::RENDER_MODE:
544     {
545       RenderMode::Type convertedValue = mStencilParameters.renderMode;
546       if( Scripting::GetEnumerationProperty< RenderMode::Type >( propertyValue, RENDER_MODE_TABLE, RENDER_MODE_TABLE_COUNT, convertedValue ) )
547       {
548         mStencilParameters.renderMode = convertedValue;
549         SetRenderModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
550       }
551       break;
552     }
553     case Dali::Renderer::Property::STENCIL_FUNCTION:
554     {
555       StencilFunction::Type convertedValue = mStencilParameters.stencilFunction;
556       if( Scripting::GetEnumerationProperty< StencilFunction::Type >( propertyValue, STENCIL_FUNCTION_TABLE, STENCIL_FUNCTION_TABLE_COUNT, convertedValue ) )
557       {
558         mStencilParameters.stencilFunction = convertedValue;
559         SetStencilFunctionMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
560       }
561       break;
562     }
563     case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
564     {
565       int stencilFunctionMask;
566       if( propertyValue.Get( stencilFunctionMask ) )
567       {
568         if( stencilFunctionMask != mStencilParameters.stencilFunctionMask )
569         {
570           mStencilParameters.stencilFunctionMask = stencilFunctionMask;
571           SetStencilFunctionMaskMessage( GetEventThreadServices(), *mSceneObject, stencilFunctionMask );
572         }
573       }
574       break;
575     }
576     case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
577     {
578       int stencilFunctionReference;
579       if( propertyValue.Get( stencilFunctionReference ) )
580       {
581         if( stencilFunctionReference != mStencilParameters.stencilFunctionReference )
582         {
583           mStencilParameters.stencilFunctionReference = stencilFunctionReference;
584           SetStencilFunctionReferenceMessage( GetEventThreadServices(), *mSceneObject, stencilFunctionReference );
585         }
586       }
587       break;
588     }
589     case Dali::Renderer::Property::STENCIL_MASK:
590     {
591       int stencilMask;
592       if( propertyValue.Get( stencilMask ) )
593       {
594         if( stencilMask != mStencilParameters.stencilMask )
595         {
596           mStencilParameters.stencilMask = stencilMask;
597           SetStencilMaskMessage( GetEventThreadServices(), *mSceneObject, stencilMask );
598         }
599       }
600       break;
601     }
602     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
603     {
604       StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnFail;
605       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
606       {
607         mStencilParameters.stencilOperationOnFail = convertedValue;
608         SetStencilOperationOnFailMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
609       }
610       break;
611     }
612     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
613     {
614       StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZFail;
615       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
616       {
617         mStencilParameters.stencilOperationOnZFail = convertedValue;
618         SetStencilOperationOnZFailMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
619       }
620       break;
621     }
622     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
623     {
624       StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZPass;
625       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
626       {
627         mStencilParameters.stencilOperationOnZPass = convertedValue;
628         SetStencilOperationOnZPassMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
629       }
630       break;
631     }
632     case Dali::DevelRenderer::Property::OPACITY:
633     {
634       float opacity;
635       if( propertyValue.Get( opacity ) )
636       {
637         if( !Equals( mOpacity, opacity ) )
638         {
639           mOpacity = opacity;
640           BakeOpacityMessage( GetEventThreadServices(), *mSceneObject, mOpacity );
641         }
642       }
643       break;
644     }
645   }
646 }
647
648 void Renderer::SetSceneGraphProperty( Property::Index index,
649                                       const PropertyMetadata& entry,
650                                       const Property::Value& value )
651 {
652   RENDERER_IMPL.SetSceneGraphProperty( GetEventThreadServices(), this, index, entry, value );
653   OnPropertySet(index, value);
654 }
655
656 Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
657 {
658   Property::Value value;
659
660   if( ! GetCachedPropertyValue( index, value ) )
661   {
662     // If property value is not stored in the event-side, then it must be a scene-graph only property
663     GetCurrentPropertyValue( index, value );
664   }
665
666   return value;
667 }
668
669 Property::Value Renderer::GetDefaultPropertyCurrentValue( Property::Index index ) const
670 {
671   Property::Value value;
672
673   if( ! GetCurrentPropertyValue( index, value ) )
674   {
675     // If unable to retrieve scene-graph property value, then it must be an event-side only property
676     GetCachedPropertyValue( index, value );
677   }
678
679   return value;
680 }
681
682 void Renderer::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType )
683 {
684   switch( animationType )
685   {
686     case Animation::TO:
687     case Animation::BETWEEN:
688     {
689       switch( index )
690       {
691         case Dali::DevelRenderer::Property::OPACITY:
692         {
693           value.Get( mOpacity );
694           break;
695         }
696       }
697       break;
698     }
699
700     case Animation::BY:
701     {
702       switch( index )
703       {
704         case Dali::DevelRenderer::Property::OPACITY:
705         {
706           AdjustValue< float >( mOpacity, value );
707           break;
708         }
709       }
710       break;
711     }
712   }
713 }
714
715 const SceneGraph::PropertyOwner* Renderer::GetPropertyOwner() const
716 {
717   return mSceneObject;
718 }
719
720 const SceneGraph::PropertyOwner* Renderer::GetSceneObject() const
721 {
722   return mSceneObject;
723 }
724
725 const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Property::Index index ) const
726 {
727   DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
728   const SceneGraph::PropertyBase* property = NULL;
729
730   property = RENDERER_IMPL.GetRegisteredSceneGraphProperty(
731     this,
732     &Renderer::FindAnimatableProperty,
733     &Renderer::FindCustomProperty,
734     index );
735
736   if( !property )
737   {
738     if( index == DevelRenderer::Property::OPACITY )
739     {
740       property = &mSceneObject->mOpacity;
741     }
742   }
743
744   return property;
745 }
746
747 const PropertyInputImpl* Renderer::GetSceneObjectInputProperty( Property::Index index ) const
748 {
749   const PropertyInputImpl* property = NULL;
750
751   const SceneGraph::PropertyBase* baseProperty =
752     RENDERER_IMPL.GetRegisteredSceneGraphProperty( this,
753                                                    &Renderer::FindAnimatableProperty,
754                                                    &Renderer::FindCustomProperty,
755                                                    index );
756   property = static_cast<const PropertyInputImpl*>( baseProperty );
757
758   return property;
759 }
760
761 int Renderer::GetPropertyComponentIndex( Property::Index index ) const
762 {
763   return Property::INVALID_COMPONENT_INDEX;
764 }
765
766 Renderer::Renderer()
767 : mSceneObject(NULL ),
768   mDepthIndex( 0 ),
769   mIndexedDrawFirstElement( 0 ),
770   mIndexedDrawElementCount( 0 ),
771   mStencilParameters( RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
772   mBlendingOptions(),
773   mOpacity( 1.0f ),
774   mDepthFunction( DepthFunction::LESS ),
775   mFaceCullingMode( FaceCullingMode::NONE ),
776   mBlendMode( BlendMode::AUTO ),
777   mDepthWriteMode( DepthWriteMode::AUTO ),
778   mDepthTestMode( DepthTestMode::AUTO ),
779   mPremultipledAlphaEnabled( false )
780 {
781 }
782
783 void Renderer::Initialize()
784 {
785   EventThreadServices& eventThreadServices = GetEventThreadServices();
786   SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
787
788   mSceneObject = SceneGraph::Renderer::New();
789   OwnerPointer< SceneGraph::Renderer > transferOwnership( mSceneObject );
790   AddRendererMessage( updateManager, transferOwnership );
791
792   eventThreadServices.RegisterObject( this );
793 }
794
795 void Renderer::SetBlendColor( const Vector4& blendColor )
796 {
797   mBlendingOptions.SetBlendColor( blendColor );
798   SetBlendColorMessage( GetEventThreadServices(), *mSceneObject, GetBlendColor() );
799 }
800
801 const Vector4& Renderer::GetBlendColor() const
802 {
803   const Vector4* blendColor = mBlendingOptions.GetBlendColor();
804   if( blendColor )
805   {
806     return *blendColor;
807   }
808   return Color::TRANSPARENT; // GL default
809 }
810
811 Renderer::~Renderer()
812 {
813   if( EventThreadServices::IsCoreRunning() )
814   {
815     EventThreadServices& eventThreadServices = GetEventThreadServices();
816     SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
817     RemoveRendererMessage( updateManager, *mSceneObject );
818
819     eventThreadServices.UnregisterObject( this );
820   }
821 }
822
823 bool Renderer::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const
824 {
825   bool valueSet = true;
826
827   switch( index )
828   {
829     case Dali::Renderer::Property::DEPTH_INDEX:
830     {
831       value = GetDepthIndex();
832       break;
833     }
834     case Dali::Renderer::Property::FACE_CULLING_MODE:
835     {
836       value = mFaceCullingMode;
837       break;
838     }
839     case Dali::Renderer::Property::BLEND_MODE:
840     {
841       value = mBlendMode;
842       break;
843     }
844     case Dali::Renderer::Property::BLEND_EQUATION_RGB:
845     {
846       value = static_cast<int>( mBlendingOptions.GetBlendEquationRgb() );
847       break;
848     }
849     case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
850     {
851       value = static_cast<int>( mBlendingOptions.GetBlendEquationAlpha() );
852       break;
853     }
854     case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
855     {
856       BlendFactor::Type srcFactorRgb;
857       BlendFactor::Type destFactorRgb;
858       BlendFactor::Type srcFactorAlpha;
859       BlendFactor::Type destFactorAlpha;
860       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
861       value = static_cast<int>( srcFactorRgb );
862       break;
863     }
864     case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
865     {
866       BlendFactor::Type srcFactorRgb;
867       BlendFactor::Type destFactorRgb;
868       BlendFactor::Type srcFactorAlpha;
869       BlendFactor::Type destFactorAlpha;
870       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
871       value = static_cast<int>( destFactorRgb );
872       break;
873     }
874     case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
875     {
876       BlendFactor::Type srcFactorRgb;
877       BlendFactor::Type destFactorRgb;
878       BlendFactor::Type srcFactorAlpha;
879       BlendFactor::Type destFactorAlpha;
880       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
881       value = static_cast<int>( srcFactorAlpha );
882       break;
883     }
884     case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
885     {
886       BlendFactor::Type srcFactorRgb;
887       BlendFactor::Type destFactorRgb;
888       BlendFactor::Type srcFactorAlpha;
889       BlendFactor::Type destFactorAlpha;
890       GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
891       value = static_cast<int>( destFactorAlpha );
892       break;
893     }
894     case Dali::Renderer::Property::BLEND_COLOR:
895     {
896       value = GetBlendColor();
897       break;
898     }
899     case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
900     {
901       value = IsPreMultipliedAlphaEnabled();
902       break;
903     }
904     case Dali::Renderer::Property::INDEX_RANGE_FIRST:
905     {
906       value = static_cast<int>( mIndexedDrawFirstElement );
907       break;
908     }
909     case Dali::Renderer::Property::INDEX_RANGE_COUNT:
910     {
911       value = static_cast<int>( mIndexedDrawElementCount );
912       break;
913     }
914     case Dali::Renderer::Property::DEPTH_WRITE_MODE:
915     {
916       value = mDepthWriteMode;
917       break;
918     }
919     case Dali::Renderer::Property::DEPTH_FUNCTION:
920     {
921       value = mDepthFunction;
922       break;
923     }
924     case Dali::Renderer::Property::DEPTH_TEST_MODE:
925     {
926       value = mDepthTestMode;
927       break;
928     }
929     case Dali::Renderer::Property::STENCIL_FUNCTION:
930     {
931       value = mStencilParameters.stencilFunction;
932       break;
933     }
934     case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
935     {
936       value = mStencilParameters.stencilFunctionMask;
937       break;
938     }
939     case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
940     {
941       value = mStencilParameters.stencilFunctionReference;
942       break;
943     }
944     case Dali::Renderer::Property::STENCIL_MASK:
945     {
946       value = mStencilParameters.stencilMask;
947       break;
948     }
949     case Dali::Renderer::Property::RENDER_MODE:
950     {
951       value = mStencilParameters.renderMode;
952       break;
953     }
954     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
955     {
956       value = mStencilParameters.stencilOperationOnFail;
957       break;
958     }
959     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
960     {
961       value = mStencilParameters.stencilOperationOnZFail;
962       break;
963     }
964     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
965     {
966       value = mStencilParameters.stencilOperationOnZPass;
967       break;
968     }
969     case Dali::DevelRenderer::Property::OPACITY:
970     {
971       value = mOpacity;
972       break;
973     }
974     default:
975     {
976       // Must be a scene-graph only property
977       valueSet = false;
978       break;
979     }
980   }
981
982   return valueSet;
983 }
984
985 bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& value  ) const
986 {
987   bool valueSet = true;
988
989   switch( index )
990   {
991     case Dali::Renderer::Property::DEPTH_INDEX:
992     {
993       value = mSceneObject->GetDepthIndex();
994       break;
995     }
996     case Dali::Renderer::Property::FACE_CULLING_MODE:
997     {
998       value = mSceneObject->GetFaceCullingMode();
999       break;
1000     }
1001     case Dali::Renderer::Property::BLEND_MODE:
1002     {
1003       value = mSceneObject->GetBlendMode();
1004       break;
1005     }
1006     case Dali::Renderer::Property::BLEND_EQUATION_RGB:
1007     {
1008       uint32_t bitMask = mSceneObject->GetBlendingOptions();
1009       BlendingOptions blendingOptions;
1010       blendingOptions.SetBitmask( bitMask );
1011       value = static_cast<int>( blendingOptions.GetBlendEquationRgb() );
1012       break;
1013     }
1014     case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
1015     {
1016       uint32_t bitMask = mSceneObject->GetBlendingOptions();
1017       BlendingOptions blendingOptions;
1018       blendingOptions.SetBitmask( bitMask );
1019       value = static_cast<int>( blendingOptions.GetBlendEquationAlpha() );
1020       break;
1021     }
1022     case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
1023     {
1024       uint32_t bitMask = mSceneObject->GetBlendingOptions();
1025       BlendingOptions blendingOptions;
1026       blendingOptions.SetBitmask( bitMask );
1027       value = static_cast<int>( blendingOptions.GetBlendSrcFactorRgb() );
1028       break;
1029     }
1030     case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
1031     {
1032       uint32_t bitMask = mSceneObject->GetBlendingOptions();
1033       BlendingOptions blendingOptions;
1034       blendingOptions.SetBitmask( bitMask );
1035       value = static_cast<int>( blendingOptions.GetBlendDestFactorRgb() );
1036       break;
1037     }
1038     case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
1039     {
1040       uint32_t bitMask = mSceneObject->GetBlendingOptions();
1041       BlendingOptions blendingOptions;
1042       blendingOptions.SetBitmask( bitMask );
1043       value = static_cast<int>( blendingOptions.GetBlendSrcFactorAlpha() );
1044       break;
1045     }
1046     case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
1047     {
1048       uint32_t bitMask = mSceneObject->GetBlendingOptions();
1049       BlendingOptions blendingOptions;
1050       blendingOptions.SetBitmask( bitMask );
1051       value = static_cast<int>( blendingOptions.GetBlendDestFactorAlpha() );
1052       break;
1053     }
1054     case Dali::Renderer::Property::BLEND_COLOR:
1055     {
1056       value = mSceneObject->GetBlendColor();
1057       break;
1058     }
1059     case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
1060     {
1061       value = mSceneObject->IsPreMultipliedAlphaEnabled();
1062       break;
1063     }
1064     case Dali::Renderer::Property::INDEX_RANGE_FIRST:
1065     {
1066       value = static_cast<int>( mSceneObject->GetIndexedDrawFirstElement() );
1067       break;
1068     }
1069     case Dali::Renderer::Property::INDEX_RANGE_COUNT:
1070     {
1071       value = static_cast<int>( mSceneObject->GetIndexedDrawElementsCount() );
1072       break;
1073     }
1074     case Dali::Renderer::Property::DEPTH_WRITE_MODE:
1075     {
1076       value = mSceneObject->GetDepthWriteMode();
1077       break;
1078     }
1079     case Dali::Renderer::Property::DEPTH_FUNCTION:
1080     {
1081       value = mSceneObject->GetDepthFunction();
1082       break;
1083     }
1084     case Dali::Renderer::Property::DEPTH_TEST_MODE:
1085     {
1086       value = mSceneObject->GetDepthTestMode();
1087       break;
1088     }
1089     case Dali::Renderer::Property::STENCIL_FUNCTION:
1090     {
1091       Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
1092       value = stencilParameters.stencilFunction;
1093       break;
1094     }
1095     case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
1096     {
1097       Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
1098       value = stencilParameters.stencilFunctionMask;
1099       break;
1100     }
1101     case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
1102     {
1103       Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
1104       value = stencilParameters.stencilFunctionReference;
1105       break;
1106     }
1107     case Dali::Renderer::Property::STENCIL_MASK:
1108     {
1109       Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
1110       value = stencilParameters.stencilMask;
1111       break;
1112     }
1113     case Dali::Renderer::Property::RENDER_MODE:
1114     {
1115       Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
1116       value = stencilParameters.renderMode;
1117       break;
1118     }
1119     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
1120     {
1121       Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
1122       value = stencilParameters.stencilOperationOnFail;
1123       break;
1124     }
1125     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
1126     {
1127       Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
1128       value = stencilParameters.stencilOperationOnZFail;
1129       break;
1130     }
1131     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
1132     {
1133       Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
1134       value = stencilParameters.stencilOperationOnZPass;
1135       break;
1136     }
1137     case Dali::DevelRenderer::Property::OPACITY:
1138     {
1139       value = mSceneObject->GetOpacity( GetEventThreadServices().GetEventBufferIndex() );
1140       break;
1141     }
1142     default:
1143     {
1144       // Must be an event-side only property
1145       valueSet = false;
1146       break;
1147     }
1148   }
1149
1150   return valueSet;
1151 }
1152
1153 } // namespace Internal
1154 } // namespace Dali