1 #ifndef DALI_GRAPHICS_TEXTURE_CREATE_INFO_H
2 #define DALI_GRAPHICS_TEXTURE_CREATE_INFO_H
5 * Copyright (c) 2021 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/images/native-image-interface.h>
26 #include "graphics-texture.h"
27 #include "graphics-types.h"
34 * @brief Interface class for TextureCreateInfo types in the graphics API.
36 struct TextureCreateInfo
39 * @brief Sets pointer to the extension
41 * The pointer to the extension must be set either to nullptr
42 * or to the valid structure. The structures may create
43 * a chain. The last structure in a chain must point at
46 * @param[in] value pointer to the valid extension structure
47 * @return reference to this structure
49 auto& SetNextExtension(ExtensionCreateInfo* value)
51 nextExtension = value;
56 * @brief Sets type of the texture
58 * @param[in] value type of the texture
59 * @return reference to this structure
61 auto& SetTextureType(TextureType value)
68 * @brief Sets size of the texture
70 * @param[in] value size of the texture
71 * @return reference to this structure
73 auto& SetSize(Extent2D value)
80 * @brief Sets the texture format
82 * Not all texture formats are supported, some are emulated.
84 * @param[in] value valid texture format
85 * @return reference to this structure
87 auto& SetFormat(Format value)
94 * @brief Sets mipmap state
96 * @param[in] value The mipmap state flag
97 * @return reference to this structure
99 auto& SetMipMapFlag(TextureMipMapFlag value)
106 * @brief Sets pointer to the data
108 * The data of texture can be uploaded upon texture creation.
110 * @param[in] value pointer to valid data
111 * @return reference to this structure
113 auto& SetData(void* value)
120 * @brief Sets size of the data
122 * @param[in] value size of data in bytes
123 * @return reference to this structure
125 auto& SetDataSize(uint32_t value)
132 * @brief Sets texture data layout
134 * By choosing LINEAR layout the texture can be accessed
135 * directly via mapped memory. This may mean allocating
136 * extra staging buffer if necessary (layout may be emulated).
138 * @param[in] value texture layout
139 * @return reference to this structure
141 auto& SetLayout(TextureLayout value)
148 * @brief Sets texture usage flags
150 * The usage flags may affect the way the texture is
151 * allocated and stored in the memory. It may also affect
152 * the way how data is writen/read.
154 * @param[in] value Flags of usage
155 * @return reference to this structure
157 auto& SetUsageFlags(TextureUsageFlags value)
164 * @brief Sets native image interface pointer
166 * @param[in] value valid native image interface pointer
167 * @return reference to this structure
169 auto& SetNativeImage(NativeImageInterfacePtr value)
171 nativeImagePtr = value;
176 * @brief Sets allocation callbacks which will be used when object is created
179 * @param[in] value Valid reference to AllocationCallbacksStructure
180 * @return reference to this structure
182 auto& SetAllocationCallbacks(const AllocationCallbacks& value)
184 allocationCallbacks = &value;
188 GraphicsStructureType type{GraphicsStructureType::TEXTURE_CREATE_INFO_STRUCT};
189 ExtensionCreateInfo* nextExtension{nullptr};
191 TextureType textureType{};
194 TextureMipMapFlag mipMapFlag{};
195 TextureLayout layout{};
196 TextureUsageFlags usageFlags{};
198 uint32_t dataSize{0u};
199 NativeImageInterfacePtr nativeImagePtr{};
201 const AllocationCallbacks* allocationCallbacks{nullptr};
204 } // namespace Graphics
207 #endif // DALI_GRAPHICS_API_TEXTURE_CREATE_INFO_H