Add extra padding for decorated visual renderer
[platform/core/uifw/dali-core.git] / dali / graphics-api / graphics-pipeline-create-info.h
1 #ifndef DALI_GRAPHICS_PIPELINE_CREATE_INFO_H
2 #define DALI_GRAPHICS_PIPELINE_CREATE_INFO_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <memory>
23
24 // INTERNAL INCLUDES
25 #include "graphics-pipeline.h"
26 #include "graphics-types.h"
27
28 namespace Dali
29 {
30 namespace Graphics
31 {
32 /**
33  * @brief Interface class for generating Pipeline types in the graphics API.
34  *
35  * Pipeline after creation stays immutable unless the dynamic states flag is set.
36  * Dynamic states are set as a bitmask indicating which pipeline states will
37  * be changed dynamically by issuing a command in from the command buffer.
38  *
39  * The dynamic states are listed in Dali::Graphics::PipelineDynamicStateBits.
40  */
41 struct PipelineCreateInfo
42 {
43   /**
44    * @brief Sets pointer to the extension
45    *
46    * The pointer to the extension must be set either to nullptr
47    * or to the valid structure. The structures may create
48    * a chain. The last structure in a chain must point at
49    * nullptr.
50    *
51    * @param[in] value pointer to the valid extension structure
52    * @return reference to this structure
53    */
54   auto& SetNextExtension(ExtensionCreateInfo* value)
55   {
56     nextExtension = value;
57     return *this;
58   }
59
60   /**
61    * @brief Set the program
62    *
63    * @param[in] value
64    * @return a reference to this structure
65    */
66   auto& SetProgramState(ProgramState* value)
67   {
68     programState = value;
69     return *this;
70   }
71
72   /**
73    * @brief Sets the color blend state
74    * @param[in] value pointer to valid color blend state structure
75    * @return reference to this structure
76    */
77   auto& SetColorBlendState(ColorBlendState* value)
78   {
79     colorBlendState = value;
80     return *this;
81   }
82
83   /**
84    * @brief Sets the viewport state.
85    *
86    * @param[in] value pointer to valid viewport state structure
87    * @return reference to this structure
88    */
89   auto& SetViewportState(ViewportState* value)
90   {
91     viewportState = value;
92     return *this;
93   }
94
95   /**
96    * @brief Sets the base pipeline.
97    *
98    * Setting base pipeline allows inheriting that pipeline state
99    * and build the new pipeline from it. The base pipeline
100    * must stay valid until derived pipeline needs it.
101    *
102    * @param[in] value pointer to valid pipeline object
103    * @return reference to this structure
104    */
105   auto& SetBasePipeline(Pipeline* value)
106   {
107     basePipeline = value;
108     return *this;
109   }
110
111   /**
112    * @brief Sets the depth/stencil state.
113    *
114    * @param[in] pointer to valid depth/stencil state structure
115    * @return reference to this structure
116    */
117   auto& SetDepthStencilState(DepthStencilState* value)
118   {
119     depthStencilState = value;
120     return *this;
121   }
122
123   /**
124    * @brief Sets the rasterization state.
125    *
126    * @param[in] pointer to valid rasterization state structure
127    * @return reference to this structure
128    */
129   auto& SetRasterizationState(RasterizationState* value)
130   {
131     rasterizationState = value;
132     return *this;
133   }
134
135   /**
136    * @brief Sets the vertex input state.
137    *
138    * Vertex input state describes format of vertices and must
139    * be compatible with attached shaders.
140    *
141    * @param[in] pointer to vertex input state structure
142    * @return reference to this structure
143    */
144   auto& SetVertexInputState(VertexInputState* value)
145   {
146     vertexInputState = value;
147     return *this;
148   }
149
150   /**
151    * @brief Sets the input assembly state.
152    *
153    * This state describes the topology of the pipeline.
154    *
155    * @param[in] pointer to valid input assembly state structure
156    * @return reference to this structure
157    */
158   auto& SetInputAssemblyState(InputAssemblyState* value)
159   {
160     inputAssemblyState = value;
161     return *this;
162   }
163
164   /**
165    * @brief Sets the dynamic state mask.
166    *
167    * Certain states can be modified on fly without a need of
168    * creating new pipeline. The commands which modify particular
169    * states may be issued later by executing command buffers.
170    *
171    * @param[in] pointer to valid color blend state structure
172    * @return reference to this structure
173    */
174   auto& SetDynamicStateMask(PipelineDynamicStateMask value)
175   {
176     dynamicStateMask = value;
177     return *this;
178   }
179
180   /**
181    * @brief Sets allocation callbacks which will be used when object is created
182    * and destroyed.
183    *
184    * @param[in] value Valid reference to AllocationCallbacksStructure
185    * @return reference to this structure
186    */
187   auto& SetAllocationCallbacks(const AllocationCallbacks& value)
188   {
189     allocationCallbacks = &value;
190     return *this;
191   }
192
193   GraphicsStructureType type{GraphicsStructureType::PIPELINE_CREATE_INFO_STRUCT};
194   ExtensionCreateInfo*  nextExtension{nullptr};
195
196   ProgramState*            programState{nullptr};
197   ColorBlendState*         colorBlendState{nullptr};
198   ViewportState*           viewportState{nullptr};
199   Pipeline*                basePipeline{nullptr};
200   DepthStencilState*       depthStencilState{nullptr};
201   RasterizationState*      rasterizationState{nullptr};
202   VertexInputState*        vertexInputState{nullptr};
203   InputAssemblyState*      inputAssemblyState{nullptr};
204   PipelineDynamicStateMask dynamicStateMask{0u};
205
206   const AllocationCallbacks* allocationCallbacks{nullptr};
207 };
208
209 } // namespace Graphics
210 } // namespace Dali
211
212 #endif // DALI_GRAPHICS_PIPELINE_CREATE_INFO_H