Add Post Constraint that works after transform
[platform/core/uifw/dali-core.git] / dali / graphics-api / graphics-program-create-info.h
1 #ifndef DALI_GRAPHICS_PROGRAM_CREATE_INFO_H
2 #define DALI_GRAPHICS_PROGRAM_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 #include "graphics-program.h"
21 #include "graphics-types.h"
22
23 namespace Dali
24 {
25 namespace Graphics
26 {
27 /**
28  * This structure represents the information needed to generate a program.
29  */
30 struct ProgramCreateInfo
31 {
32   /**
33    * @brief Sets pointer to the extension
34    *
35    * The pointer to the extension must be set either to nullptr
36    * or to the valid structure. The structures may create
37    * a chain. The last structure in a chain must point at
38    * nullptr.
39    *
40    * @param[in] value pointer to the valid extension structure
41    * @return reference to this structure
42    */
43   auto& SetNextExtension(ExtensionCreateInfo* value)
44   {
45     nextExtension = value;
46     return *this;
47   }
48
49   /**
50    * @brief Set the allocation callbacks.
51    *
52    * @param[in] value set of allocation callbacks
53    * @return reference to this structure.
54    */
55   auto& SetAllocationCallbacks(const AllocationCallbacks& value)
56   {
57     allocationCallbacks = &value;
58     return *this;
59   }
60
61   /**
62    * @brief Sets the shader state for the program
63    *
64    * The function takes an array of shader states in order to compile
65    * the program. Each ShaderState structure determines the pipeline stage
66    * the shader should be executed on. The Shader object may be already created
67    * with a specific stage.
68    *
69    * Sample:
70    * SetShaderState( { ShaderState().SetShader( vertexShader)
71    *                                .SetPipelineStage( PipelineStage::VERTEX_SHADER ),
72    *                   ShaderState().SetShader( fragmentShader )
73    *                                .SetPipelineStage( PipelineStage::FRAGMENT_SHADER )
74    *                  } );
75    *
76    * In modern graphics API it is possible to attach more than one Shader to a single
77    * stage. For example, one Shader may be just a library of functions:
78    * SetShaderState( { ShaderState().SetShader( vertexShader)
79    *                                .SetPipelineStage( PipelineStage::VERTEX_SHADER ),
80    *                   ShaderState().SetShader( shaderCommons )
81    *                                .SetPipelineStage( PipelineStage::VERTEX_SHADER ),
82    *                   ShaderState().SetShader( fragmentShader )
83    *                                .SetPipelineStage( PipelineStage::FRAGMENT_SHADER )
84    *                  } );
85    *
86    * The Program will compile and link all given shaders.
87    *
88    * param[in] value Valid array of shder states
89    * @return reference to this structure
90    */
91   auto& SetShaderState(const std::vector<ShaderState>& value)
92   {
93     shaderState = &value;
94     return *this;
95   }
96
97   GraphicsStructureType type{GraphicsStructureType::PROGRAM_CREATE_INFO_STRUCT};
98   ExtensionCreateInfo*  nextExtension{nullptr};
99
100   const std::vector<ShaderState>* shaderState{nullptr};
101   const AllocationCallbacks*      allocationCallbacks{nullptr};
102 };
103
104 } // namespace Graphics
105
106 } // namespace Dali
107
108 #endif //DALI_GRAPHICS_PROGRAM_CREATE_INFO_H