2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/event/rendering/renderer-impl.h> // Dali::Internal::Renderer
22 #include <dali/devel-api/scripting/scripting.h>
23 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
24 #include <dali/internal/event/common/property-input-impl.h>
25 #include <dali/internal/render/renderers/render-geometry.h>
26 #include <dali/internal/update/manager/update-manager.h>
27 #include <dali/internal/update/rendering/scene-graph-renderer-messages.h>
28 #include <dali/internal/update/rendering/scene-graph-renderer.h>
29 #include <dali/public-api/object/type-registry.h>
38 * Properties: |name |type |writable|animatable|constraint-input|enum for index-checking|
40 DALI_PROPERTY_TABLE_BEGIN
41 DALI_PROPERTY("depthIndex", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX)
42 DALI_PROPERTY("faceCullingMode", INTEGER, true, false, false, Dali::Renderer::Property::FACE_CULLING_MODE)
43 DALI_PROPERTY("blendMode", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_MODE)
44 DALI_PROPERTY("blendEquationRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_EQUATION_RGB)
45 DALI_PROPERTY("blendEquationAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_EQUATION_ALPHA)
46 DALI_PROPERTY("blendFactorSrcRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB)
47 DALI_PROPERTY("blendFactorDestRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB)
48 DALI_PROPERTY("blendFactorSrcAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA)
49 DALI_PROPERTY("blendFactorDestAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA)
50 DALI_PROPERTY("blendColor", VECTOR4, true, false, false, Dali::Renderer::Property::BLEND_COLOR)
51 DALI_PROPERTY("blendPreMultipliedAlpha", BOOLEAN, true, false, false, Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA)
52 DALI_PROPERTY("indexRangeFirst", INTEGER, true, false, false, Dali::Renderer::Property::INDEX_RANGE_FIRST)
53 DALI_PROPERTY("indexRangeCount", INTEGER, true, false, false, Dali::Renderer::Property::INDEX_RANGE_COUNT)
54 DALI_PROPERTY("depthWriteMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_WRITE_MODE)
55 DALI_PROPERTY("depthFunction", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_FUNCTION)
56 DALI_PROPERTY("depthTestMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_TEST_MODE)
57 DALI_PROPERTY("renderMode", INTEGER, true, false, false, Dali::Renderer::Property::RENDER_MODE)
58 DALI_PROPERTY("stencilFunction", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION)
59 DALI_PROPERTY("stencilFunctionMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK)
60 DALI_PROPERTY("stencilFunctionReference", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE)
61 DALI_PROPERTY("stencilMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_MASK)
62 DALI_PROPERTY("stencilOperationOnFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL)
63 DALI_PROPERTY("stencilOperationOnZFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL)
64 DALI_PROPERTY("stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS)
65 DALI_PROPERTY("opacity", FLOAT, true, true, true, Dali::DevelRenderer::Property::OPACITY)
66 DALI_PROPERTY("renderingBehavior", INTEGER, true, false, false, Dali::DevelRenderer::Property::RENDERING_BEHAVIOR)
67 DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelRenderer::Property::BLEND_EQUATION)
68 DALI_PROPERTY("instanceCount", INTEGER, true, false, false, Dali::DevelRenderer::Property::INSTANCE_COUNT)
69 DALI_PROPERTY_TABLE_END(DEFAULT_RENDERER_PROPERTY_START_INDEX, RendererDefaultProperties)
71 // Property string to enumeration tables:
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)
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_WITH_SCOPE(BlendMode, ON_WITHOUT_CULL)
85 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendMode, USE_ACTOR_OPACITY)
86 DALI_ENUM_TO_STRING_TABLE_END(BLEND_MODE)
88 DALI_ENUM_TO_STRING_TABLE_BEGIN(BLEND_EQUATION)
89 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendEquation, ADD)
90 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendEquation, SUBTRACT)
91 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendEquation, REVERSE_SUBTRACT)
92 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, MIN)
93 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, MAX)
94 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, MULTIPLY)
95 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, SCREEN)
96 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, OVERLAY)
97 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, DARKEN)
98 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, LIGHTEN)
99 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, COLOR_DODGE)
100 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, COLOR_BURN)
101 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, HARD_LIGHT)
102 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, SOFT_LIGHT)
103 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, DIFFERENCE)
104 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, EXCLUSION)
105 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, HUE)
106 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, SATURATION)
107 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, COLOR)
108 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelBlendEquation, LUMINOSITY)
109 DALI_ENUM_TO_STRING_TABLE_END(BLEND_EQUATION)
111 DALI_ENUM_TO_STRING_TABLE_BEGIN(BLEND_FACTOR)
112 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, ZERO)
113 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, ONE)
114 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, SRC_COLOR)
115 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, ONE_MINUS_SRC_COLOR)
116 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, SRC_ALPHA)
117 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, ONE_MINUS_SRC_ALPHA)
118 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, DST_ALPHA)
119 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, ONE_MINUS_DST_ALPHA)
120 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, DST_COLOR)
121 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, ONE_MINUS_DST_COLOR)
122 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, SRC_ALPHA_SATURATE)
123 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, CONSTANT_COLOR)
124 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, ONE_MINUS_CONSTANT_COLOR)
125 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, CONSTANT_ALPHA)
126 DALI_ENUM_TO_STRING_WITH_SCOPE(BlendFactor, ONE_MINUS_CONSTANT_ALPHA)
127 DALI_ENUM_TO_STRING_TABLE_END(BLEND_FACTOR)
129 DALI_ENUM_TO_STRING_TABLE_BEGIN(DEPTH_WRITE_MODE)
130 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthWriteMode, OFF)
131 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthWriteMode, AUTO)
132 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthWriteMode, ON)
133 DALI_ENUM_TO_STRING_TABLE_END(DEPTH_WRITE_MODE)
135 DALI_ENUM_TO_STRING_TABLE_BEGIN(DEPTH_TEST_MODE)
136 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthTestMode, OFF)
137 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthTestMode, AUTO)
138 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthTestMode, ON)
139 DALI_ENUM_TO_STRING_TABLE_END(DEPTH_TEST_MODE)
141 DALI_ENUM_TO_STRING_TABLE_BEGIN(DEPTH_FUNCTION)
142 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthFunction, NEVER)
143 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthFunction, ALWAYS)
144 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthFunction, LESS)
145 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthFunction, GREATER)
146 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthFunction, EQUAL)
147 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthFunction, NOT_EQUAL)
148 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthFunction, LESS_EQUAL)
149 DALI_ENUM_TO_STRING_WITH_SCOPE(DepthFunction, GREATER_EQUAL)
150 DALI_ENUM_TO_STRING_TABLE_END(DEPTH_FUNCTION)
152 DALI_ENUM_TO_STRING_TABLE_BEGIN(STENCIL_FUNCTION)
153 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilFunction, NEVER)
154 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilFunction, LESS)
155 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilFunction, EQUAL)
156 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilFunction, LESS_EQUAL)
157 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilFunction, GREATER)
158 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilFunction, NOT_EQUAL)
159 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilFunction, GREATER_EQUAL)
160 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilFunction, ALWAYS)
161 DALI_ENUM_TO_STRING_TABLE_END(STENCIL_FUNCTION)
163 DALI_ENUM_TO_STRING_TABLE_BEGIN(RENDER_MODE)
164 DALI_ENUM_TO_STRING_WITH_SCOPE(RenderMode, NONE)
165 DALI_ENUM_TO_STRING_WITH_SCOPE(RenderMode, AUTO)
166 DALI_ENUM_TO_STRING_WITH_SCOPE(RenderMode, COLOR)
167 DALI_ENUM_TO_STRING_WITH_SCOPE(RenderMode, STENCIL)
168 DALI_ENUM_TO_STRING_WITH_SCOPE(RenderMode, COLOR_STENCIL)
169 DALI_ENUM_TO_STRING_TABLE_END(RENDER_MODE)
171 DALI_ENUM_TO_STRING_TABLE_BEGIN(STENCIL_OPERATION)
172 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilOperation, ZERO)
173 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilOperation, KEEP)
174 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilOperation, REPLACE)
175 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilOperation, INCREMENT)
176 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilOperation, DECREMENT)
177 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilOperation, INVERT)
178 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilOperation, INCREMENT_WRAP)
179 DALI_ENUM_TO_STRING_WITH_SCOPE(StencilOperation, DECREMENT_WRAP)
180 DALI_ENUM_TO_STRING_TABLE_END(STENCIL_OPERATION)
182 DALI_ENUM_TO_STRING_TABLE_BEGIN(RENDERING_BEHAVIOR)
183 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelRenderer::Rendering, IF_REQUIRED)
184 DALI_ENUM_TO_STRING_WITH_SCOPE(DevelRenderer::Rendering, CONTINUOUSLY)
185 DALI_ENUM_TO_STRING_TABLE_END(RENDERING_BEHAVIOR)
189 return Dali::BaseHandle();
192 TypeRegistration mType(typeid(Dali::Renderer), typeid(Dali::Handle), Create, RendererDefaultProperties);
194 } // unnamed namespace
196 RendererPtr Renderer::New()
198 // create scene object first so it's guaranteed to exist for the event side
199 auto sceneObjectKey = SceneGraph::Renderer::NewKey();
201 // pass the pointer to base for message passing
202 RendererPtr rendererPtr(new Renderer(sceneObjectKey.Get()));
204 EventThreadServices& eventThreadServices = rendererPtr->GetEventThreadServices();
205 SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
206 AddRendererMessage(updateManager, sceneObjectKey);
208 eventThreadServices.RegisterObject(rendererPtr.Get());
212 void Renderer::SetGeometry(Geometry& geometry)
214 mGeometry = &geometry;
216 const Render::Geometry* geometrySceneObject = geometry.GetRenderObject();
217 SetGeometryMessage(GetEventThreadServices(), GetRendererSceneObject(), *geometrySceneObject);
220 GeometryPtr Renderer::GetGeometry() const
225 void Renderer::SetTextures(TextureSet& textureSet)
227 mTextureSet = &textureSet;
228 const SceneGraph::TextureSet* textureSetSceneObject = textureSet.GetTextureSetSceneObject();
229 SetTexturesMessage(GetEventThreadServices(), GetRendererSceneObject(), *textureSetSceneObject);
232 TextureSetPtr Renderer::GetTextures() const
237 void Renderer::SetShader(Shader& shader)
240 const SceneGraph::Shader& sceneGraphShader = shader.GetShaderSceneObject();
241 SceneGraph::SetShaderMessage(GetEventThreadServices(), GetRendererSceneObject(), sceneGraphShader);
244 ShaderPtr Renderer::GetShader() const
249 void Renderer::SetDepthIndex(int32_t depthIndex)
251 if(mDepthIndex != depthIndex)
253 mDepthIndex = depthIndex;
254 SetDepthIndexMessage(GetEventThreadServices(), GetRendererSceneObject(), depthIndex);
258 int32_t Renderer::GetDepthIndex() const
263 void Renderer::SetBlendMode(BlendMode::Type mode)
265 if(mBlendMode != mode)
269 SetBlendModeMessage(GetEventThreadServices(), GetRendererSceneObject(), mBlendMode);
273 BlendMode::Type Renderer::GetBlendMode() const
278 void Renderer::SetBlendFunc(BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba)
280 mBlendingOptions.SetBlendFunc(srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba);
281 SetBlendingOptionsMessage(GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask());
284 void Renderer::SetBlendFunc(BlendFactor::Type srcFactorRgb,
285 BlendFactor::Type destFactorRgb,
286 BlendFactor::Type srcFactorAlpha,
287 BlendFactor::Type destFactorAlpha)
289 mBlendingOptions.SetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
290 SetBlendingOptionsMessage(GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask());
293 void Renderer::GetBlendFunc(BlendFactor::Type& srcFactorRgb,
294 BlendFactor::Type& destFactorRgb,
295 BlendFactor::Type& srcFactorAlpha,
296 BlendFactor::Type& destFactorAlpha) const
298 srcFactorRgb = mBlendingOptions.GetBlendSrcFactorRgb();
299 destFactorRgb = mBlendingOptions.GetBlendDestFactorRgb();
300 srcFactorAlpha = mBlendingOptions.GetBlendSrcFactorAlpha();
301 destFactorAlpha = mBlendingOptions.GetBlendDestFactorAlpha();
304 void Renderer::SetBlendEquation(DevelBlendEquation::Type equationRgba)
306 mBlendingOptions.SetBlendEquation(equationRgba, equationRgba);
307 SetBlendingOptionsMessage(GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask());
310 void Renderer::SetBlendEquation(DevelBlendEquation::Type equationRgb,
311 DevelBlendEquation::Type equationAlpha)
313 if(mBlendingOptions.IsAdvancedBlendEquation(equationRgb) || mBlendingOptions.IsAdvancedBlendEquation(equationAlpha))
315 DALI_LOG_ERROR("Advanced blend equation requires to be set by using SetBlendEquation( DevelBlendEquation::Type equationRgba ).");
318 mBlendingOptions.SetBlendEquation(equationRgb, equationAlpha);
319 SetBlendingOptionsMessage(GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask());
322 void Renderer::GetBlendEquation(DevelBlendEquation::Type& equationRgb,
323 DevelBlendEquation::Type& equationAlpha) const
325 // These are not animatable, the cached values are up-to-date.
326 equationRgb = mBlendingOptions.GetBlendEquationRgb();
327 equationAlpha = mBlendingOptions.GetBlendEquationAlpha();
330 void Renderer::SetIndexedDrawFirstElement(uint32_t firstElement)
332 if(firstElement != mIndexedDrawFirstElement)
334 mIndexedDrawFirstElement = firstElement;
335 SetIndexedDrawFirstElementMessage(GetEventThreadServices(), GetRendererSceneObject(), mIndexedDrawFirstElement);
339 void Renderer::SetIndexedDrawElementsCount(uint32_t elementsCount)
341 if(elementsCount != mIndexedDrawElementCount)
343 mIndexedDrawElementCount = elementsCount;
344 SetIndexedDrawElementsCountMessage(GetEventThreadServices(), GetRendererSceneObject(), mIndexedDrawElementCount);
348 void Renderer::EnablePreMultipliedAlpha(bool preMultipled)
350 if(mPremultipledAlphaEnabled != preMultipled)
354 SetBlendFunc(BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA);
358 SetBlendFunc(BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA);
360 mPremultipledAlphaEnabled = preMultipled;
361 SetEnablePreMultipliedAlphaMessage(GetEventThreadServices(), GetRendererSceneObject(), mPremultipledAlphaEnabled);
365 bool Renderer::IsPreMultipliedAlphaEnabled() const
367 return mPremultipledAlphaEnabled;
370 bool Renderer::IsAdvancedBlendEquationApplied() const
372 DevelBlendEquation::Type equationRgb, equationAlpha;
373 GetBlendEquation(equationRgb, equationAlpha);
375 if(equationRgb != equationAlpha)
380 return mBlendingOptions.IsAdvancedBlendEquation(equationRgb);
383 const SceneGraph::Renderer& Renderer::GetRendererSceneObject() const
385 return static_cast<const SceneGraph::Renderer&>(GetSceneObject());
388 void Renderer::SetDefaultProperty(Property::Index index,
389 const Property::Value& propertyValue)
393 case Dali::Renderer::Property::DEPTH_INDEX:
395 SetDepthIndex(propertyValue.Get<int32_t>());
398 case Dali::Renderer::Property::FACE_CULLING_MODE:
400 FaceCullingMode::Type convertedValue = mFaceCullingMode;
401 if(Scripting::GetEnumerationProperty<FaceCullingMode::Type>(propertyValue, FACE_CULLING_MODE_TABLE, FACE_CULLING_MODE_TABLE_COUNT, convertedValue))
403 mFaceCullingMode = convertedValue;
404 SetFaceCullingModeMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
408 case Dali::Renderer::Property::BLEND_MODE:
410 BlendMode::Type convertedValue = mBlendMode;
411 if(Scripting::GetEnumerationProperty<BlendMode::Type>(propertyValue, BLEND_MODE_TABLE, BLEND_MODE_TABLE_COUNT, convertedValue))
413 SetBlendMode(convertedValue);
417 case Dali::DevelRenderer::Property::BLEND_EQUATION:
419 DevelBlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb();
421 if(Scripting::GetEnumerationProperty<DevelBlendEquation::Type>(propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue))
423 mBlendingOptions.SetBlendEquation(convertedValue, convertedValue);
424 SetBlendingOptionsMessage(GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask());
428 case Dali::Renderer::Property::BLEND_EQUATION_RGB:
430 DevelBlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationRgb();
432 if(Scripting::GetEnumerationProperty<DevelBlendEquation::Type>(propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue))
434 if(mBlendingOptions.IsAdvancedBlendEquation(convertedValue))
436 DALI_LOG_ERROR("Advanced blend equation requires to be set by using DevelBlendEquation::BLEND_EQUATION.");
439 DevelBlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
440 mBlendingOptions.SetBlendEquation(convertedValue, alphaEquation);
441 SetBlendingOptionsMessage(GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask());
445 case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
447 DevelBlendEquation::Type convertedValue = mBlendingOptions.GetBlendEquationAlpha();
449 if(Scripting::GetEnumerationProperty<DevelBlendEquation::Type>(propertyValue, BLEND_EQUATION_TABLE, BLEND_EQUATION_TABLE_COUNT, convertedValue))
451 if(mBlendingOptions.IsAdvancedBlendEquation(convertedValue))
453 DALI_LOG_ERROR("Advanced blend equation requires to be set by using DevelBlendEquation::BLEND_EQUATION.");
456 DevelBlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
457 mBlendingOptions.SetBlendEquation(rgbEquation, convertedValue);
458 SetBlendingOptionsMessage(GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask());
462 case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
464 BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
465 GetBlendFunc(sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha);
467 if(Scripting::GetEnumerationProperty<BlendFactor::Type>(propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorRgb))
469 SetBlendFunc(sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha);
473 case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
475 BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
476 GetBlendFunc(sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha);
478 if(Scripting::GetEnumerationProperty<BlendFactor::Type>(propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorRgb))
480 SetBlendFunc(sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha);
484 case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
486 BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
487 GetBlendFunc(sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha);
489 if(Scripting::GetEnumerationProperty<BlendFactor::Type>(propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, sourceFactorAlpha))
491 SetBlendFunc(sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha);
495 case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
497 BlendFactor::Type sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha;
498 GetBlendFunc(sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha);
500 if(Scripting::GetEnumerationProperty<BlendFactor::Type>(propertyValue, BLEND_FACTOR_TABLE, BLEND_FACTOR_TABLE_COUNT, destinationFactorAlpha))
502 SetBlendFunc(sourceFactorRgb, destinationFactorRgb, sourceFactorAlpha, destinationFactorAlpha);
506 case Dali::Renderer::Property::BLEND_COLOR:
509 if(propertyValue.Get(blendColor))
511 SetBlendColor(blendColor);
515 case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
518 if(propertyValue.Get(preMultipled))
520 EnablePreMultipliedAlpha(preMultipled);
524 case Dali::Renderer::Property::INDEX_RANGE_FIRST:
526 int32_t firstElement;
527 if(propertyValue.Get(firstElement))
529 SetIndexedDrawFirstElement(firstElement);
533 case Dali::Renderer::Property::INDEX_RANGE_COUNT:
535 int32_t elementsCount;
536 if(propertyValue.Get(elementsCount))
538 SetIndexedDrawElementsCount(elementsCount);
542 case Dali::Renderer::Property::DEPTH_WRITE_MODE:
544 DepthWriteMode::Type convertedValue = mDepthWriteMode;
545 if(Scripting::GetEnumerationProperty<DepthWriteMode::Type>(propertyValue, DEPTH_WRITE_MODE_TABLE, DEPTH_WRITE_MODE_TABLE_COUNT, convertedValue))
547 mDepthWriteMode = convertedValue;
548 SetDepthWriteModeMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
552 case Dali::Renderer::Property::DEPTH_FUNCTION:
554 DepthFunction::Type convertedValue = mDepthFunction;
555 if(Scripting::GetEnumerationProperty<DepthFunction::Type>(propertyValue, DEPTH_FUNCTION_TABLE, DEPTH_FUNCTION_TABLE_COUNT, convertedValue))
557 mDepthFunction = convertedValue;
558 SetDepthFunctionMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
562 case Dali::Renderer::Property::DEPTH_TEST_MODE:
564 DepthTestMode::Type convertedValue = mDepthTestMode;
565 if(Scripting::GetEnumerationProperty<DepthTestMode::Type>(propertyValue, DEPTH_TEST_MODE_TABLE, DEPTH_TEST_MODE_TABLE_COUNT, convertedValue))
567 mDepthTestMode = convertedValue;
568 SetDepthTestModeMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
572 case Dali::Renderer::Property::RENDER_MODE:
574 RenderMode::Type convertedValue = mStencilParameters.renderMode;
575 if(Scripting::GetEnumerationProperty<RenderMode::Type>(propertyValue, RENDER_MODE_TABLE, RENDER_MODE_TABLE_COUNT, convertedValue))
577 mStencilParameters.renderMode = convertedValue;
578 SetRenderModeMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
582 case Dali::Renderer::Property::STENCIL_FUNCTION:
584 StencilFunction::Type convertedValue = mStencilParameters.stencilFunction;
585 if(Scripting::GetEnumerationProperty<StencilFunction::Type>(propertyValue, STENCIL_FUNCTION_TABLE, STENCIL_FUNCTION_TABLE_COUNT, convertedValue))
587 mStencilParameters.stencilFunction = convertedValue;
588 SetStencilFunctionMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
592 case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
594 int32_t stencilFunctionMask;
595 if(propertyValue.Get(stencilFunctionMask))
597 if(stencilFunctionMask != mStencilParameters.stencilFunctionMask)
599 mStencilParameters.stencilFunctionMask = stencilFunctionMask;
600 SetStencilFunctionMaskMessage(GetEventThreadServices(), GetRendererSceneObject(), stencilFunctionMask);
605 case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
607 int32_t stencilFunctionReference;
608 if(propertyValue.Get(stencilFunctionReference))
610 if(stencilFunctionReference != mStencilParameters.stencilFunctionReference)
612 mStencilParameters.stencilFunctionReference = stencilFunctionReference;
613 SetStencilFunctionReferenceMessage(GetEventThreadServices(), GetRendererSceneObject(), stencilFunctionReference);
618 case Dali::Renderer::Property::STENCIL_MASK:
621 if(propertyValue.Get(stencilMask))
623 if(stencilMask != mStencilParameters.stencilMask)
625 mStencilParameters.stencilMask = stencilMask;
626 SetStencilMaskMessage(GetEventThreadServices(), GetRendererSceneObject(), stencilMask);
631 case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
633 StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnFail;
634 if(Scripting::GetEnumerationProperty<StencilOperation::Type>(propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue))
636 mStencilParameters.stencilOperationOnFail = convertedValue;
637 SetStencilOperationOnFailMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
641 case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
643 StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZFail;
644 if(Scripting::GetEnumerationProperty<StencilOperation::Type>(propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue))
646 mStencilParameters.stencilOperationOnZFail = convertedValue;
647 SetStencilOperationOnZFailMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
651 case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
653 StencilOperation::Type convertedValue = mStencilParameters.stencilOperationOnZPass;
654 if(Scripting::GetEnumerationProperty<StencilOperation::Type>(propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue))
656 mStencilParameters.stencilOperationOnZPass = convertedValue;
657 SetStencilOperationOnZPassMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
661 case Dali::DevelRenderer::Property::OPACITY:
664 if(propertyValue.Get(opacity))
666 if(!Equals(mOpacity, opacity))
669 auto sceneObject = const_cast<SceneGraph::Renderer*>(&GetRendererSceneObject());
670 SceneGraph::BakeOpacityMessage(GetEventThreadServices(), *sceneObject, mOpacity);
675 case DevelRenderer::Property::RENDERING_BEHAVIOR:
677 DevelRenderer::Rendering::Type convertedValue = mRenderingBehavior;
678 if(Scripting::GetEnumerationProperty<DevelRenderer::Rendering::Type>(propertyValue, RENDERING_BEHAVIOR_TABLE, RENDERING_BEHAVIOR_TABLE_COUNT, convertedValue))
680 mRenderingBehavior = convertedValue;
681 SetRenderingBehaviorMessage(GetEventThreadServices(), GetRendererSceneObject(), convertedValue);
685 case DevelRenderer::Property::INSTANCE_COUNT:
688 if(propertyValue.Get(instanceCount))
690 if(instanceCount != int(mInstanceCount))
692 mInstanceCount = uint32_t(instanceCount);
693 SetInstanceCountMessage(GetEventThreadServices(), GetRendererSceneObject(), mInstanceCount);
701 Property::Value Renderer::GetDefaultProperty(Property::Index index) const
703 Property::Value value;
705 if(!GetCachedPropertyValue(index, value))
707 // If property value is not stored in the event-side, then it must be a scene-graph only property
708 GetCurrentPropertyValue(index, value);
714 Property::Value Renderer::GetDefaultPropertyCurrentValue(Property::Index index) const
716 Property::Value value;
718 if(!GetCurrentPropertyValue(index, value))
720 // If unable to retrieve scene-graph property value, then it must be an event-side only property
721 GetCachedPropertyValue(index, value);
727 void Renderer::OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType)
729 switch(animationType)
732 case Animation::BETWEEN:
736 case Dali::DevelRenderer::Property::OPACITY:
749 case Dali::DevelRenderer::Property::OPACITY:
751 AdjustValue<float>(mOpacity, value);
760 const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty(Property::Index index) const
762 const SceneGraph::PropertyBase* property = nullptr;
764 if(index == DevelRenderer::Property::OPACITY)
766 property = &GetRendererSceneObject().mOpacity;
770 // not our property, ask base
771 property = Object::GetSceneObjectAnimatableProperty(index);
777 const PropertyInputImpl* Renderer::GetSceneObjectInputProperty(Property::Index index) const
779 // reuse animatable property getter, Object::GetSceneObjectInputProperty does the same so no need to call that0
780 return GetSceneObjectAnimatableProperty(index);
783 void Renderer::AddDrawCommand(const Dali::DevelRenderer::DrawCommand& command)
785 if(!mDrawCommands.capacity())
787 mDrawCommands.reserve(8);
790 mDrawCommands.emplace_back(command);
792 Dali::Internal::SceneGraph::SetDrawCommandsMessage(GetEventThreadServices(),
793 GetRendererSceneObject(),
794 mDrawCommands.data(),
795 uint32_t(mDrawCommands.size())
800 Renderer::Renderer(const SceneGraph::Renderer* sceneObject)
801 : Object(sceneObject),
803 mIndexedDrawFirstElement(0),
804 mIndexedDrawElementCount(0),
805 mStencilParameters(RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP),
808 mDepthFunction(DepthFunction::LESS),
809 mFaceCullingMode(FaceCullingMode::NONE),
810 mBlendMode(BlendMode::AUTO),
811 mDepthWriteMode(DepthWriteMode::AUTO),
812 mDepthTestMode(DepthTestMode::AUTO),
813 mRenderingBehavior(DevelRenderer::Rendering::IF_REQUIRED),
814 mPremultipledAlphaEnabled(false)
818 Renderer::~Renderer()
820 if(EventThreadServices::IsCoreRunning())
822 EventThreadServices& eventThreadServices = GetEventThreadServices();
823 SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
824 RemoveRendererMessage(updateManager, SceneGraph::Renderer::GetKey(GetRendererSceneObject())); //@todo Use key throughtout
826 eventThreadServices.UnregisterObject(this);
830 bool Renderer::GetCachedPropertyValue(Property::Index index, Property::Value& value) const
832 bool valueSet = true;
836 case Dali::Renderer::Property::DEPTH_INDEX:
838 value = GetDepthIndex();
841 case Dali::Renderer::Property::FACE_CULLING_MODE:
843 value = mFaceCullingMode;
846 case Dali::Renderer::Property::BLEND_MODE:
851 case Dali::DevelRenderer::Property::BLEND_EQUATION:
853 value = static_cast<int32_t>(mBlendingOptions.GetBlendEquationRgb());
856 case Dali::Renderer::Property::BLEND_EQUATION_RGB:
858 value = static_cast<int32_t>(mBlendingOptions.GetBlendEquationRgb());
861 case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
863 value = static_cast<int32_t>(mBlendingOptions.GetBlendEquationAlpha());
866 case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
868 BlendFactor::Type srcFactorRgb;
869 BlendFactor::Type destFactorRgb;
870 BlendFactor::Type srcFactorAlpha;
871 BlendFactor::Type destFactorAlpha;
872 GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
873 value = static_cast<int32_t>(srcFactorRgb);
876 case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
878 BlendFactor::Type srcFactorRgb;
879 BlendFactor::Type destFactorRgb;
880 BlendFactor::Type srcFactorAlpha;
881 BlendFactor::Type destFactorAlpha;
882 GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
883 value = static_cast<int32_t>(destFactorRgb);
886 case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
888 BlendFactor::Type srcFactorRgb;
889 BlendFactor::Type destFactorRgb;
890 BlendFactor::Type srcFactorAlpha;
891 BlendFactor::Type destFactorAlpha;
892 GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
893 value = static_cast<int32_t>(srcFactorAlpha);
896 case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
898 BlendFactor::Type srcFactorRgb;
899 BlendFactor::Type destFactorRgb;
900 BlendFactor::Type srcFactorAlpha;
901 BlendFactor::Type destFactorAlpha;
902 GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
903 value = static_cast<int32_t>(destFactorAlpha);
906 case Dali::Renderer::Property::BLEND_COLOR:
908 value = GetBlendColor();
911 case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
913 value = IsPreMultipliedAlphaEnabled();
916 case Dali::Renderer::Property::INDEX_RANGE_FIRST:
918 value = static_cast<int32_t>(mIndexedDrawFirstElement);
921 case Dali::Renderer::Property::INDEX_RANGE_COUNT:
923 value = static_cast<int32_t>(mIndexedDrawElementCount);
926 case Dali::Renderer::Property::DEPTH_WRITE_MODE:
928 value = mDepthWriteMode;
931 case Dali::Renderer::Property::DEPTH_FUNCTION:
933 value = mDepthFunction;
936 case Dali::Renderer::Property::DEPTH_TEST_MODE:
938 value = mDepthTestMode;
941 case Dali::Renderer::Property::STENCIL_FUNCTION:
943 value = mStencilParameters.stencilFunction;
946 case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
948 value = mStencilParameters.stencilFunctionMask;
951 case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
953 value = mStencilParameters.stencilFunctionReference;
956 case Dali::Renderer::Property::STENCIL_MASK:
958 value = mStencilParameters.stencilMask;
961 case Dali::Renderer::Property::RENDER_MODE:
963 value = mStencilParameters.renderMode;
966 case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
968 value = mStencilParameters.stencilOperationOnFail;
971 case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
973 value = mStencilParameters.stencilOperationOnZFail;
976 case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
978 value = mStencilParameters.stencilOperationOnZPass;
981 case Dali::DevelRenderer::Property::OPACITY:
986 case Dali::DevelRenderer::Property::RENDERING_BEHAVIOR:
988 value = mRenderingBehavior;
991 case DevelRenderer::Property::INSTANCE_COUNT:
993 value = int(mInstanceCount);
998 // Must be a scene-graph only property
1007 bool Renderer::GetCurrentPropertyValue(Property::Index index, Property::Value& value) const
1009 bool valueSet = true;
1010 const SceneGraph::Renderer& sceneObject = GetRendererSceneObject();
1014 case Dali::Renderer::Property::DEPTH_INDEX:
1016 value = sceneObject.GetDepthIndex();
1019 case Dali::Renderer::Property::FACE_CULLING_MODE:
1021 value = sceneObject.GetFaceCullingMode();
1024 case Dali::Renderer::Property::BLEND_MODE:
1026 value = sceneObject.GetBlendMode();
1029 case Dali::DevelRenderer::Property::BLEND_EQUATION:
1031 uint32_t bitMask = sceneObject.GetBlendingOptions();
1032 BlendingOptions blendingOptions;
1033 blendingOptions.SetBitmask(bitMask);
1034 value = static_cast<int32_t>(blendingOptions.GetBlendEquationRgb());
1037 case Dali::Renderer::Property::BLEND_EQUATION_RGB:
1039 uint32_t bitMask = sceneObject.GetBlendingOptions();
1040 BlendingOptions blendingOptions;
1041 blendingOptions.SetBitmask(bitMask);
1042 value = static_cast<int32_t>(blendingOptions.GetBlendEquationRgb());
1045 case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
1047 uint32_t bitMask = sceneObject.GetBlendingOptions();
1048 BlendingOptions blendingOptions;
1049 blendingOptions.SetBitmask(bitMask);
1050 value = static_cast<int32_t>(blendingOptions.GetBlendEquationAlpha());
1053 case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
1055 uint32_t bitMask = sceneObject.GetBlendingOptions();
1056 BlendingOptions blendingOptions;
1057 blendingOptions.SetBitmask(bitMask);
1058 value = static_cast<int32_t>(blendingOptions.GetBlendSrcFactorRgb());
1061 case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
1063 uint32_t bitMask = sceneObject.GetBlendingOptions();
1064 BlendingOptions blendingOptions;
1065 blendingOptions.SetBitmask(bitMask);
1066 value = static_cast<int32_t>(blendingOptions.GetBlendDestFactorRgb());
1069 case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
1071 uint32_t bitMask = sceneObject.GetBlendingOptions();
1072 BlendingOptions blendingOptions;
1073 blendingOptions.SetBitmask(bitMask);
1074 value = static_cast<int32_t>(blendingOptions.GetBlendSrcFactorAlpha());
1077 case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
1079 uint32_t bitMask = sceneObject.GetBlendingOptions();
1080 BlendingOptions blendingOptions;
1081 blendingOptions.SetBitmask(bitMask);
1082 value = static_cast<int32_t>(blendingOptions.GetBlendDestFactorAlpha());
1085 case Dali::Renderer::Property::BLEND_COLOR:
1087 value = sceneObject.GetBlendColor();
1090 case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
1092 value = sceneObject.IsPreMultipliedAlphaEnabled();
1095 case Dali::Renderer::Property::INDEX_RANGE_FIRST:
1097 value = static_cast<int32_t>(sceneObject.GetIndexedDrawFirstElement());
1100 case Dali::Renderer::Property::INDEX_RANGE_COUNT:
1102 value = static_cast<int32_t>(sceneObject.GetIndexedDrawElementsCount());
1105 case Dali::Renderer::Property::DEPTH_WRITE_MODE:
1107 value = sceneObject.GetDepthWriteMode();
1110 case Dali::Renderer::Property::DEPTH_FUNCTION:
1112 value = sceneObject.GetDepthFunction();
1115 case Dali::Renderer::Property::DEPTH_TEST_MODE:
1117 value = sceneObject.GetDepthTestMode();
1120 case Dali::Renderer::Property::STENCIL_FUNCTION:
1122 Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1123 value = stencilParameters.stencilFunction;
1126 case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
1128 Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1129 value = stencilParameters.stencilFunctionMask;
1132 case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
1134 Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1135 value = stencilParameters.stencilFunctionReference;
1138 case Dali::Renderer::Property::STENCIL_MASK:
1140 Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1141 value = stencilParameters.stencilMask;
1144 case Dali::Renderer::Property::RENDER_MODE:
1146 Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1147 value = stencilParameters.renderMode;
1150 case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
1152 Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1153 value = stencilParameters.stencilOperationOnFail;
1156 case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
1158 Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1159 value = stencilParameters.stencilOperationOnZFail;
1162 case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
1164 Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
1165 value = stencilParameters.stencilOperationOnZPass;
1168 case Dali::DevelRenderer::Property::OPACITY:
1170 value = sceneObject.GetOpacity(GetEventThreadServices().GetEventBufferIndex());
1173 case Dali::DevelRenderer::Property::RENDERING_BEHAVIOR:
1175 value = sceneObject.GetRenderingBehavior();
1180 // Must be an event-side only property
1189 void Renderer::SetBlendColor(const Vector4& blendColor)
1191 mBlendingOptions.SetBlendColor(blendColor);
1192 SetBlendColorMessage(GetEventThreadServices(), GetRendererSceneObject(), GetBlendColor());
1195 const Vector4& Renderer::GetBlendColor() const
1197 const Vector4* blendColor = mBlendingOptions.GetBlendColor();
1202 return Color::TRANSPARENT; // GL default
1205 void Renderer::SetRenderCallback(RenderCallback* callback)
1207 Dali::Internal::SceneGraph::SetRenderCallbackMessage(GetEventThreadServices(),
1208 GetRendererSceneObject(),
1212 } // namespace Internal