Merge branch 'devel/graphics' into devel/master
[platform/core/uifw/dali-core.git] / dali / graphics-api / graphics-sampler-create-info.h
1 #ifndef DALI_GRAPHICS_SAMPLER_CREATE_INFO_H
2 #define DALI_GRAPHICS_SAMPLER_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-sampler.h"
26 #include "graphics-types.h"
27
28 namespace Dali
29 {
30 namespace Graphics
31 {
32 /**
33  * @brief Interface class for SamplerCreateInfo types in the graphics API.
34  */
35 struct SamplerCreateInfo
36 {
37   /**
38    * @brief Sets pointer to the extension
39    *
40    * The pointer to the extension must be set either to nullptr
41    * or to the valid structure. The structures may create
42    * a chain. The last structure in a chain must point at
43    * nullptr.
44    *
45    * @param[in] value pointer to the valid extension structure
46    * @return reference to this structure
47    */
48   auto& SetNextExtension(ExtensionCreateInfo* value)
49   {
50     nextExtension = value;
51     return *this;
52   }
53
54   /**
55    * @brief Sets address mode U
56    *
57    * @param[in] value Address mode
58    * @return reference to this structure
59    */
60   auto& SetAddressModeU(SamplerAddressMode value)
61   {
62     addressModeU = value;
63     return *this;
64   }
65
66   /**
67    * @brief Sets address mode V
68    *
69    * @param[in] value Address mode
70    * @return reference to this structure
71    */
72   auto& SetAddressModeV(SamplerAddressMode value)
73   {
74     addressModeV = value;
75     return *this;
76   }
77
78   /**
79    * @brief Sets address mode W
80    *
81    * @param[in] value Address mode
82    * @return reference to this structure
83    */
84   auto& SetAddressModeW(SamplerAddressMode value)
85   {
86     addressModeW = value;
87     return *this;
88   }
89
90   /**
91    * @brief Sets minification filter
92    *
93    * @param[in] value filter mode
94    * @return reference to this structure
95    */
96   auto& SetMinFilter(SamplerFilter value)
97   {
98     minFilter = value;
99     return *this;
100   }
101
102   /**
103    * @brief Sets magnification filter
104    *
105    * @param[in] value filter mode
106    * @return reference to this structure
107    */
108   auto& SetMagFilter(SamplerFilter value)
109   {
110     magFilter = value;
111     return *this;
112   }
113
114   /**
115    * @brief Sets mipmap mode
116    *
117    * @param[in] value mipmap mode
118    * @return reference to this structure
119    */
120   auto& SetMipMapMode(SamplerMipmapMode value)
121   {
122     mipMapMode = value;
123     return *this;
124   }
125
126   /**
127    * @brief Enables/disables anisotropy
128    *
129    * @param[in] value true to enable, false otherwise
130    * @return reference to this structure
131    */
132   auto& SetAnisotropyEnable(bool value)
133   {
134     anisotropyEnable = value;
135     return *this;
136   }
137
138   /**
139    * @brief Sets maximum anisotropy level
140    *
141    * @param[in] value maximum anisotropy level
142    * @return reference to this structure
143    */
144   auto& SetMaxAnisotropy(float value)
145   {
146     maxAnisotropy = value;
147     return *this;
148   }
149
150   /**
151    * @brief Sets minimum LOD
152    *
153    * @param[in] value LOD value
154    * @return reference to this structure
155    */
156   auto& SetMinLod(float value)
157   {
158     minLod = value;
159     return *this;
160   }
161
162   /**
163    * @brief Sets maximum LOD
164    *
165    * @param[in] value LOD value
166    * @return reference to this structure
167    */
168   auto& SetMaxLod(float value)
169   {
170     maxLod = value;
171     return *this;
172   }
173
174   /**
175    * @brief Sets using unnormalized coordinates
176    *
177    * @param[in] value true to use unnormalized coordinates
178    * @return reference to this structure
179    */
180   auto& SetUnnormalizeCoordinates(bool value)
181   {
182     unnormalizeCoordinates = value;
183     return *this;
184   }
185
186   /**
187    * @brief Enables sample compare operations
188    *
189    * @param[in] value true to enable
190    * @return reference to this structure
191    */
192   auto& SetCompareEnable(bool value)
193   {
194     compareEnable = value;
195     return *this;
196   }
197
198   /**
199    * @brief Sets allocation callbacks which will be used when object is created
200    * and destroyed.
201    *
202    * @param[in] value Valid reference to AllocationCallbacksStructure
203    * @return reference to this structure
204    */
205   auto& SetAllocationCallbacks(const AllocationCallbacks& value)
206   {
207     allocationCallbacks = &value;
208     return *this;
209   }
210
211   GraphicsStructureType type{GraphicsStructureType::SAMPLER_CREATE_INFO_STRUCT};
212   ExtensionCreateInfo*  nextExtension{nullptr};
213
214   SamplerAddressMode addressModeU{};
215   SamplerAddressMode addressModeV{};
216   SamplerAddressMode addressModeW{};
217   SamplerFilter      minFilter{};
218   SamplerFilter      magFilter{};
219   SamplerMipmapMode  mipMapMode{};
220   bool               anisotropyEnable{false};
221   float              maxAnisotropy{0.0f};
222   float              minLod{0.0f};
223   float              maxLod{0.0f};
224   bool               unnormalizeCoordinates{false};
225   bool               compareEnable{false};
226   CompareOp          compareOp{};
227
228   const AllocationCallbacks* allocationCallbacks{nullptr};
229 };
230
231 } // namespace Graphics
232 } // namespace Dali
233
234 #endif // DALI_GRAPHICS_SAMPLER_CREATE_INFO