1 #ifndef DALI_RENDERER_DEVEL_H
2 #define DALI_RENDERER_DEVEL_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/rendering/renderer.h>
26 namespace DevelBlendEquation
29 * @brief Enumeration for blend equation.
33 ADD = Dali::BlendEquation::ADD,
34 SUBTRACT = Dali::BlendEquation::SUBTRACT,
35 REVERSE_SUBTRACT = Dali::BlendEquation::REVERSE_SUBTRACT,
37 // OpenGL es 3.0 enumeration
41 // OpenGL es 3.2 or KHR_Blend_Equation_Advanced enumeration
59 } // namespace DevelBlendEquation
61 namespace DevelRenderer
64 * The index of render queue used by the DrawCommand
66 using RenderQueueIndex = uint32_t;
68 constexpr RenderQueueIndex RENDER_QUEUE_OPAQUE = 0; ///< Queue for opaque elements
69 constexpr RenderQueueIndex RENDER_QUEUE_TRANSPARENT = 1; ///<Queue for transparent elements
70 constexpr RenderQueueIndex RENDER_QUEUE_MAX = 2;
73 * Enum describing way of rendering the primitives (indexed draw, array draw)
82 * Draw command can be attached to the Dali::Renderer and override the default
83 * rendering functionality. Renderer may have several DrawCommands attached to it
84 * and the will be executed sequentially in the order of the 'queue' index.
88 DrawType drawType; ///< Type of drawing (indexed, array)
89 uint32_t firstIndex; ///< First index into the geometry array
90 uint32_t elementCount; ///< Number of elements to draw
91 RenderQueueIndex queue; ///< Queue index
95 * @brief Adds a draw command to the renderer
96 * Once the draw command is added, the default Renderer's behaviour is overriden.
97 * @param[in] renderer a valid Renderer object
98 * @param[in] drawCommand Valid DrawCommand to add to the Renderer
100 DALI_CORE_API void AddDrawCommand(Dali::Renderer renderer, const DrawCommand& drawCommand);
106 DEPTH_INDEX = Dali::Renderer::Property::DEPTH_INDEX,
107 FACE_CULLING_MODE = Dali::Renderer::Property::FACE_CULLING_MODE,
108 BLEND_MODE = Dali::Renderer::Property::BLEND_MODE,
109 BLEND_EQUATION_RGB = Dali::Renderer::Property::BLEND_EQUATION_RGB,
110 BLEND_EQUATION_ALPHA = Dali::Renderer::Property::BLEND_EQUATION_ALPHA,
111 BLEND_FACTOR_SRC_RGB = Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB,
112 BLEND_FACTOR_DEST_RGB = Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB,
113 BLEND_FACTOR_SRC_ALPHA = Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA,
114 BLEND_FACTOR_DEST_ALPHA = Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA,
115 BLEND_COLOR = Dali::Renderer::Property::BLEND_COLOR,
116 BLEND_PRE_MULTIPLIED_ALPHA = Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA,
117 INDEX_RANGE_FIRST = Dali::Renderer::Property::INDEX_RANGE_FIRST,
118 INDEX_RANGE_COUNT = Dali::Renderer::Property::INDEX_RANGE_COUNT,
119 DEPTH_WRITE_MODE = Dali::Renderer::Property::DEPTH_WRITE_MODE,
120 DEPTH_FUNCTION = Dali::Renderer::Property::DEPTH_FUNCTION,
121 DEPTH_TEST_MODE = Dali::Renderer::Property::DEPTH_TEST_MODE,
122 RENDER_MODE = Dali::Renderer::Property::RENDER_MODE,
123 STENCIL_FUNCTION = Dali::Renderer::Property::STENCIL_FUNCTION,
124 STENCIL_FUNCTION_MASK = Dali::Renderer::Property::STENCIL_FUNCTION_MASK,
125 STENCIL_FUNCTION_REFERENCE = Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE,
126 STENCIL_MASK = Dali::Renderer::Property::STENCIL_MASK,
127 STENCIL_OPERATION_ON_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL,
128 STENCIL_OPERATION_ON_Z_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL,
129 STENCIL_OPERATION_ON_Z_PASS = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS,
132 * @brief The opacity of the renderer.
133 * @details Name "opacity", type Property::FLOAT.
135 OPACITY = STENCIL_OPERATION_ON_Z_PASS + 1,
138 * @brief The rendering behavior of the renderer.
139 * @details Name "renderingBehavior", type Property::INTEGER.
141 RENDERING_BEHAVIOR = STENCIL_OPERATION_ON_Z_PASS + 2,
144 * @brief name "blendEquation", type INTEGER
145 * @note The default value is BlendEquation::ADD
147 BLEND_EQUATION = STENCIL_OPERATION_ON_Z_PASS + 3,
150 * @brief Which vertex to render first from a vertex buffer without indices
151 * @details name "vertexRangeFirst", type INTEGER
153 VERTEX_RANGE_FIRST = INDEX_RANGE_FIRST,
156 * @brief How many vertices to render to render from a vertex buffer without indices
157 * @details name "vertexRangeCount", type INTEGER
159 VERTEX_RANGE_COUNT = INDEX_RANGE_COUNT,
162 * @brief How many instances to render from a vertex buffer with non-zero divisor.
163 * @note Overrides computed instance count on vertex buffer.
164 * @details name "instanceCount", type INTEGER
166 INSTANCE_COUNT = STENCIL_OPERATION_ON_Z_PASS + 4,
168 } // namespace Property
173 * @brief Enumeration for the rendering behavior
177 IF_REQUIRED, ///< Default. Will only render if required to do so.
178 CONTINUOUSLY ///< Will render continuously.
181 } // namespace Rendering
184 * @brief Query whether current blend equation is advanced option.
185 * @param[in] renderer to be checked whether it has been applied advanced blend equation or not
186 * @return True if current blend equation is advanced.
188 DALI_CORE_API bool IsAdvancedBlendEquationApplied(const Renderer& renderer);
190 } // namespace DevelRenderer
194 #endif // DALI_RENDERER_DEVEL_H