1#![allow(dead_code)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6#![allow(rustdoc::broken_intra_doc_links)]
7use vulkanalia::vk::*;
8
9#[repr(i32)]
10#[doc = "Flags for created #VmaAllocator."]
11#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
12pub enum VmaAllocatorCreateFlagBits {
13 #[doc = "Allocator and all objects created from it will not be synchronized internally, so you must guarantee they are used from only one thread at a time or synchronized externally by you.\n\nUsing this flag may increase performance because internal mutexes are not used."]
14 EXTERNALLY_SYNCHRONIZED_BIT = 1,
15 #[doc = "Enables usage of VK_KHR_dedicated_allocation extension.\n\nThe flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.\nWhen it is `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.\n\nUsing this extension will automatically allocate dedicated blocks of memory for\nsome buffers and images instead of suballocating place for them out of bigger\nmemory blocks (as if you explicitly used #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT\nflag) when it is recommended by the driver. It may improve performance on some\nGPUs.\n\nYou may set this flag only if you found out that following device extensions are\nsupported, you enabled them while creating Vulkan device passed as\nVmaAllocatorCreateInfo::device, and you want them to be used internally by this\nlibrary:\n\n- VK_KHR_get_memory_requirements2 (device extension)\n- VK_KHR_dedicated_allocation (device extension)\n\nWhen this flag is set, you can experience following warnings reported by Vulkan\nvalidation layer. You can ignore them.\n\n> vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer."]
16 KHR_DEDICATED_ALLOCATION_BIT = 2,
17 #[doc = "Enables usage of VK_KHR_bind_memory2 extension.\n\nThe flag works only if VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_0`.\nWhen it is `VK_API_VERSION_1_1`, the flag is ignored because the extension has been promoted to Vulkan 1.1.\n\nYou may set this flag only if you found out that this device extension is supported,\nyou enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,\nand you want it to be used internally by this library.\n\nThe extension provides functions `vkBindBufferMemory2KHR` and `vkBindImageMemory2KHR`,\nwhich allow to pass a chain of `pNext` structures while binding.\nThis flag is required if you use `pNext` parameter in vmaBindBufferMemory2() or vmaBindImageMemory2()."]
18 KHR_BIND_MEMORY2_BIT = 4,
19 #[doc = "Enables usage of VK_EXT_memory_budget extension.\n\nYou may set this flag only if you found out that this device extension is supported,\nyou enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,\nand you want it to be used internally by this library, along with another instance extension\nVK_KHR_get_physical_device_properties2, which is required by it (or Vulkan 1.1, where this extension is promoted).\n\nThe extension provides query for current memory usage and budget, which will probably\nbe more accurate than an estimation used by the library otherwise."]
20 EXT_MEMORY_BUDGET_BIT = 8,
21 #[doc = "Enables usage of VK_AMD_device_coherent_memory extension.\n\nYou may set this flag only if you:\n\n- found out that this device extension is supported and enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,\n- checked that `VkPhysicalDeviceCoherentMemoryFeaturesAMD::deviceCoherentMemory` is true and set it while creating the Vulkan device,\n- want it to be used internally by this library.\n\nThe extension and accompanying device feature provide access to memory types with\n`VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD` and `VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD` flags.\nThey are useful mostly for writing breadcrumb markers - a common method for debugging GPU crash/hang/TDR.\n\nWhen the extension is not enabled, such memory types are still enumerated, but their usage is illegal.\nTo protect from this error, if you don't create the allocator with this flag, it will refuse to allocate any memory or create a custom pool in such memory type,\nreturning `VK_ERROR_FEATURE_NOT_PRESENT`."]
22 AMD_DEVICE_COHERENT_MEMORY_BIT = 16,
23 #[doc = "Enables usage of \"buffer device address\" feature, which allows you to use function\n`vkGetBufferDeviceAddress*` to get raw GPU pointer to a buffer and pass it for usage inside a shader.\n\nYou may set this flag only if you:\n\n1. (For Vulkan version < 1.2) Found as available and enabled device extension\nVK_KHR_buffer_device_address.\nThis extension is promoted to core Vulkan 1.2.\n2. Found as available and enabled device feature `VkPhysicalDeviceBufferDeviceAddressFeatures::bufferDeviceAddress`.\n\nWhen this flag is set, you can create buffers with `VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT` using VMA.\nThe library automatically adds `VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT` to\nallocated memory blocks wherever it might be needed.\n\nFor more information, see documentation chapter enabling_buffer_device_address."]
24 BUFFER_DEVICE_ADDRESS_BIT = 32,
25 #[doc = "Enables usage of VK_EXT_memory_priority extension in the library.\n\nYou may set this flag only if you found available and enabled this device extension,\nalong with `VkPhysicalDeviceMemoryPriorityFeaturesEXT::memoryPriority == VK_TRUE`,\nwhile creating Vulkan device passed as VmaAllocatorCreateInfo::device.\n\nWhen this flag is used, VmaAllocationCreateInfo::priority and VmaPoolCreateInfo::priority\nare used to set priorities of allocated Vulkan memory. Without it, these variables are ignored.\n\nA priority must be a floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations.\nLarger values are higher priority. The granularity of the priorities is implementation-dependent.\nIt is automatically passed to every call to `vkAllocateMemory` done by the library using structure `VkMemoryPriorityAllocateInfoEXT`.\nThe value to be used for default priority is 0.5.\nFor more details, see the documentation of the VK_EXT_memory_priority extension."]
26 EXT_MEMORY_PRIORITY_BIT = 64,
27 #[doc = "Enables usage of VK_KHR_maintenance4 extension in the library.\n\nYou may set this flag only if you found available and enabled this device extension,\nwhile creating Vulkan device passed as VmaAllocatorCreateInfo::device."]
28 KHR_MAINTENANCE4_BIT = 128,
29 #[doc = "Enables usage of VK_KHR_maintenance5 extension in the library.\n\nYou should set this flag if you found available and enabled this device extension,\nwhile creating Vulkan device passed as VmaAllocatorCreateInfo::device."]
30 KHR_MAINTENANCE5_BIT = 256,
31 #[doc = "Enables usage of VK_KHR_maintenance5 extension in the library.\n\nYou should set this flag if you found available and enabled this device extension,\nwhile creating Vulkan device passed as VmaAllocatorCreateInfo::device."]
32 MAX_ENUM = 2147483647,
33}
34#[doc = "See #VmaAllocatorCreateFlagBits."]
35pub type VmaAllocatorCreateFlags = Flags;
36#[repr(i32)]
37#[doc = "Intended usage of the allocated memory."]
38#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
39pub enum VmaMemoryUsage {
40 #[doc = "No intended memory usage specified.\nUse other members of VmaAllocationCreateInfo to specify your requirements."]
41 UNKNOWN = 0,
42 #[doc = "> **Deprecated** Obsolete, preserved for backward compatibility.\nPrefers `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`."]
43 GPU_ONLY = 1,
44 #[doc = "> **Deprecated** Obsolete, preserved for backward compatibility.\nGuarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` and `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT`."]
45 CPU_ONLY = 2,
46 #[doc = "> **Deprecated** Obsolete, preserved for backward compatibility.\nGuarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`, prefers `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`."]
47 CPU_TO_GPU = 3,
48 #[doc = "> **Deprecated** Obsolete, preserved for backward compatibility.\nGuarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`, prefers `VK_MEMORY_PROPERTY_HOST_CACHED_BIT`."]
49 GPU_TO_CPU = 4,
50 #[doc = "> **Deprecated** Obsolete, preserved for backward compatibility.\nPrefers not `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`."]
51 CPU_COPY = 5,
52 #[doc = "Lazily allocated GPU memory having `VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT`.\nExists mostly on mobile platforms. Using it on desktop PC or other GPUs with no such memory type present will fail the allocation.\n\nUsage: Memory for transient attachment images (color attachments, depth attachments etc.), created with `VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT`.\n\nAllocations with this usage are always created as dedicated - it implies #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT."]
53 GPU_LAZILY_ALLOCATED = 6,
54 #[doc = "Selects best memory type automatically.\nThis flag is recommended for most common use cases.\n\nWhen using this flag, if you want to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT),\nyou must pass one of the flags: #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT\nin VmaAllocationCreateInfo::flags.\n\nIt can be used only with functions that let the library know `VkBufferCreateInfo` or `VkImageCreateInfo`, e.g.\nvmaCreateBuffer(), vmaCreateImage(), vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo()\nand not with generic memory allocation functions."]
55 AUTO = 7,
56 #[doc = "Selects best memory type automatically with preference for GPU (device) memory.\n\nWhen using this flag, if you want to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT),\nyou must pass one of the flags: #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT\nin VmaAllocationCreateInfo::flags.\n\nIt can be used only with functions that let the library know `VkBufferCreateInfo` or `VkImageCreateInfo`, e.g.\nvmaCreateBuffer(), vmaCreateImage(), vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo()\nand not with generic memory allocation functions."]
57 AUTO_PREFER_DEVICE = 8,
58 #[doc = "Selects best memory type automatically with preference for CPU (host) memory.\n\nWhen using this flag, if you want to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT),\nyou must pass one of the flags: #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT\nin VmaAllocationCreateInfo::flags.\n\nIt can be used only with functions that let the library know `VkBufferCreateInfo` or `VkImageCreateInfo`, e.g.\nvmaCreateBuffer(), vmaCreateImage(), vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo()\nand not with generic memory allocation functions."]
59 AUTO_PREFER_HOST = 9,
60 #[doc = "Selects best memory type automatically with preference for CPU (host) memory.\n\nWhen using this flag, if you want to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT),\nyou must pass one of the flags: #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT\nin VmaAllocationCreateInfo::flags.\n\nIt can be used only with functions that let the library know `VkBufferCreateInfo` or `VkImageCreateInfo`, e.g.\nvmaCreateBuffer(), vmaCreateImage(), vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo()\nand not with generic memory allocation functions."]
61 MAX_ENUM = 2147483647,
62}
63impl VmaAllocationCreateFlagBits {
64 pub const STRATEGY_BEST_FIT_BIT: VmaAllocationCreateFlagBits =
65 VmaAllocationCreateFlagBits::STRATEGY_MIN_MEMORY_BIT;
66}
67impl VmaAllocationCreateFlagBits {
68 pub const STRATEGY_FIRST_FIT_BIT: VmaAllocationCreateFlagBits =
69 VmaAllocationCreateFlagBits::STRATEGY_MIN_TIME_BIT;
70}
71#[repr(i32)]
72#[doc = "Flags to be passed as VmaAllocationCreateInfo::flags."]
73#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
74pub enum VmaAllocationCreateFlagBits {
75 #[doc = "Set this flag if the allocation should have its own memory block.\n\nUse it for special, big resources, like fullscreen images used as attachments.\n\nIf you use this flag while creating a buffer or an image, `VkMemoryDedicatedAllocateInfo`\nstructure is applied if possible."]
76 DEDICATED_MEMORY_BIT = 1,
77 #[doc = "Set this flag to only try to allocate from existing `VkDeviceMemory` blocks and never create new such block.\n\nIf new allocation cannot be placed in any of the existing blocks, allocation\nfails with `VK_ERROR_OUT_OF_DEVICE_MEMORY` error.\n\nYou should not use #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT and\n#VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT at the same time. It makes no sense."]
78 NEVER_ALLOCATE_BIT = 2,
79 #[doc = "Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.\n\nPointer to mapped memory will be returned through VmaAllocationInfo::pMappedData.\n\nIt is valid to use this flag for allocation made from memory type that is not\n`HOST_VISIBLE`. This flag is then ignored and memory is not mapped. This is\nuseful if you need an allocation that is efficient to use on GPU\n(`DEVICE_LOCAL`) and still want to map it directly if possible on platforms that\nsupport it (e.g. Intel GPU)."]
80 MAPPED_BIT = 4,
81 #[doc = "> **Deprecated** Preserved for backward compatibility. Consider using vmaSetAllocationName() instead.\n\nSet this flag to treat VmaAllocationCreateInfo::pUserData as pointer to a\nnull-terminated string. Instead of copying pointer value, a local copy of the\nstring is made and stored in allocation's `pName`. The string is automatically\nfreed together with the allocation. It is also used in vmaBuildStatsString()."]
82 USER_DATA_COPY_STRING_BIT = 32,
83 #[doc = "Allocation will be created from upper stack in a double stack pool.\n\nThis flag is only allowed for custom pools created with #VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT flag."]
84 UPPER_ADDRESS_BIT = 64,
85 #[doc = "Create both buffer/image and allocation, but don't bind them together.\nIt is useful when you want to bind yourself to do some more advanced binding, e.g. using some extensions.\nThe flag is meaningful only with functions that bind by default: vmaCreateBuffer(), vmaCreateImage().\nOtherwise it is ignored.\n\nIf you want to make sure the new buffer/image is not tied to the new memory allocation\nthrough `VkMemoryDedicatedAllocateInfoKHR` structure in case the allocation ends up in its own memory block,\nuse also flag #VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT."]
86 DONT_BIND_BIT = 128,
87 #[doc = "Create allocation only if additional device memory required for it, if any, won't exceed\nmemory budget. Otherwise return `VK_ERROR_OUT_OF_DEVICE_MEMORY`."]
88 WITHIN_BUDGET_BIT = 256,
89 #[doc = "Set this flag if the allocated memory will have aliasing resources.\n\nUsage of this flag prevents supplying `VkMemoryDedicatedAllocateInfoKHR` when #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT is specified.\nOtherwise created dedicated memory will not be suitable for aliasing resources, resulting in Vulkan Validation Layer errors."]
90 CAN_ALIAS_BIT = 512,
91 #[doc = "Requests possibility to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT).\n\n- If you use #VMA_MEMORY_USAGE_AUTO or other `VMA_MEMORY_USAGE_AUTO*` value,\nyou must use this flag to be able to map the allocation. Otherwise, mapping is incorrect.\n- If you use other value of #VmaMemoryUsage, this flag is ignored and mapping is always possible in memory types that are `HOST_VISIBLE`.\nThis includes allocations created in custom_memory_pools.\n\nDeclares that mapped memory will only be written sequentially, e.g. using `memcpy()` or a loop writing number-by-number,\nnever read or accessed randomly, so a memory type can be selected that is uncached and write-combined.\n\nViolating this declaration may work correctly, but will likely be very slow.\nWatch out for implicit reads introduced by doing e.g. `pMappedData[i] += x;`\nBetter prepare your data in a local variable and `memcpy()` it to the mapped pointer all at once."]
92 HOST_ACCESS_SEQUENTIAL_WRITE_BIT = 1024,
93 #[doc = "Requests possibility to map the allocation (using vmaMapMemory() or #VMA_ALLOCATION_CREATE_MAPPED_BIT).\n\n- If you use #VMA_MEMORY_USAGE_AUTO or other `VMA_MEMORY_USAGE_AUTO*` value,\nyou must use this flag to be able to map the allocation. Otherwise, mapping is incorrect.\n- If you use other value of #VmaMemoryUsage, this flag is ignored and mapping is always possible in memory types that are `HOST_VISIBLE`.\nThis includes allocations created in custom_memory_pools.\n\nDeclares that mapped memory can be read, written, and accessed in random order,\nso a `HOST_CACHED` memory type is preferred."]
94 HOST_ACCESS_RANDOM_BIT = 2048,
95 #[doc = "Together with #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,\nit says that despite request for host access, a not-`HOST_VISIBLE` memory type can be selected\nif it may improve performance.\n\nBy using this flag, you declare that you will check if the allocation ended up in a `HOST_VISIBLE` memory type\n(e.g. using vmaGetAllocationMemoryProperties()) and if not, you will create some \"staging\" buffer and\nissue an explicit transfer to write/read your data.\nTo prepare for this possibility, don't forget to add appropriate flags like\n`VK_BUFFER_USAGE_TRANSFER_DST_BIT`, `VK_BUFFER_USAGE_TRANSFER_SRC_BIT` to the parameters of created buffer or image."]
96 HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT = 4096,
97 #[doc = "Allocation strategy that chooses smallest possible free range for the allocation\nto minimize memory usage and fragmentation, possibly at the expense of allocation time."]
98 STRATEGY_MIN_MEMORY_BIT = 65536,
99 #[doc = "Allocation strategy that chooses first suitable free range for the allocation -\nnot necessarily in terms of the smallest offset but the one that is easiest and fastest to find\nto minimize allocation time, possibly at the expense of allocation quality."]
100 STRATEGY_MIN_TIME_BIT = 131072,
101 #[doc = "Allocation strategy that chooses always the lowest offset in available space.\nThis is not the most efficient strategy but achieves highly packed data.\nUsed internally by defragmentation, not recommended in typical usage."]
102 STRATEGY_MIN_OFFSET_BIT = 262144,
103 #[doc = "A bit mask to extract only `STRATEGY` bits from entire set of flags."]
104 STRATEGY_MASK = 458752,
105 #[doc = "A bit mask to extract only `STRATEGY` bits from entire set of flags."]
106 MAX_ENUM = 2147483647,
107}
108#[doc = "See #VmaAllocationCreateFlagBits."]
109pub type VmaAllocationCreateFlags = Flags;
110impl VmaPoolCreateFlagBits {
111 pub const ALGORITHM_MASK: VmaPoolCreateFlagBits = VmaPoolCreateFlagBits::LINEAR_ALGORITHM_BIT;
112}
113#[repr(i32)]
114#[doc = "Flags to be passed as VmaPoolCreateInfo::flags."]
115#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
116pub enum VmaPoolCreateFlagBits {
117 #[doc = "Use this flag if you always allocate only buffers and linear images or only optimal images out of this pool and so Buffer-Image Granularity can be ignored.\n\nThis is an optional optimization flag.\n\nIf you always allocate using vmaCreateBuffer(), vmaCreateImage(),\nvmaAllocateMemoryForBuffer(), then you don't need to use it because allocator\nknows exact type of your allocations so it can handle Buffer-Image Granularity\nin the optimal way.\n\nIf you also allocate using vmaAllocateMemoryForImage() or vmaAllocateMemory(),\nexact type of such allocations is not known, so allocator must be conservative\nin handling Buffer-Image Granularity, which can lead to suboptimal allocation\n(wasted memory). In that case, if you can make sure you always allocate only\nbuffers and linear images or only optimal images out of this pool, use this flag\nto make allocator disregard Buffer-Image Granularity and so make allocations\nfaster and more optimal."]
118 IGNORE_BUFFER_IMAGE_GRANULARITY_BIT = 2,
119 #[doc = "Enables alternative, linear allocation algorithm in this pool.\n\nSpecify this flag to enable linear allocation algorithm, which always creates\nnew allocations after last one and doesn't reuse space from allocations freed in\nbetween. It trades memory consumption for simplified algorithm and data\nstructure, which has better performance and uses less memory for metadata.\n\nBy using this flag, you can achieve behavior of free-at-once, stack,\nring buffer, and double stack.\nFor details, see documentation chapter linear_algorithm."]
120 LINEAR_ALGORITHM_BIT = 4,
121 #[doc = "Bit mask to extract only `ALGORITHM` bits from entire set of flags."]
122 MAX_ENUM = 2147483647,
123}
124#[doc = "Flags to be passed as VmaPoolCreateInfo::flags. See #VmaPoolCreateFlagBits."]
125pub type VmaPoolCreateFlags = Flags;
126#[repr(i32)]
127#[doc = "Flags to be passed as VmaDefragmentationInfo::flags."]
128#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
129pub enum VmaDefragmentationFlagBits {
130 ALGORITHM_FAST_BIT = 1,
131 ALGORITHM_BALANCED_BIT = 2,
132 ALGORITHM_FULL_BIT = 4,
133 #[doc = "Use the most roboust algorithm at the cost of time to compute and number of copies to make.\nOnly available when bufferImageGranularity is greater than 1, since it aims to reduce\nalignment issues between different types of resources.\nOtherwise falls back to same behavior as #VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FULL_BIT."]
134 ALGORITHM_EXTENSIVE_BIT = 8,
135 #[doc = "A bit mask to extract only `ALGORITHM` bits from entire set of flags."]
136 ALGORITHM_MASK = 15,
137 #[doc = "A bit mask to extract only `ALGORITHM` bits from entire set of flags."]
138 MAX_ENUM = 2147483647,
139}
140#[doc = "See #VmaDefragmentationFlagBits."]
141pub type VmaDefragmentationFlags = Flags;
142#[repr(i32)]
143#[doc = "Operation performed on single defragmentation move. See structure #VmaDefragmentationMove."]
144#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
145pub enum VmaDefragmentationMoveOperation {
146 #[doc = "Buffer/image has been recreated at `dstTmpAllocation`, data has been copied, old buffer/image has been destroyed. `srcAllocation` should be changed to point to the new place. This is the default value set by vmaBeginDefragmentationPass()."]
147 COPY = 0,
148 #[doc = "Set this value if you cannot move the allocation. New place reserved at `dstTmpAllocation` will be freed. `srcAllocation` will remain unchanged."]
149 IGNORE = 1,
150 #[doc = "Set this value if you decide to abandon the allocation and you destroyed the buffer/image. New place reserved at `dstTmpAllocation` will be freed, along with `srcAllocation`, which will be destroyed."]
151 DESTROY = 2,
152}
153impl VmaVirtualBlockCreateFlagBits {
154 pub const ALGORITHM_MASK: VmaVirtualBlockCreateFlagBits =
155 VmaVirtualBlockCreateFlagBits::LINEAR_ALGORITHM_BIT;
156}
157#[repr(i32)]
158#[doc = "Flags to be passed as VmaVirtualBlockCreateInfo::flags."]
159#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
160pub enum VmaVirtualBlockCreateFlagBits {
161 #[doc = "Enables alternative, linear allocation algorithm in this virtual block.\n\nSpecify this flag to enable linear allocation algorithm, which always creates\nnew allocations after last one and doesn't reuse space from allocations freed in\nbetween. It trades memory consumption for simplified algorithm and data\nstructure, which has better performance and uses less memory for metadata.\n\nBy using this flag, you can achieve behavior of free-at-once, stack,\nring buffer, and double stack.\nFor details, see documentation chapter linear_algorithm."]
162 LINEAR_ALGORITHM_BIT = 1,
163 #[doc = "Bit mask to extract only `ALGORITHM` bits from entire set of flags."]
164 MAX_ENUM = 2147483647,
165}
166#[doc = "Flags to be passed as VmaVirtualBlockCreateInfo::flags. See #VmaVirtualBlockCreateFlagBits."]
167pub type VmaVirtualBlockCreateFlags = Flags;
168#[repr(i32)]
169#[doc = "Flags to be passed as VmaVirtualAllocationCreateInfo::flags."]
170#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
171pub enum VmaVirtualAllocationCreateFlagBits {
172 #[doc = "Allocation will be created from upper stack in a double stack pool.\n\nThis flag is only allowed for virtual blocks created with #VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT flag."]
173 UPPER_ADDRESS_BIT = 64,
174 #[doc = "Allocation strategy that tries to minimize memory usage."]
175 STRATEGY_MIN_MEMORY_BIT = 65536,
176 #[doc = "Allocation strategy that tries to minimize allocation time."]
177 STRATEGY_MIN_TIME_BIT = 131072,
178 #[doc = "Allocation strategy that chooses always the lowest offset in available space.\nThis is not the most efficient strategy but achieves highly packed data."]
179 STRATEGY_MIN_OFFSET_BIT = 262144,
180 #[doc = "A bit mask to extract only `STRATEGY` bits from entire set of flags.\n\nThese strategy flags are binary compatible with equivalent flags in #VmaAllocationCreateFlagBits."]
181 STRATEGY_MASK = 458752,
182 #[doc = "A bit mask to extract only `STRATEGY` bits from entire set of flags.\n\nThese strategy flags are binary compatible with equivalent flags in #VmaAllocationCreateFlagBits."]
183 MAX_ENUM = 2147483647,
184}
185#[doc = "Flags to be passed as VmaVirtualAllocationCreateInfo::flags. See #VmaVirtualAllocationCreateFlagBits."]
186pub type VmaVirtualAllocationCreateFlags = Flags;
187#[repr(C)]
188#[derive(Debug, Copy, Clone)]
189pub struct VmaAllocator_T {
190 _unused: [u8; 0],
191}
192pub type VmaAllocator = *mut VmaAllocator_T;
193#[repr(C)]
194#[derive(Debug, Copy, Clone)]
195pub struct VmaPool_T {
196 _unused: [u8; 0],
197}
198pub type VmaPool = *mut VmaPool_T;
199#[repr(C)]
200#[derive(Debug, Copy, Clone)]
201pub struct VmaAllocation_T {
202 _unused: [u8; 0],
203}
204pub type VmaAllocation = *mut VmaAllocation_T;
205#[repr(C)]
206#[derive(Debug, Copy, Clone)]
207pub struct VmaDefragmentationContext_T {
208 _unused: [u8; 0],
209}
210pub type VmaDefragmentationContext = *mut VmaDefragmentationContext_T;
211#[repr(C)]
212#[derive(Debug, Copy, Clone)]
213pub struct VmaVirtualAllocation_T {
214 _unused: [u8; 0],
215}
216pub type VmaVirtualAllocation = *mut VmaVirtualAllocation_T;
217#[repr(C)]
218#[derive(Debug, Copy, Clone)]
219pub struct VmaVirtualBlock_T {
220 _unused: [u8; 0],
221}
222pub type VmaVirtualBlock = *mut VmaVirtualBlock_T;
223#[doc = "Callback function called after successful vkAllocateMemory."]
224pub type PFN_vmaAllocateDeviceMemoryFunction = ::core::option::Option<
225 unsafe extern "C" fn(
226 allocator: VmaAllocator,
227 memoryType: u32,
228 memory: DeviceMemory,
229 size: DeviceSize,
230 pUserData: *mut ::core::ffi::c_void,
231 ),
232>;
233#[doc = "Callback function called before vkFreeMemory."]
234pub type PFN_vmaFreeDeviceMemoryFunction = ::core::option::Option<
235 unsafe extern "C" fn(
236 allocator: VmaAllocator,
237 memoryType: u32,
238 memory: DeviceMemory,
239 size: DeviceSize,
240 pUserData: *mut ::core::ffi::c_void,
241 ),
242>;
243#[doc = "Set of callbacks that the library will call for `vkAllocateMemory` and `vkFreeMemory`.\n\nProvided for informative purpose, e.g. to gather statistics about number of\nallocations or total amount of memory allocated in Vulkan.\n\nUsed in VmaAllocatorCreateInfo::pDeviceMemoryCallbacks."]
244#[repr(C)]
245#[derive(Debug, Copy, Clone)]
246pub struct VmaDeviceMemoryCallbacks {
247 #[doc = "Optional, can be null."]
248 pub pfnAllocate: PFN_vmaAllocateDeviceMemoryFunction,
249 #[doc = "Optional, can be null."]
250 pub pfnFree: PFN_vmaFreeDeviceMemoryFunction,
251 #[doc = "Optional, can be null."]
252 pub pUserData: *mut ::core::ffi::c_void,
253}
254#[doc = "Pointers to some Vulkan functions - a subset used by the library.\n\nUsed in VmaAllocatorCreateInfo::pVulkanFunctions."]
255#[repr(C)]
256pub struct VmaVulkanFunctions {
257 #[doc = "Required when using VMA_DYNAMIC_VULKAN_FUNCTIONS."]
258 pub vkGetInstanceProcAddr: PFN_vkGetInstanceProcAddr,
259 #[doc = "Required when using VMA_DYNAMIC_VULKAN_FUNCTIONS."]
260 pub vkGetDeviceProcAddr: PFN_vkGetDeviceProcAddr,
261 pub vkGetPhysicalDeviceProperties: PFN_vkGetPhysicalDeviceProperties,
262 pub vkGetPhysicalDeviceMemoryProperties: PFN_vkGetPhysicalDeviceMemoryProperties,
263 pub vkAllocateMemory: PFN_vkAllocateMemory,
264 pub vkFreeMemory: PFN_vkFreeMemory,
265 pub vkMapMemory: PFN_vkMapMemory,
266 pub vkUnmapMemory: PFN_vkUnmapMemory,
267 pub vkFlushMappedMemoryRanges: PFN_vkFlushMappedMemoryRanges,
268 pub vkInvalidateMappedMemoryRanges: PFN_vkInvalidateMappedMemoryRanges,
269 pub vkBindBufferMemory: PFN_vkBindBufferMemory,
270 pub vkBindImageMemory: PFN_vkBindImageMemory,
271 pub vkGetBufferMemoryRequirements: PFN_vkGetBufferMemoryRequirements,
272 pub vkGetImageMemoryRequirements: PFN_vkGetImageMemoryRequirements,
273 pub vkCreateBuffer: PFN_vkCreateBuffer,
274 pub vkDestroyBuffer: PFN_vkDestroyBuffer,
275 pub vkCreateImage: PFN_vkCreateImage,
276 pub vkDestroyImage: PFN_vkDestroyImage,
277 pub vkCmdCopyBuffer: PFN_vkCmdCopyBuffer,
278 #[doc = "Fetch \"vkGetBufferMemoryRequirements2\" on Vulkan >= 1.1, fetch \"vkGetBufferMemoryRequirements2KHR\" when using VK_KHR_dedicated_allocation extension."]
279 pub vkGetBufferMemoryRequirements2KHR: PFN_vkGetBufferMemoryRequirements2KHR,
280 #[doc = "Fetch \"vkGetImageMemoryRequirements2\" on Vulkan >= 1.1, fetch \"vkGetImageMemoryRequirements2KHR\" when using VK_KHR_dedicated_allocation extension."]
281 pub vkGetImageMemoryRequirements2KHR: PFN_vkGetImageMemoryRequirements2KHR,
282 #[doc = "Fetch \"vkBindBufferMemory2\" on Vulkan >= 1.1, fetch \"vkBindBufferMemory2KHR\" when using VK_KHR_bind_memory2 extension."]
283 pub vkBindBufferMemory2KHR: PFN_vkBindBufferMemory2KHR,
284 #[doc = "Fetch \"vkBindImageMemory2\" on Vulkan >= 1.1, fetch \"vkBindImageMemory2KHR\" when using VK_KHR_bind_memory2 extension."]
285 pub vkBindImageMemory2KHR: PFN_vkBindImageMemory2KHR,
286 #[doc = "Fetch from \"vkGetPhysicalDeviceMemoryProperties2\" on Vulkan >= 1.1, but you can also fetch it from \"vkGetPhysicalDeviceMemoryProperties2KHR\" if you enabled extension VK_KHR_get_physical_device_properties2."]
287 pub vkGetPhysicalDeviceMemoryProperties2KHR: PFN_vkGetPhysicalDeviceMemoryProperties2KHR,
288 #[doc = "Fetch from \"vkGetDeviceBufferMemoryRequirements\" on Vulkan >= 1.3, but you can also fetch it from \"vkGetDeviceBufferMemoryRequirementsKHR\" if you enabled extension VK_KHR_maintenance4."]
289 pub vkGetDeviceBufferMemoryRequirements: PFN_vkGetDeviceBufferMemoryRequirementsKHR,
290 #[doc = "Fetch from \"vkGetDeviceImageMemoryRequirements\" on Vulkan >= 1.3, but you can also fetch it from \"vkGetDeviceImageMemoryRequirementsKHR\" if you enabled extension VK_KHR_maintenance4."]
291 pub vkGetDeviceImageMemoryRequirements: PFN_vkGetDeviceImageMemoryRequirementsKHR,
292}
293#[doc = "Description of a Allocator to be created."]
294#[repr(C)]
295pub struct VmaAllocatorCreateInfo {
296 #[doc = "Flags for created allocator. Use #VmaAllocatorCreateFlagBits enum."]
297 pub flags: VmaAllocatorCreateFlags,
298 #[doc = "Vulkan physical device.\n** It must be valid throughout whole lifetime of created allocator. */"]
299 pub physicalDevice: PhysicalDevice,
300 #[doc = "Vulkan device.\n** It must be valid throughout whole lifetime of created allocator. */"]
301 pub device: Device,
302 #[doc = "Preferred size of a single `VkDeviceMemory` block to be allocated from large heaps > 1 GiB. Optional.\n** Set to 0 to use default, which is currently 256 MiB. */"]
303 pub preferredLargeHeapBlockSize: DeviceSize,
304 #[doc = "Custom CPU memory allocation callbacks. Optional.\n** Optional, can be null. When specified, will also be used for all CPU-side memory allocations. */"]
305 pub pAllocationCallbacks: *const AllocationCallbacks,
306 #[doc = "Informative callbacks for `vkAllocateMemory`, `vkFreeMemory`. Optional.\n** Optional, can be null. */"]
307 pub pDeviceMemoryCallbacks: *const VmaDeviceMemoryCallbacks,
308 #[doc = "Either null or a pointer to an array of limits on maximum number of bytes that can be allocated out of particular Vulkan memory heap.\n\nIf not NULL, it must be a pointer to an array of\n`VkPhysicalDeviceMemoryProperties::memoryHeapCount` elements, defining limit on\nmaximum number of bytes that can be allocated out of particular Vulkan memory\nheap.\n\nAny of the elements may be equal to `VK_WHOLE_SIZE`, which means no limit on that\nheap. This is also the default in case of `pHeapSizeLimit` = NULL.\n\nIf there is a limit defined for a heap:\n\n- If user tries to allocate more memory from that heap using this allocator,\nthe allocation fails with `VK_ERROR_OUT_OF_DEVICE_MEMORY`.\n- If the limit is smaller than heap size reported in `VkMemoryHeap::size`, the\nvalue of this limit will be reported instead when using vmaGetMemoryProperties().\n\nWarning! Using this feature may not be equivalent to installing a GPU with\nsmaller amount of memory, because graphics driver doesn't necessary fail new\nallocations with `VK_ERROR_OUT_OF_DEVICE_MEMORY` result when memory capacity is\nexceeded. It may return success and just silently migrate some device memory\nblocks to system RAM. This driver behavior can also be controlled using\nVK_AMD_memory_overallocation_behavior extension."]
309 pub pHeapSizeLimit: *const DeviceSize,
310 #[doc = "Pointers to Vulkan functions. Can be null.\n\nFor details see [Pointers to Vulkan functions](config_Vulkan_functions)."]
311 pub pVulkanFunctions: *const VmaVulkanFunctions,
312 #[doc = "Handle to Vulkan instance object.\n\nStarting from version 3.0.0 this member is no longer optional, it must be set!"]
313 pub instance: Instance,
314 #[doc = "Optional. Vulkan version that the application uses.\n\nIt must be a value in the format as created by macro `VK_MAKE_VERSION` or a constant like: `VK_API_VERSION_1_1`, `VK_API_VERSION_1_0`.\nThe patch version number specified is ignored. Only the major and minor versions are considered.\nOnly versions 1.0, 1.1, 1.2, 1.3 are supported by the current implementation.\nLeaving it initialized to zero is equivalent to `VK_API_VERSION_1_0`.\nIt must match the Vulkan version used by the application and supported on the selected physical device,\nso it must be no higher than `VkApplicationInfo::apiVersion` passed to `vkCreateInstance`\nand no higher than `VkPhysicalDeviceProperties::apiVersion` found on the physical device used."]
315 pub vulkanApiVersion: u32,
316 #[doc = "Either null or a pointer to an array of external memory handle types for each Vulkan memory type.\n\nIf not NULL, it must be a pointer to an array of `VkPhysicalDeviceMemoryProperties::memoryTypeCount`\nelements, defining external memory handle types of particular Vulkan memory type,\nto be passed using `VkExportMemoryAllocateInfoKHR`.\n\nAny of the elements may be equal to 0, which means not to use `VkExportMemoryAllocateInfoKHR` on this memory type.\nThis is also the default in case of `pTypeExternalMemoryHandleTypes` = NULL."]
317 pub pTypeExternalMemoryHandleTypes: *const ExternalMemoryHandleTypeFlagsKHR,
318}
319#[doc = "Information about existing #VmaAllocator object."]
320#[repr(C)]
321pub struct VmaAllocatorInfo {
322 #[doc = "Handle to Vulkan instance object.\n\nThis is the same value as has been passed through VmaAllocatorCreateInfo::instance."]
323 pub instance: Instance,
324 #[doc = "Handle to Vulkan physical device object.\n\nThis is the same value as has been passed through VmaAllocatorCreateInfo::physicalDevice."]
325 pub physicalDevice: PhysicalDevice,
326 #[doc = "Handle to Vulkan device object.\n\nThis is the same value as has been passed through VmaAllocatorCreateInfo::device."]
327 pub device: Device,
328}
329#[doc = "Calculated statistics of memory usage e.g. in a specific memory type, heap, custom pool, or total.\n\nThese are fast to calculate.\nSee functions: vmaGetHeapBudgets(), vmaGetPoolStatistics()."]
330#[repr(C)]
331#[derive(Debug)]
332pub struct VmaStatistics {
333 #[doc = "Number of `VkDeviceMemory` objects - Vulkan memory blocks allocated."]
334 pub blockCount: u32,
335 #[doc = "Number of #VmaAllocation objects allocated.\n\nDedicated allocations have their own blocks, so each one adds 1 to `allocationCount` as well as `blockCount`."]
336 pub allocationCount: u32,
337 #[doc = "Number of bytes allocated in `VkDeviceMemory` blocks.\n\n> **Note:** To avoid confusion, please be aware that what Vulkan calls an \"allocation\" - a whole `VkDeviceMemory` object\n(e.g. as in `VkPhysicalDeviceLimits::maxMemoryAllocationCount`) is called a \"block\" in VMA, while VMA calls\n\"allocation\" a #VmaAllocation object that represents a memory region sub-allocated from such block, usually for a single buffer or image."]
338 pub blockBytes: DeviceSize,
339 #[doc = "Total number of bytes occupied by all #VmaAllocation objects.\n\nAlways less or equal than `blockBytes`.\nDifference `(blockBytes - allocationBytes)` is the amount of memory allocated from Vulkan\nbut unused by any #VmaAllocation."]
340 pub allocationBytes: DeviceSize,
341}
342#[doc = "More detailed statistics than #VmaStatistics.\n\nThese are slower to calculate. Use for debugging purposes.\nSee functions: vmaCalculateStatistics(), vmaCalculatePoolStatistics().\n\nPrevious version of the statistics API provided averages, but they have been removed\nbecause they can be easily calculated as:\n\nVkDeviceSize allocationSizeAvg = detailedStats.statistics.allocationBytes / detailedStats.statistics.allocationCount;\nVkDeviceSize unusedBytes = detailedStats.statistics.blockBytes - detailedStats.statistics.allocationBytes;\nVkDeviceSize unusedRangeSizeAvg = unusedBytes / detailedStats.unusedRangeCount;\n"]
343#[repr(C)]
344#[derive(Debug)]
345pub struct VmaDetailedStatistics {
346 #[doc = "Basic statistics."]
347 pub statistics: VmaStatistics,
348 #[doc = "Number of free ranges of memory between allocations."]
349 pub unusedRangeCount: u32,
350 #[doc = "Smallest allocation size. `VK_WHOLE_SIZE` if there are 0 allocations."]
351 pub allocationSizeMin: DeviceSize,
352 #[doc = "Largest allocation size. 0 if there are 0 allocations."]
353 pub allocationSizeMax: DeviceSize,
354 #[doc = "Smallest empty range size. `VK_WHOLE_SIZE` if there are 0 empty ranges."]
355 pub unusedRangeSizeMin: DeviceSize,
356 #[doc = "Largest empty range size. 0 if there are 0 empty ranges."]
357 pub unusedRangeSizeMax: DeviceSize,
358}
359#[doc = "General statistics from current state of the Allocator -\ntotal memory usage across all memory heaps and types.\n\nThese are slower to calculate. Use for debugging purposes.\nSee function vmaCalculateStatistics()."]
360#[repr(C)]
361#[derive(Debug)]
362pub struct VmaTotalStatistics {
363 pub memoryType: [VmaDetailedStatistics; 32usize],
364 pub memoryHeap: [VmaDetailedStatistics; 16usize],
365 pub total: VmaDetailedStatistics,
366}
367#[doc = "Statistics of current memory usage and available budget for a specific memory heap.\n\nThese are fast to calculate.\nSee function vmaGetHeapBudgets()."]
368#[repr(C)]
369#[derive(Debug)]
370pub struct VmaBudget {
371 #[doc = "Statistics fetched from the library."]
372 pub statistics: VmaStatistics,
373 #[doc = "Estimated current memory usage of the program, in bytes.\n\nFetched from system using VK_EXT_memory_budget extension if enabled.\n\nIt might be different than `statistics.blockBytes` (usually higher) due to additional implicit objects\nalso occupying the memory, like swapchain, pipelines, descriptor heaps, command buffers, or\n`VkDeviceMemory` blocks allocated outside of this library, if any."]
374 pub usage: DeviceSize,
375 #[doc = "Estimated amount of memory available to the program, in bytes.\n\nFetched from system using VK_EXT_memory_budget extension if enabled.\n\nIt might be different (most probably smaller) than `VkMemoryHeap::size[heapIndex]` due to factors\nexternal to the program, decided by the operating system.\nDifference `budget - usage` is the amount of additional memory that can probably\nbe allocated without problems. Exceeding the budget may result in various problems."]
376 pub budget: DeviceSize,
377}
378#[doc = "Parameters of new #VmaAllocation.\n\nTo be used with functions like vmaCreateBuffer(), vmaCreateImage(), and many others."]
379#[repr(C)]
380pub struct VmaAllocationCreateInfo {
381 #[doc = "Use #VmaAllocationCreateFlagBits enum."]
382 pub flags: VmaAllocationCreateFlags,
383 #[doc = "Intended usage of memory.\n\nYou can leave #VMA_MEMORY_USAGE_UNKNOWN if you specify memory requirements in other way. If `pool` is not null, this member is ignored."]
384 pub usage: VmaMemoryUsage,
385 #[doc = "Flags that must be set in a Memory Type chosen for an allocation.\n\nLeave 0 if you specify memory requirements in other way. If `pool` is not null, this member is ignored."]
386 pub requiredFlags: MemoryPropertyFlags,
387 #[doc = "Flags that preferably should be set in a memory type chosen for an allocation.\n\nSet to 0 if no additional flags are preferred. If `pool` is not null, this member is ignored."]
388 pub preferredFlags: MemoryPropertyFlags,
389 #[doc = "Bitmask containing one bit set for every memory type acceptable for this allocation.\n\nValue 0 is equivalent to `UINT32_MAX` - it means any memory type is accepted if\nit meets other requirements specified by this structure, with no further\nrestrictions on memory type index. If `pool` is not null, this member is ignored."]
390 pub memoryTypeBits: u32,
391 #[doc = "Pool that this allocation should be created in.\n\nLeave `VK_NULL_HANDLE` to allocate from default pool. If not null, members:\n`usage`, `requiredFlags`, `preferredFlags`, `memoryTypeBits` are ignored."]
392 pub pool: VmaPool,
393 #[doc = "Custom general-purpose pointer that will be stored in #VmaAllocation, can be read as VmaAllocationInfo::pUserData and changed using vmaSetAllocationUserData().\n\nIf #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT is used, it must be either\nnull or pointer to a null-terminated string. The string will be then copied to\ninternal buffer, so it doesn't need to be valid after allocation call."]
394 pub pUserData: *mut ::core::ffi::c_void,
395 #[doc = "A floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations.\n\nIt is used only when #VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT flag was used during creation of the #VmaAllocator object\nand this allocation ends up as dedicated or is explicitly forced as dedicated using #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.\nOtherwise, it has the priority of a memory block where it is placed and this variable is ignored."]
396 pub priority: f32,
397}
398#[doc = "Describes parameter of created #VmaPool."]
399#[repr(C)]
400pub struct VmaPoolCreateInfo {
401 #[doc = "Vulkan memory type index to allocate this pool from."]
402 pub memoryTypeIndex: u32,
403 #[doc = "Use combination of #VmaPoolCreateFlagBits."]
404 pub flags: VmaPoolCreateFlags,
405 #[doc = "Size of a single `VkDeviceMemory` block to be allocated as part of this pool, in bytes. Optional.\n\nSpecify nonzero to set explicit, constant size of memory blocks used by this\npool.\n\nLeave 0 to use default and let the library manage block sizes automatically.\nSizes of particular blocks may vary.\nIn this case, the pool will also support dedicated allocations."]
406 pub blockSize: DeviceSize,
407 #[doc = "Minimum number of blocks to be always allocated in this pool, even if they stay empty.\n\nSet to 0 to have no preallocated blocks and allow the pool be completely empty."]
408 pub minBlockCount: usize,
409 #[doc = "Maximum number of blocks that can be allocated in this pool. Optional.\n\nSet to 0 to use default, which is `SIZE_MAX`, which means no limit.\n\nSet to same value as VmaPoolCreateInfo::minBlockCount to have fixed amount of memory allocated\nthroughout whole lifetime of this pool."]
410 pub maxBlockCount: usize,
411 #[doc = "A floating-point value between 0 and 1, indicating the priority of the allocations in this pool relative to other memory allocations.\n\nIt is used only when #VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT flag was used during creation of the #VmaAllocator object.\nOtherwise, this variable is ignored."]
412 pub priority: f32,
413 #[doc = "Additional minimum alignment to be used for all allocations created from this pool. Can be 0.\n\nLeave 0 (default) not to impose any additional alignment. If not 0, it must be a power of two.\nIt can be useful in cases where alignment returned by Vulkan by functions like `vkGetBufferMemoryRequirements` is not enough,\ne.g. when doing interop with OpenGL."]
414 pub minAllocationAlignment: DeviceSize,
415 #[doc = "Additional `pNext` chain to be attached to `VkMemoryAllocateInfo` used for every allocation made by this pool. Optional.\n\nOptional, can be null. If not null, it must point to a `pNext` chain of structures that can be attached to `VkMemoryAllocateInfo`.\nIt can be useful for special needs such as adding `VkExportMemoryAllocateInfoKHR`.\nStructures pointed by this member must remain alive and unchanged for the whole lifetime of the custom pool.\n\nPlease note that some structures, e.g. `VkMemoryPriorityAllocateInfoEXT`, `VkMemoryDedicatedAllocateInfoKHR`,\ncan be attached automatically by this library when using other, more convenient of its features."]
416 pub pMemoryAllocateNext: *mut ::core::ffi::c_void,
417}
418#[doc = "Parameters of #VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().\n\nThere is also an extended version of this structure that carries additional parameters: #VmaAllocationInfo2."]
419#[repr(C)]
420pub struct VmaAllocationInfo {
421 #[doc = "Memory type index that this allocation was allocated from.\n\nIt never changes."]
422 pub memoryType: u32,
423 #[doc = "Handle to Vulkan memory object.\n\nSame memory object can be shared by multiple allocations.\n\nIt can change after the allocation is moved during defragmentation."]
424 pub deviceMemory: DeviceMemory,
425 #[doc = "Offset in `VkDeviceMemory` object to the beginning of this allocation, in bytes. `(deviceMemory, offset)` pair is unique to this allocation.\n\nYou usually don't need to use this offset. If you create a buffer or an image together with the allocation using e.g. function\nvmaCreateBuffer(), vmaCreateImage(), functions that operate on these resources refer to the beginning of the buffer or image,\nnot entire device memory block. Functions like vmaMapMemory(), vmaBindBufferMemory() also refer to the beginning of the allocation\nand apply this offset automatically.\n\nIt can change after the allocation is moved during defragmentation."]
426 pub offset: DeviceSize,
427 #[doc = "Size of this allocation, in bytes.\n\nIt never changes.\n\n> **Note:** Allocation size returned in this variable may be greater than the size\nrequested for the resource e.g. as `VkBufferCreateInfo::size`. Whole size of the\nallocation is accessible for operations on memory e.g. using a pointer after\nmapping with vmaMapMemory(), but operations on the resource e.g. using\n`vkCmdCopyBuffer` must be limited to the size of the resource."]
428 pub size: DeviceSize,
429 #[doc = "Pointer to the beginning of this allocation as mapped data.\n\nIf the allocation hasn't been mapped using vmaMapMemory() and hasn't been\ncreated with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag, this value is null.\n\nIt can change after call to vmaMapMemory(), vmaUnmapMemory().\nIt can also change after the allocation is moved during defragmentation."]
430 pub pMappedData: *mut ::core::ffi::c_void,
431 #[doc = "Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vmaSetAllocationUserData().\n\nIt can change after call to vmaSetAllocationUserData() for this allocation."]
432 pub pUserData: *mut ::core::ffi::c_void,
433 #[doc = "Custom allocation name that was set with vmaSetAllocationName().\n\nIt can change after call to vmaSetAllocationName() for this allocation.\n\nAnother way to set custom name is to pass it in VmaAllocationCreateInfo::pUserData with\nadditional flag #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT set [DEPRECATED]."]
434 pub pName: *const ::core::ffi::c_char,
435}
436#[doc = "Extended parameters of a #VmaAllocation object that can be retrieved using function vmaGetAllocationInfo2()."]
437#[repr(C)]
438pub struct VmaAllocationInfo2 {
439 #[doc = "Basic parameters of the allocation.\n\nIf you need only these, you can use function vmaGetAllocationInfo() and structure #VmaAllocationInfo instead."]
440 pub allocationInfo: VmaAllocationInfo,
441 #[doc = "Size of the `VkDeviceMemory` block that the allocation belongs to.\n\nIn case of an allocation with dedicated memory, it will be equal to `allocationInfo.size`."]
442 pub blockSize: DeviceSize,
443 #[doc = "`VK_TRUE` if the allocation has dedicated memory, `VK_FALSE` if it was placed as part of a larger memory block.\n\nWhen `VK_TRUE`, it also means `VkMemoryDedicatedAllocateInfo` was used when creating the allocation\n(if VK_KHR_dedicated_allocation extension or Vulkan version >= 1.1 is enabled)."]
444 pub dedicatedMemory: Bool32,
445}
446#[doc = "Callback function called during vmaBeginDefragmentation() to check custom criterion about ending current defragmentation pass.\n\nShould return true if the defragmentation needs to stop current pass."]
447pub type PFN_vmaCheckDefragmentationBreakFunction =
448 ::core::option::Option<unsafe extern "C" fn(pUserData: *mut ::core::ffi::c_void) -> Bool32>;
449#[doc = "Parameters for defragmentation.\n\nTo be used with function vmaBeginDefragmentation()."]
450#[repr(C)]
451pub struct VmaDefragmentationInfo {
452 #[doc = "Use combination of #VmaDefragmentationFlagBits."]
453 pub flags: VmaDefragmentationFlags,
454 #[doc = "Custom pool to be defragmented.\n\nIf null then default pools will undergo defragmentation process."]
455 pub pool: VmaPool,
456 #[doc = "Maximum numbers of bytes that can be copied during single pass, while moving allocations to different places.\n\n`0` means no limit."]
457 pub maxBytesPerPass: DeviceSize,
458 #[doc = "Maximum number of allocations that can be moved during single pass to a different place.\n\n`0` means no limit."]
459 pub maxAllocationsPerPass: u32,
460 #[doc = "Optional custom callback for stopping vmaBeginDefragmentation().\n\nHave to return true for breaking current defragmentation pass."]
461 pub pfnBreakCallback: PFN_vmaCheckDefragmentationBreakFunction,
462 #[doc = "Optional data to pass to custom callback for stopping pass of defragmentation."]
463 pub pBreakCallbackUserData: *mut ::core::ffi::c_void,
464}
465#[doc = "Single move of an allocation to be done for defragmentation."]
466#[repr(C)]
467#[derive(Debug, Copy, Clone)]
468pub struct VmaDefragmentationMove {
469 #[doc = "Operation to be performed on the allocation by vmaEndDefragmentationPass(). Default value is #VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY. You can modify it."]
470 pub operation: VmaDefragmentationMoveOperation,
471 #[doc = "Allocation that should be moved."]
472 pub srcAllocation: VmaAllocation,
473 #[doc = "Temporary allocation pointing to destination memory that will replace `srcAllocation`.\n\nDo not store this allocation in your data structures! It exists only temporarily, for the duration of the defragmentation pass,\nto be used for binding new buffer/image to the destination memory using e.g. vmaBindBufferMemory().\nvmaEndDefragmentationPass() will destroy it and make `srcAllocation` point to this memory."]
474 pub dstTmpAllocation: VmaAllocation,
475}
476#[doc = "Parameters for incremental defragmentation steps.\n\nTo be used with function vmaBeginDefragmentationPass()."]
477#[repr(C)]
478#[derive(Debug, Copy, Clone)]
479pub struct VmaDefragmentationPassMoveInfo {
480 #[doc = "Number of elements in the `pMoves` array."]
481 pub moveCount: u32,
482 #[doc = "Array of moves to be performed by the user in the current defragmentation pass.\n\nPointer to an array of `moveCount` elements, owned by VMA, created in vmaBeginDefragmentationPass(), destroyed in vmaEndDefragmentationPass().\n\nFor each element, you should:\n\n1. Create a new buffer/image in the place pointed by VmaDefragmentationMove::dstMemory + VmaDefragmentationMove::dstOffset.\n2. Copy data from the VmaDefragmentationMove::srcAllocation e.g. using `vkCmdCopyBuffer`, `vkCmdCopyImage`.\n3. Make sure these commands finished executing on the GPU.\n4. Destroy the old buffer/image.\n\nOnly then you can finish defragmentation pass by calling vmaEndDefragmentationPass().\nAfter this call, the allocation will point to the new place in memory.\n\nAlternatively, if you cannot move specific allocation, you can set VmaDefragmentationMove::operation to #VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE.\n\nAlternatively, if you decide you want to completely remove the allocation:\n\n1. Destroy its buffer/image.\n2. Set VmaDefragmentationMove::operation to #VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY.\n\nThen, after vmaEndDefragmentationPass() the allocation will be freed."]
483 pub pMoves: *mut VmaDefragmentationMove,
484}
485#[doc = "Statistics returned for defragmentation process in function vmaEndDefragmentation()."]
486#[repr(C)]
487pub struct VmaDefragmentationStats {
488 #[doc = "Total number of bytes that have been copied while moving allocations to different places."]
489 pub bytesMoved: DeviceSize,
490 #[doc = "Total number of bytes that have been released to the system by freeing empty `VkDeviceMemory` objects."]
491 pub bytesFreed: DeviceSize,
492 #[doc = "Number of allocations that have been moved to different places."]
493 pub allocationsMoved: u32,
494 #[doc = "Number of empty `VkDeviceMemory` objects that have been released to the system."]
495 pub deviceMemoryBlocksFreed: u32,
496}
497#[doc = "Parameters of created #VmaVirtualBlock object to be passed to vmaCreateVirtualBlock()."]
498#[repr(C)]
499pub struct VmaVirtualBlockCreateInfo {
500 #[doc = "Total size of the virtual block.\n\nSizes can be expressed in bytes or any units you want as long as you are consistent in using them.\nFor example, if you allocate from some array of structures, 1 can mean single instance of entire structure."]
501 pub size: DeviceSize,
502 #[doc = "Use combination of #VmaVirtualBlockCreateFlagBits."]
503 pub flags: VmaVirtualBlockCreateFlags,
504 #[doc = "Custom CPU memory allocation callbacks. Optional.\n\nOptional, can be null. When specified, they will be used for all CPU-side memory allocations."]
505 pub pAllocationCallbacks: *const AllocationCallbacks,
506}
507#[doc = "Parameters of created virtual allocation to be passed to vmaVirtualAllocate()."]
508#[repr(C)]
509pub struct VmaVirtualAllocationCreateInfo {
510 #[doc = "Size of the allocation.\n\nCannot be zero."]
511 pub size: DeviceSize,
512 #[doc = "Required alignment of the allocation. Optional.\n\nMust be power of two. Special value 0 has the same meaning as 1 - means no special alignment is required, so allocation can start at any offset."]
513 pub alignment: DeviceSize,
514 #[doc = "Use combination of #VmaVirtualAllocationCreateFlagBits."]
515 pub flags: VmaVirtualAllocationCreateFlags,
516 #[doc = "Custom pointer to be associated with the allocation. Optional.\n\nIt can be any value and can be used for user-defined purposes. It can be fetched or changed later."]
517 pub pUserData: *mut ::core::ffi::c_void,
518}
519#[doc = "Parameters of an existing virtual allocation, returned by vmaGetVirtualAllocationInfo()."]
520#[repr(C)]
521pub struct VmaVirtualAllocationInfo {
522 #[doc = "Offset of the allocation.\n\nOffset at which the allocation was made."]
523 pub offset: DeviceSize,
524 #[doc = "Size of the allocation.\n\nSame value as passed in VmaVirtualAllocationCreateInfo::size."]
525 pub size: DeviceSize,
526 #[doc = "Custom pointer associated with the allocation.\n\nSame value as passed in VmaVirtualAllocationCreateInfo::pUserData or to vmaSetVirtualAllocationUserData()."]
527 pub pUserData: *mut ::core::ffi::c_void,
528}
529unsafe extern "C" {
530 #[doc = "Creates #VmaAllocator object."]
531 pub fn vmaCreateAllocator(
532 pCreateInfo: *const VmaAllocatorCreateInfo,
533 pAllocator: *mut VmaAllocator,
534 ) -> Result;
535}
536unsafe extern "C" {
537 #[doc = "Destroys allocator object."]
538 pub fn vmaDestroyAllocator(allocator: VmaAllocator);
539}
540unsafe extern "C" {
541 #[doc = "Returns information about existing #VmaAllocator object - handle to Vulkan device etc.\n\nIt might be useful if you want to keep just the #VmaAllocator handle and fetch other required handles to\n`VkPhysicalDevice`, `VkDevice` etc. every time using this function."]
542 pub fn vmaGetAllocatorInfo(allocator: VmaAllocator, pAllocatorInfo: *mut VmaAllocatorInfo);
543}
544unsafe extern "C" {
545 #[doc = "PhysicalDeviceProperties are fetched from physicalDevice by the allocator.\nYou can access it here, without fetching it again on your own."]
546 pub fn vmaGetPhysicalDeviceProperties(
547 allocator: VmaAllocator,
548 ppPhysicalDeviceProperties: *mut *const PhysicalDeviceProperties,
549 );
550}
551unsafe extern "C" {
552 #[doc = "PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator.\nYou can access it here, without fetching it again on your own."]
553 pub fn vmaGetMemoryProperties(
554 allocator: VmaAllocator,
555 ppPhysicalDeviceMemoryProperties: *mut *const PhysicalDeviceMemoryProperties,
556 );
557}
558unsafe extern "C" {
559 #[doc = "Given Memory Type Index, returns Property Flags of this memory type.\n\nThis is just a convenience function. Same information can be obtained using\nvmaGetMemoryProperties()."]
560 pub fn vmaGetMemoryTypeProperties(
561 allocator: VmaAllocator,
562 memoryTypeIndex: u32,
563 pFlags: *mut MemoryPropertyFlags,
564 );
565}
566unsafe extern "C" {
567 #[doc = "Sets index of the current frame."]
568 pub fn vmaSetCurrentFrameIndex(allocator: VmaAllocator, frameIndex: u32);
569}
570unsafe extern "C" {
571 #[doc = "Retrieves statistics from current state of the Allocator.\n\nThis function is called \"calculate\" not \"get\" because it has to traverse all\ninternal data structures, so it may be quite slow. Use it for debugging purposes.\nFor faster but more brief statistics suitable to be called every frame or every allocation,\nuse vmaGetHeapBudgets().\n\nNote that when using allocator from multiple threads, returned information may immediately\nbecome outdated."]
572 pub fn vmaCalculateStatistics(allocator: VmaAllocator, pStats: *mut VmaTotalStatistics);
573}
574unsafe extern "C" {
575 #[doc = "Retrieves information about current memory usage and budget for all memory heaps.\n\n# Arguments\n\n* `allocator` -\n* `pBudgets` (direction out) - Must point to array with number of elements at least equal to number of memory heaps in physical device used.\n\nThis function is called \"get\" not \"calculate\" because it is very fast, suitable to be called\nevery frame or every allocation. For more detailed statistics use vmaCalculateStatistics().\n\nNote that when using allocator from multiple threads, returned information may immediately\nbecome outdated."]
576 pub fn vmaGetHeapBudgets(allocator: VmaAllocator, pBudgets: *mut VmaBudget);
577}
578unsafe extern "C" {
579 #[doc = "Helps to find memoryTypeIndex, given memoryTypeBits and VmaAllocationCreateInfo.\n\nThis algorithm tries to find a memory type that:\n\n- Is allowed by memoryTypeBits.\n- Contains all the flags from pAllocationCreateInfo->requiredFlags.\n- Matches intended usage.\n- Has as many flags from pAllocationCreateInfo->preferredFlags as possible.\n\n# Returns\n\nReturns VK_ERROR_FEATURE_NOT_PRESENT if not found. Receiving such result\nfrom this function or any other allocating function probably means that your\ndevice doesn't support any memory type with requested features for the specific\ntype of resource you want to use it for. Please check parameters of your\nresource, like image layout (OPTIMAL versus LINEAR) or mip level count."]
580 pub fn vmaFindMemoryTypeIndex(
581 allocator: VmaAllocator,
582 memoryTypeBits: u32,
583 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
584 pMemoryTypeIndex: *mut u32,
585 ) -> Result;
586}
587unsafe extern "C" {
588 #[doc = "Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.\n\nIt can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.\nIt internally creates a temporary, dummy buffer that never has memory bound."]
589 pub fn vmaFindMemoryTypeIndexForBufferInfo(
590 allocator: VmaAllocator,
591 pBufferCreateInfo: *const BufferCreateInfo,
592 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
593 pMemoryTypeIndex: *mut u32,
594 ) -> Result;
595}
596unsafe extern "C" {
597 #[doc = "Helps to find memoryTypeIndex, given VkImageCreateInfo and VmaAllocationCreateInfo.\n\nIt can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex.\nIt internally creates a temporary, dummy image that never has memory bound."]
598 pub fn vmaFindMemoryTypeIndexForImageInfo(
599 allocator: VmaAllocator,
600 pImageCreateInfo: *const ImageCreateInfo,
601 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
602 pMemoryTypeIndex: *mut u32,
603 ) -> Result;
604}
605unsafe extern "C" {
606 #[doc = "Allocates Vulkan device memory and creates #VmaPool object.\n\n# Arguments\n\n* `allocator` - Allocator object.\n* `pCreateInfo` - Parameters of pool to create.\n* `pPool` (direction out) - Handle to created pool."]
607 pub fn vmaCreatePool(
608 allocator: VmaAllocator,
609 pCreateInfo: *const VmaPoolCreateInfo,
610 pPool: *mut VmaPool,
611 ) -> Result;
612}
613unsafe extern "C" {
614 #[doc = "Destroys #VmaPool object and frees Vulkan device memory."]
615 pub fn vmaDestroyPool(allocator: VmaAllocator, pool: VmaPool);
616}
617unsafe extern "C" {
618 #[doc = "Retrieves statistics of existing #VmaPool object.\n\n# Arguments\n\n* `allocator` - Allocator object.\n* `pool` - Pool object.\n* `pPoolStats` (direction out) - Statistics of specified pool."]
619 pub fn vmaGetPoolStatistics(
620 allocator: VmaAllocator,
621 pool: VmaPool,
622 pPoolStats: *mut VmaStatistics,
623 );
624}
625unsafe extern "C" {
626 #[doc = "Retrieves detailed statistics of existing #VmaPool object.\n\n# Arguments\n\n* `allocator` - Allocator object.\n* `pool` - Pool object.\n* `pPoolStats` (direction out) - Statistics of specified pool."]
627 pub fn vmaCalculatePoolStatistics(
628 allocator: VmaAllocator,
629 pool: VmaPool,
630 pPoolStats: *mut VmaDetailedStatistics,
631 );
632}
633unsafe extern "C" {
634 #[doc = "Checks magic number in margins around all allocations in given memory pool in search for corruptions.\n\nCorruption detection is enabled only when `VMA_DEBUG_DETECT_CORRUPTION` macro is defined to nonzero,\n`VMA_DEBUG_MARGIN` is defined to nonzero and the pool is created in memory type that is\n`HOST_VISIBLE` and `HOST_COHERENT`. For more information, see [Corruption detection](debugging_memory_usage_corruption_detection).\n\nPossible return values:\n\n- `VK_ERROR_FEATURE_NOT_PRESENT` - corruption detection is not enabled for specified pool.\n- `VK_SUCCESS` - corruption detection has been performed and succeeded.\n- `VK_ERROR_UNKNOWN` - corruption detection has been performed and found memory corruptions around one of the allocations.\n`VMA_ASSERT` is also fired in that case.\n- Other value: Error returned by Vulkan, e.g. memory mapping failure."]
635 pub fn vmaCheckPoolCorruption(allocator: VmaAllocator, pool: VmaPool) -> Result;
636}
637unsafe extern "C" {
638 #[doc = "Retrieves name of a custom pool.\n\nAfter the call `ppName` is either null or points to an internally-owned null-terminated string\ncontaining name of the pool that was previously set. The pointer becomes invalid when the pool is\ndestroyed or its name is changed using vmaSetPoolName()."]
639 pub fn vmaGetPoolName(
640 allocator: VmaAllocator,
641 pool: VmaPool,
642 ppName: *mut *const ::core::ffi::c_char,
643 );
644}
645unsafe extern "C" {
646 #[doc = "Sets name of a custom pool.\n\n`pName` can be either null or pointer to a null-terminated string with new name for the pool.\nFunction makes internal copy of the string, so it can be changed or freed immediately after this call."]
647 pub fn vmaSetPoolName(
648 allocator: VmaAllocator,
649 pool: VmaPool,
650 pName: *const ::core::ffi::c_char,
651 );
652}
653unsafe extern "C" {
654 #[doc = "General purpose memory allocation.\n\n# Arguments\n\n* `allocator` -\n* `pVkMemoryRequirements` -\n* `pCreateInfo` -\n* `pAllocation` (direction out) - Handle to allocated memory.\n* `pAllocationInfo` (direction out) - Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().\n\nYou should free the memory using vmaFreeMemory() or vmaFreeMemoryPages().\n\nIt is recommended to use vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage(),\nvmaCreateBuffer(), vmaCreateImage() instead whenever possible."]
655 pub fn vmaAllocateMemory(
656 allocator: VmaAllocator,
657 pVkMemoryRequirements: *const MemoryRequirements,
658 pCreateInfo: *const VmaAllocationCreateInfo,
659 pAllocation: *mut VmaAllocation,
660 pAllocationInfo: *mut VmaAllocationInfo,
661 ) -> Result;
662}
663unsafe extern "C" {
664 #[doc = "General purpose memory allocation for multiple allocation objects at once.\n\n# Arguments\n\n* `allocator` - Allocator object.\n* `pVkMemoryRequirements` - Memory requirements for each allocation.\n* `pCreateInfo` - Creation parameters for each allocation.\n* `allocationCount` - Number of allocations to make.\n* `pAllocations` (direction out) - Pointer to array that will be filled with handles to created allocations.\n* `pAllocationInfo` (direction out) - Optional. Pointer to array that will be filled with parameters of created allocations.\n\nYou should free the memory using vmaFreeMemory() or vmaFreeMemoryPages().\n\nWord \"pages\" is just a suggestion to use this function to allocate pieces of memory needed for sparse binding.\nIt is just a general purpose allocation function able to make multiple allocations at once.\nIt may be internally optimized to be more efficient than calling vmaAllocateMemory() `allocationCount` times.\n\nAll allocations are made using same parameters. All of them are created out of the same memory pool and type.\nIf any allocation fails, all allocations already made within this function call are also freed, so that when\nreturned result is not `VK_SUCCESS`, `pAllocation` array is always entirely filled with `VK_NULL_HANDLE`."]
665 pub fn vmaAllocateMemoryPages(
666 allocator: VmaAllocator,
667 pVkMemoryRequirements: *const MemoryRequirements,
668 pCreateInfo: *const VmaAllocationCreateInfo,
669 allocationCount: usize,
670 pAllocations: *mut VmaAllocation,
671 pAllocationInfo: *mut VmaAllocationInfo,
672 ) -> Result;
673}
674unsafe extern "C" {
675 #[doc = "Allocates memory suitable for given `VkBuffer`.\n\n# Arguments\n\n* `allocator` -\n* `buffer` -\n* `pCreateInfo` -\n* `pAllocation` (direction out) - Handle to allocated memory.\n* `pAllocationInfo` (direction out) - Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().\n\nIt only creates #VmaAllocation. To bind the memory to the buffer, use vmaBindBufferMemory().\n\nThis is a special-purpose function. In most cases you should use vmaCreateBuffer().\n\nYou must free the allocation using vmaFreeMemory() when no longer needed."]
676 pub fn vmaAllocateMemoryForBuffer(
677 allocator: VmaAllocator,
678 buffer: Buffer,
679 pCreateInfo: *const VmaAllocationCreateInfo,
680 pAllocation: *mut VmaAllocation,
681 pAllocationInfo: *mut VmaAllocationInfo,
682 ) -> Result;
683}
684unsafe extern "C" {
685 #[doc = "Allocates memory suitable for given `VkImage`.\n\n# Arguments\n\n* `allocator` -\n* `image` -\n* `pCreateInfo` -\n* `pAllocation` (direction out) - Handle to allocated memory.\n* `pAllocationInfo` (direction out) - Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().\n\nIt only creates #VmaAllocation. To bind the memory to the buffer, use vmaBindImageMemory().\n\nThis is a special-purpose function. In most cases you should use vmaCreateImage().\n\nYou must free the allocation using vmaFreeMemory() when no longer needed."]
686 pub fn vmaAllocateMemoryForImage(
687 allocator: VmaAllocator,
688 image: Image,
689 pCreateInfo: *const VmaAllocationCreateInfo,
690 pAllocation: *mut VmaAllocation,
691 pAllocationInfo: *mut VmaAllocationInfo,
692 ) -> Result;
693}
694unsafe extern "C" {
695 #[doc = "Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage().\n\nPassing `VK_NULL_HANDLE` as `allocation` is valid. Such function call is just skipped."]
696 pub fn vmaFreeMemory(allocator: VmaAllocator, allocation: VmaAllocation);
697}
698unsafe extern "C" {
699 #[doc = "Frees memory and destroys multiple allocations.\n\nWord \"pages\" is just a suggestion to use this function to free pieces of memory used for sparse binding.\nIt is just a general purpose function to free memory and destroy allocations made using e.g. vmaAllocateMemory(),\nvmaAllocateMemoryPages() and other functions.\nIt may be internally optimized to be more efficient than calling vmaFreeMemory() `allocationCount` times.\n\nAllocations in `pAllocations` array can come from any memory pools and types.\nPassing `VK_NULL_HANDLE` as elements of `pAllocations` array is valid. Such entries are just skipped."]
700 pub fn vmaFreeMemoryPages(
701 allocator: VmaAllocator,
702 allocationCount: usize,
703 pAllocations: *const *mut VmaAllocation_T,
704 );
705}
706unsafe extern "C" {
707 #[doc = "Returns current information about specified allocation.\n\nCurrent parameters of given allocation are returned in `pAllocationInfo`.\n\nAlthough this function doesn't lock any mutex, so it should be quite efficient,\nyou should avoid calling it too often.\nYou can retrieve same VmaAllocationInfo structure while creating your resource, from function\nvmaCreateBuffer(), vmaCreateImage(). You can remember it if you are sure parameters don't change\n(e.g. due to defragmentation).\n\nThere is also a new function vmaGetAllocationInfo2() that offers extended information\nabout the allocation, returned using new structure #VmaAllocationInfo2."]
708 pub fn vmaGetAllocationInfo(
709 allocator: VmaAllocator,
710 allocation: VmaAllocation,
711 pAllocationInfo: *mut VmaAllocationInfo,
712 );
713}
714unsafe extern "C" {
715 #[doc = "Returns extended information about specified allocation.\n\nCurrent parameters of given allocation are returned in `pAllocationInfo`.\nExtended parameters in structure #VmaAllocationInfo2 include memory block size\nand a flag telling whether the allocation has dedicated memory.\nIt can be useful e.g. for interop with OpenGL."]
716 pub fn vmaGetAllocationInfo2(
717 allocator: VmaAllocator,
718 allocation: VmaAllocation,
719 pAllocationInfo: *mut VmaAllocationInfo2,
720 );
721}
722unsafe extern "C" {
723 #[doc = "Sets pUserData in given allocation to new value.\n\nThe value of pointer `pUserData` is copied to allocation's `pUserData`.\nIt is opaque, so you can use it however you want - e.g.\nas a pointer, ordinal number or some handle to you own data."]
724 pub fn vmaSetAllocationUserData(
725 allocator: VmaAllocator,
726 allocation: VmaAllocation,
727 pUserData: *mut ::core::ffi::c_void,
728 );
729}
730unsafe extern "C" {
731 #[doc = "Sets pName in given allocation to new value.\n\n`pName` must be either null, or pointer to a null-terminated string. The function\nmakes local copy of the string and sets it as allocation's `pName`. String\npassed as pName doesn't need to be valid for whole lifetime of the allocation -\nyou can free it after this call. String previously pointed by allocation's\n`pName` is freed from memory."]
732 pub fn vmaSetAllocationName(
733 allocator: VmaAllocator,
734 allocation: VmaAllocation,
735 pName: *const ::core::ffi::c_char,
736 );
737}
738unsafe extern "C" {
739 #[doc = "Given an allocation, returns Property Flags of its memory type.\n\nThis is just a convenience function. Same information can be obtained using\nvmaGetAllocationInfo() + vmaGetMemoryProperties()."]
740 pub fn vmaGetAllocationMemoryProperties(
741 allocator: VmaAllocator,
742 allocation: VmaAllocation,
743 pFlags: *mut MemoryPropertyFlags,
744 );
745}
746unsafe extern "C" {
747 #[doc = "Maps memory represented by given allocation and returns pointer to it.\n\nMaps memory represented by given allocation to make it accessible to CPU code.\nWhen succeeded, `*ppData` contains pointer to first byte of this memory.\n\nIf the allocation is part of a bigger `VkDeviceMemory` block, returned pointer is\ncorrectly offsetted to the beginning of region assigned to this particular allocation.\nUnlike the result of `vkMapMemory`, it points to the allocation, not to the beginning of the whole block.\nYou should not add VmaAllocationInfo::offset to it!\n\nMapping is internally reference-counted and synchronized, so despite raw Vulkan\nfunction `vkMapMemory()` cannot be used to map same block of `VkDeviceMemory`\nmultiple times simultaneously, it is safe to call this function on allocations\nassigned to the same memory block. Actual Vulkan memory will be mapped on first\nmapping and unmapped on last unmapping.\n\nIf the function succeeded, you must call vmaUnmapMemory() to unmap the\nallocation when mapping is no longer needed or before freeing the allocation, at\nthe latest.\n\nIt also safe to call this function multiple times on the same allocation. You\nmust call vmaUnmapMemory() same number of times as you called vmaMapMemory().\n\nIt is also safe to call this function on allocation created with\n#VMA_ALLOCATION_CREATE_MAPPED_BIT flag. Its memory stays mapped all the time.\nYou must still call vmaUnmapMemory() same number of times as you called\nvmaMapMemory(). You must not call vmaUnmapMemory() additional time to free the\n\"0-th\" mapping made automatically due to #VMA_ALLOCATION_CREATE_MAPPED_BIT flag.\n\nThis function fails when used on allocation made in memory type that is not\n`HOST_VISIBLE`.\n\nThis function doesn't automatically flush or invalidate caches.\nIf the allocation is made from a memory types that is not `HOST_COHERENT`,\nyou also need to use vmaInvalidateAllocation() / vmaFlushAllocation(), as required by Vulkan specification."]
748 pub fn vmaMapMemory(
749 allocator: VmaAllocator,
750 allocation: VmaAllocation,
751 ppData: *mut *mut ::core::ffi::c_void,
752 ) -> Result;
753}
754unsafe extern "C" {
755 #[doc = "Unmaps memory represented by given allocation, mapped previously using vmaMapMemory().\n\nFor details, see description of vmaMapMemory().\n\nThis function doesn't automatically flush or invalidate caches.\nIf the allocation is made from a memory types that is not `HOST_COHERENT`,\nyou also need to use vmaInvalidateAllocation() / vmaFlushAllocation(), as required by Vulkan specification."]
756 pub fn vmaUnmapMemory(allocator: VmaAllocator, allocation: VmaAllocation);
757}
758unsafe extern "C" {
759 #[doc = "Flushes memory of given allocation.\n\nCalls `vkFlushMappedMemoryRanges()` for memory associated with given range of given allocation.\nIt needs to be called after writing to a mapped memory for memory types that are not `HOST_COHERENT`.\nUnmap operation doesn't do that automatically.\n\n- `offset` must be relative to the beginning of allocation.\n- `size` can be `VK_WHOLE_SIZE`. It means all memory from `offset` the the end of given allocation.\n- `offset` and `size` don't have to be aligned.\nThey are internally rounded down/up to multiply of `nonCoherentAtomSize`.\n- If `size` is 0, this call is ignored.\n- If memory type that the `allocation` belongs to is not `HOST_VISIBLE` or it is `HOST_COHERENT`,\nthis call is ignored.\n\nWarning! `offset` and `size` are relative to the contents of given `allocation`.\nIf you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.\nDo not pass allocation's offset as `offset`!!!\n\nThis function returns the `VkResult` from `vkFlushMappedMemoryRanges` if it is\ncalled, otherwise `VK_SUCCESS`."]
760 pub fn vmaFlushAllocation(
761 allocator: VmaAllocator,
762 allocation: VmaAllocation,
763 offset: DeviceSize,
764 size: DeviceSize,
765 ) -> Result;
766}
767unsafe extern "C" {
768 #[doc = "Invalidates memory of given allocation.\n\nCalls `vkInvalidateMappedMemoryRanges()` for memory associated with given range of given allocation.\nIt needs to be called before reading from a mapped memory for memory types that are not `HOST_COHERENT`.\nMap operation doesn't do that automatically.\n\n- `offset` must be relative to the beginning of allocation.\n- `size` can be `VK_WHOLE_SIZE`. It means all memory from `offset` the the end of given allocation.\n- `offset` and `size` don't have to be aligned.\nThey are internally rounded down/up to multiply of `nonCoherentAtomSize`.\n- If `size` is 0, this call is ignored.\n- If memory type that the `allocation` belongs to is not `HOST_VISIBLE` or it is `HOST_COHERENT`,\nthis call is ignored.\n\nWarning! `offset` and `size` are relative to the contents of given `allocation`.\nIf you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.\nDo not pass allocation's offset as `offset`!!!\n\nThis function returns the `VkResult` from `vkInvalidateMappedMemoryRanges` if\nit is called, otherwise `VK_SUCCESS`."]
769 pub fn vmaInvalidateAllocation(
770 allocator: VmaAllocator,
771 allocation: VmaAllocation,
772 offset: DeviceSize,
773 size: DeviceSize,
774 ) -> Result;
775}
776unsafe extern "C" {
777 #[doc = "Flushes memory of given set of allocations.\n\nCalls `vkFlushMappedMemoryRanges()` for memory associated with given ranges of given allocations.\nFor more information, see documentation of vmaFlushAllocation().\n\n# Arguments\n\n* `allocator` -\n* `allocationCount` -\n* `allocations` -\n* `offsets` - If not null, it must point to an array of offsets of regions to flush, relative to the beginning of respective allocations. Null means all offsets are zero.\n* `sizes` - If not null, it must point to an array of sizes of regions to flush in respective allocations. Null means `VK_WHOLE_SIZE` for all allocations.\n\nThis function returns the `VkResult` from `vkFlushMappedMemoryRanges` if it is\ncalled, otherwise `VK_SUCCESS`."]
778 pub fn vmaFlushAllocations(
779 allocator: VmaAllocator,
780 allocationCount: u32,
781 allocations: *const *mut VmaAllocation_T,
782 offsets: *const DeviceSize,
783 sizes: *const DeviceSize,
784 ) -> Result;
785}
786unsafe extern "C" {
787 #[doc = "Invalidates memory of given set of allocations.\n\nCalls `vkInvalidateMappedMemoryRanges()` for memory associated with given ranges of given allocations.\nFor more information, see documentation of vmaInvalidateAllocation().\n\n# Arguments\n\n* `allocator` -\n* `allocationCount` -\n* `allocations` -\n* `offsets` - If not null, it must point to an array of offsets of regions to flush, relative to the beginning of respective allocations. Null means all offsets are zero.\n* `sizes` - If not null, it must point to an array of sizes of regions to flush in respective allocations. Null means `VK_WHOLE_SIZE` for all allocations.\n\nThis function returns the `VkResult` from `vkInvalidateMappedMemoryRanges` if it is\ncalled, otherwise `VK_SUCCESS`."]
788 pub fn vmaInvalidateAllocations(
789 allocator: VmaAllocator,
790 allocationCount: u32,
791 allocations: *const *mut VmaAllocation_T,
792 offsets: *const DeviceSize,
793 sizes: *const DeviceSize,
794 ) -> Result;
795}
796unsafe extern "C" {
797 #[doc = "Maps the allocation temporarily if needed, copies data from specified host pointer to it, and flushes the memory from the host caches if needed.\n\n# Arguments\n\n* `allocator` -\n* `pSrcHostPointer` - Pointer to the host data that become source of the copy.\n* `dstAllocation` - Handle to the allocation that becomes destination of the copy.\n* `dstAllocationLocalOffset` - Offset within `dstAllocation` where to write copied data, in bytes.\n* `size` - Number of bytes to copy.\n\nThis is a convenience function that allows to copy data from a host pointer to an allocation easily.\nSame behavior can be achieved by calling vmaMapMemory(), `memcpy()`, vmaUnmapMemory(), vmaFlushAllocation().\n\nThis function can be called only for allocations created in a memory type that has `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag.\nIt can be ensured e.g. by using #VMA_MEMORY_USAGE_AUTO and #VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT or\n#VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT.\nOtherwise, the function will fail and generate a Validation Layers error.\n\n`dstAllocationLocalOffset` is relative to the contents of given `dstAllocation`.\nIf you mean whole allocation, you should pass 0.\nDo not pass allocation's offset within device memory block this parameter!"]
798 pub fn vmaCopyMemoryToAllocation(
799 allocator: VmaAllocator,
800 pSrcHostPointer: *const ::core::ffi::c_void,
801 dstAllocation: VmaAllocation,
802 dstAllocationLocalOffset: DeviceSize,
803 size: DeviceSize,
804 ) -> Result;
805}
806unsafe extern "C" {
807 #[doc = "Invalidates memory in the host caches if needed, maps the allocation temporarily if needed, and copies data from it to a specified host pointer.\n\n# Arguments\n\n* `allocator` -\n* `srcAllocation` - Handle to the allocation that becomes source of the copy.\n* `srcAllocationLocalOffset` - Offset within `srcAllocation` where to read copied data, in bytes.\n* `pDstHostPointer` - Pointer to the host memory that become destination of the copy.\n* `size` - Number of bytes to copy.\n\nThis is a convenience function that allows to copy data from an allocation to a host pointer easily.\nSame behavior can be achieved by calling vmaInvalidateAllocation(), vmaMapMemory(), `memcpy()`, vmaUnmapMemory().\n\nThis function should be called only for allocations created in a memory type that has `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`\nand `VK_MEMORY_PROPERTY_HOST_CACHED_BIT` flag.\nIt can be ensured e.g. by using #VMA_MEMORY_USAGE_AUTO and #VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT.\nOtherwise, the function may fail and generate a Validation Layers error.\nIt may also work very slowly when reading from an uncached memory.\n\n`srcAllocationLocalOffset` is relative to the contents of given `srcAllocation`.\nIf you mean whole allocation, you should pass 0.\nDo not pass allocation's offset within device memory block as this parameter!"]
808 pub fn vmaCopyAllocationToMemory(
809 allocator: VmaAllocator,
810 srcAllocation: VmaAllocation,
811 srcAllocationLocalOffset: DeviceSize,
812 pDstHostPointer: *mut ::core::ffi::c_void,
813 size: DeviceSize,
814 ) -> Result;
815}
816unsafe extern "C" {
817 #[doc = "Checks magic number in margins around all allocations in given memory types (in both default and custom pools) in search for corruptions.\n\n# Arguments\n\n* `allocator` -\n* `memoryTypeBits` - Bit mask, where each bit set means that a memory type with that index should be checked.\n\nCorruption detection is enabled only when `VMA_DEBUG_DETECT_CORRUPTION` macro is defined to nonzero,\n`VMA_DEBUG_MARGIN` is defined to nonzero and only for memory types that are\n`HOST_VISIBLE` and `HOST_COHERENT`. For more information, see [Corruption detection](debugging_memory_usage_corruption_detection).\n\nPossible return values:\n\n- `VK_ERROR_FEATURE_NOT_PRESENT` - corruption detection is not enabled for any of specified memory types.\n- `VK_SUCCESS` - corruption detection has been performed and succeeded.\n- `VK_ERROR_UNKNOWN` - corruption detection has been performed and found memory corruptions around one of the allocations.\n`VMA_ASSERT` is also fired in that case.\n- Other value: Error returned by Vulkan, e.g. memory mapping failure."]
818 pub fn vmaCheckCorruption(allocator: VmaAllocator, memoryTypeBits: u32) -> Result;
819}
820unsafe extern "C" {
821 #[doc = "Begins defragmentation process.\n\n# Arguments\n\n* `allocator` - Allocator object.\n* `pInfo` - Structure filled with parameters of defragmentation.\n* `pContext` (direction out) - Context object that must be passed to vmaEndDefragmentation() to finish defragmentation.\n# Returns\n\n- `VK_SUCCESS` if defragmentation can begin.\n- `VK_ERROR_FEATURE_NOT_PRESENT` if defragmentation is not supported.\n\nFor more information about defragmentation, see documentation chapter:\n[Defragmentation](defragmentation)."]
822 pub fn vmaBeginDefragmentation(
823 allocator: VmaAllocator,
824 pInfo: *const VmaDefragmentationInfo,
825 pContext: *mut VmaDefragmentationContext,
826 ) -> Result;
827}
828unsafe extern "C" {
829 #[doc = "Ends defragmentation process.\n\n# Arguments\n\n* `allocator` - Allocator object.\n* `context` - Context object that has been created by vmaBeginDefragmentation().\n* `pStats` (direction out) - Optional stats for the defragmentation. Can be null.\n\nUse this function to finish defragmentation started by vmaBeginDefragmentation()."]
830 pub fn vmaEndDefragmentation(
831 allocator: VmaAllocator,
832 context: VmaDefragmentationContext,
833 pStats: *mut VmaDefragmentationStats,
834 );
835}
836unsafe extern "C" {
837 #[doc = "Starts single defragmentation pass.\n\n# Arguments\n\n* `allocator` - Allocator object.\n* `context` - Context object that has been created by vmaBeginDefragmentation().\n* `pPassInfo` (direction out) - Computed information for current pass.\n# Returns\n\n- `VK_SUCCESS` if no more moves are possible. Then you can omit call to vmaEndDefragmentationPass() and simply end whole defragmentation.\n- `VK_INCOMPLETE` if there are pending moves returned in `pPassInfo`. You need to perform them, call vmaEndDefragmentationPass(),\nand then preferably try another pass with vmaBeginDefragmentationPass()."]
838 pub fn vmaBeginDefragmentationPass(
839 allocator: VmaAllocator,
840 context: VmaDefragmentationContext,
841 pPassInfo: *mut VmaDefragmentationPassMoveInfo,
842 ) -> Result;
843}
844unsafe extern "C" {
845 #[doc = "Ends single defragmentation pass.\n\n# Arguments\n\n* `allocator` - Allocator object.\n* `context` - Context object that has been created by vmaBeginDefragmentation().\n* `pPassInfo` - Computed information for current pass filled by vmaBeginDefragmentationPass() and possibly modified by you.\n\nReturns `VK_SUCCESS` if no more moves are possible or `VK_INCOMPLETE` if more defragmentations are possible.\n\nEnds incremental defragmentation pass and commits all defragmentation moves from `pPassInfo`.\nAfter this call:\n\n- Allocations at `pPassInfo[i].srcAllocation` that had `pPassInfo[i].operation ==` #VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY\n(which is the default) will be pointing to the new destination place.\n- Allocation at `pPassInfo[i].srcAllocation` that had `pPassInfo[i].operation ==` #VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY\nwill be freed.\n\nIf no more moves are possible you can end whole defragmentation."]
846 pub fn vmaEndDefragmentationPass(
847 allocator: VmaAllocator,
848 context: VmaDefragmentationContext,
849 pPassInfo: *mut VmaDefragmentationPassMoveInfo,
850 ) -> Result;
851}
852unsafe extern "C" {
853 #[doc = "Binds buffer to allocation.\n\nBinds specified buffer to region of memory represented by specified allocation.\nGets `VkDeviceMemory` handle and offset from the allocation.\nIf you want to create a buffer, allocate memory for it and bind them together separately,\nyou should use this function for binding instead of standard `vkBindBufferMemory()`,\nbecause it ensures proper synchronization so that when a `VkDeviceMemory` object is used by multiple\nallocations, calls to `vkBind*Memory()` or `vkMapMemory()` won't happen from multiple threads simultaneously\n(which is illegal in Vulkan).\n\nIt is recommended to use function vmaCreateBuffer() instead of this one."]
854 pub fn vmaBindBufferMemory(
855 allocator: VmaAllocator,
856 allocation: VmaAllocation,
857 buffer: Buffer,
858 ) -> Result;
859}
860unsafe extern "C" {
861 #[doc = "Binds buffer to allocation with additional parameters.\n\n# Arguments\n\n* `allocator` -\n* `allocation` -\n* `allocationLocalOffset` - Additional offset to be added while binding, relative to the beginning of the `allocation`. Normally it should be 0.\n* `buffer` -\n* `pNext` - A chain of structures to be attached to `VkBindBufferMemoryInfoKHR` structure used internally. Normally it should be null.\n\nThis function is similar to vmaBindBufferMemory(), but it provides additional parameters.\n\nIf `pNext` is not null, #VmaAllocator object must have been created with #VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag\nor with VmaAllocatorCreateInfo::vulkanApiVersion `>= VK_API_VERSION_1_1`. Otherwise the call fails."]
862 pub fn vmaBindBufferMemory2(
863 allocator: VmaAllocator,
864 allocation: VmaAllocation,
865 allocationLocalOffset: DeviceSize,
866 buffer: Buffer,
867 pNext: *const ::core::ffi::c_void,
868 ) -> Result;
869}
870unsafe extern "C" {
871 #[doc = "Binds image to allocation.\n\nBinds specified image to region of memory represented by specified allocation.\nGets `VkDeviceMemory` handle and offset from the allocation.\nIf you want to create an image, allocate memory for it and bind them together separately,\nyou should use this function for binding instead of standard `vkBindImageMemory()`,\nbecause it ensures proper synchronization so that when a `VkDeviceMemory` object is used by multiple\nallocations, calls to `vkBind*Memory()` or `vkMapMemory()` won't happen from multiple threads simultaneously\n(which is illegal in Vulkan).\n\nIt is recommended to use function vmaCreateImage() instead of this one."]
872 pub fn vmaBindImageMemory(
873 allocator: VmaAllocator,
874 allocation: VmaAllocation,
875 image: Image,
876 ) -> Result;
877}
878unsafe extern "C" {
879 #[doc = "Binds image to allocation with additional parameters.\n\n# Arguments\n\n* `allocator` -\n* `allocation` -\n* `allocationLocalOffset` - Additional offset to be added while binding, relative to the beginning of the `allocation`. Normally it should be 0.\n* `image` -\n* `pNext` - A chain of structures to be attached to `VkBindImageMemoryInfoKHR` structure used internally. Normally it should be null.\n\nThis function is similar to vmaBindImageMemory(), but it provides additional parameters.\n\nIf `pNext` is not null, #VmaAllocator object must have been created with #VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag\nor with VmaAllocatorCreateInfo::vulkanApiVersion `>= VK_API_VERSION_1_1`. Otherwise the call fails."]
880 pub fn vmaBindImageMemory2(
881 allocator: VmaAllocator,
882 allocation: VmaAllocation,
883 allocationLocalOffset: DeviceSize,
884 image: Image,
885 pNext: *const ::core::ffi::c_void,
886 ) -> Result;
887}
888unsafe extern "C" {
889 #[doc = "Creates a new `VkBuffer`, allocates and binds memory for it.\n\n# Arguments\n\n* `allocator` -\n* `pBufferCreateInfo` -\n* `pAllocationCreateInfo` -\n* `pBuffer` (direction out) - Buffer that was created.\n* `pAllocation` (direction out) - Allocation that was created.\n* `pAllocationInfo` (direction out) - Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().\n\nThis function automatically:\n\n-# Creates buffer.\n-# Allocates appropriate memory for it.\n-# Binds the buffer with the memory.\n\nIf any of these operations fail, buffer and allocation are not created,\nreturned value is negative error code, `*pBuffer` and `*pAllocation` are null.\n\nIf the function succeeded, you must destroy both buffer and allocation when you\nno longer need them using either convenience function vmaDestroyBuffer() or\nseparately, using `vkDestroyBuffer()` and vmaFreeMemory().\n\nIf #VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag was used,\nVK_KHR_dedicated_allocation extension is used internally to query driver whether\nit requires or prefers the new buffer to have dedicated allocation. If yes,\nand if dedicated allocation is possible\n(#VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT is not used), it creates dedicated\nallocation for this buffer, just like when using\n#VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.\n\n> **Note:** This function creates a new `VkBuffer`. Sub-allocation of parts of one large buffer,\nalthough recommended as a good practice, is out of scope of this library and could be implemented\nby the user as a higher-level logic on top of VMA."]
890 pub fn vmaCreateBuffer(
891 allocator: VmaAllocator,
892 pBufferCreateInfo: *const BufferCreateInfo,
893 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
894 pBuffer: *mut Buffer,
895 pAllocation: *mut VmaAllocation,
896 pAllocationInfo: *mut VmaAllocationInfo,
897 ) -> Result;
898}
899unsafe extern "C" {
900 #[doc = "Creates a buffer with additional minimum alignment.\n\nSimilar to vmaCreateBuffer() but provides additional parameter `minAlignment` which allows to specify custom,\nminimum alignment to be used when placing the buffer inside a larger memory block, which may be needed e.g.\nfor interop with OpenGL."]
901 pub fn vmaCreateBufferWithAlignment(
902 allocator: VmaAllocator,
903 pBufferCreateInfo: *const BufferCreateInfo,
904 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
905 minAlignment: DeviceSize,
906 pBuffer: *mut Buffer,
907 pAllocation: *mut VmaAllocation,
908 pAllocationInfo: *mut VmaAllocationInfo,
909 ) -> Result;
910}
911unsafe extern "C" {
912 #[doc = "Creates a new `VkBuffer`, binds already created memory for it.\n\n# Arguments\n\n* `allocator` -\n* `allocation` - Allocation that provides memory to be used for binding new buffer to it.\n* `pBufferCreateInfo` -\n* `pBuffer` (direction out) - Buffer that was created.\n\nThis function automatically:\n\n-# Creates buffer.\n-# Binds the buffer with the supplied memory.\n\nIf any of these operations fail, buffer is not created,\nreturned value is negative error code and `*pBuffer` is null.\n\nIf the function succeeded, you must destroy the buffer when you\nno longer need it using `vkDestroyBuffer()`. If you want to also destroy the corresponding\nallocation you can use convenience function vmaDestroyBuffer().\n\n> **Note:** There is a new version of this function augmented with parameter `allocationLocalOffset` - see vmaCreateAliasingBuffer2()."]
913 pub fn vmaCreateAliasingBuffer(
914 allocator: VmaAllocator,
915 allocation: VmaAllocation,
916 pBufferCreateInfo: *const BufferCreateInfo,
917 pBuffer: *mut Buffer,
918 ) -> Result;
919}
920unsafe extern "C" {
921 #[doc = "Creates a new `VkBuffer`, binds already created memory for it.\n\n# Arguments\n\n* `allocator` -\n* `allocation` - Allocation that provides memory to be used for binding new buffer to it.\n* `allocationLocalOffset` - Additional offset to be added while binding, relative to the beginning of the allocation. Normally it should be 0.\n* `pBufferCreateInfo` -\n* `pBuffer` (direction out) - Buffer that was created.\n\nThis function automatically:\n\n-# Creates buffer.\n-# Binds the buffer with the supplied memory.\n\nIf any of these operations fail, buffer is not created,\nreturned value is negative error code and `*pBuffer` is null.\n\nIf the function succeeded, you must destroy the buffer when you\nno longer need it using `vkDestroyBuffer()`. If you want to also destroy the corresponding\nallocation you can use convenience function vmaDestroyBuffer().\n\n> **Note:** This is a new version of the function augmented with parameter `allocationLocalOffset`."]
922 pub fn vmaCreateAliasingBuffer2(
923 allocator: VmaAllocator,
924 allocation: VmaAllocation,
925 allocationLocalOffset: DeviceSize,
926 pBufferCreateInfo: *const BufferCreateInfo,
927 pBuffer: *mut Buffer,
928 ) -> Result;
929}
930unsafe extern "C" {
931 #[doc = "Destroys Vulkan buffer and frees allocated memory.\n\nThis is just a convenience function equivalent to:\n\nvkDestroyBuffer(device, buffer, allocationCallbacks);\nvmaFreeMemory(allocator, allocation);\nIt is safe to pass null as buffer and/or allocation."]
932 pub fn vmaDestroyBuffer(allocator: VmaAllocator, buffer: Buffer, allocation: VmaAllocation);
933}
934unsafe extern "C" {
935 #[doc = "Function similar to vmaCreateBuffer()."]
936 pub fn vmaCreateImage(
937 allocator: VmaAllocator,
938 pImageCreateInfo: *const ImageCreateInfo,
939 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
940 pImage: *mut Image,
941 pAllocation: *mut VmaAllocation,
942 pAllocationInfo: *mut VmaAllocationInfo,
943 ) -> Result;
944}
945unsafe extern "C" {
946 #[doc = "Function similar to vmaCreateAliasingBuffer() but for images."]
947 pub fn vmaCreateAliasingImage(
948 allocator: VmaAllocator,
949 allocation: VmaAllocation,
950 pImageCreateInfo: *const ImageCreateInfo,
951 pImage: *mut Image,
952 ) -> Result;
953}
954unsafe extern "C" {
955 #[doc = "Function similar to vmaCreateAliasingBuffer2() but for images."]
956 pub fn vmaCreateAliasingImage2(
957 allocator: VmaAllocator,
958 allocation: VmaAllocation,
959 allocationLocalOffset: DeviceSize,
960 pImageCreateInfo: *const ImageCreateInfo,
961 pImage: *mut Image,
962 ) -> Result;
963}
964unsafe extern "C" {
965 #[doc = "Destroys Vulkan image and frees allocated memory.\n\nThis is just a convenience function equivalent to:\n\nvkDestroyImage(device, image, allocationCallbacks);\nvmaFreeMemory(allocator, allocation);\nIt is safe to pass null as image and/or allocation."]
966 pub fn vmaDestroyImage(allocator: VmaAllocator, image: Image, allocation: VmaAllocation);
967}
968unsafe extern "C" {
969 #[doc = "Creates new #VmaVirtualBlock object.\n\n# Arguments\n\n* `pCreateInfo` - Parameters for creation.\n* `pVirtualBlock` (direction out) - Returned virtual block object or `VMA_NULL` if creation failed."]
970 pub fn vmaCreateVirtualBlock(
971 pCreateInfo: *const VmaVirtualBlockCreateInfo,
972 pVirtualBlock: *mut VmaVirtualBlock,
973 ) -> Result;
974}
975unsafe extern "C" {
976 #[doc = "Destroys #VmaVirtualBlock object.\n\nPlease note that you should consciously handle virtual allocations that could remain unfreed in the block.\nYou should either free them individually using vmaVirtualFree() or call vmaClearVirtualBlock()\nif you are sure this is what you want. If you do neither, an assert is called.\n\nIf you keep pointers to some additional metadata associated with your virtual allocations in their `pUserData`,\ndon't forget to free them."]
977 pub fn vmaDestroyVirtualBlock(virtualBlock: VmaVirtualBlock);
978}
979unsafe extern "C" {
980 #[doc = "Returns true of the #VmaVirtualBlock is empty - contains 0 virtual allocations and has all its space available for new allocations."]
981 pub fn vmaIsVirtualBlockEmpty(virtualBlock: VmaVirtualBlock) -> Bool32;
982}
983unsafe extern "C" {
984 #[doc = "Returns information about a specific virtual allocation within a virtual block, like its size and `pUserData` pointer."]
985 pub fn vmaGetVirtualAllocationInfo(
986 virtualBlock: VmaVirtualBlock,
987 allocation: VmaVirtualAllocation,
988 pVirtualAllocInfo: *mut VmaVirtualAllocationInfo,
989 );
990}
991unsafe extern "C" {
992 #[doc = "Allocates new virtual allocation inside given #VmaVirtualBlock.\n\nIf the allocation fails due to not enough free space available, `VK_ERROR_OUT_OF_DEVICE_MEMORY` is returned\n(despite the function doesn't ever allocate actual GPU memory).\n`pAllocation` is then set to `VK_NULL_HANDLE` and `pOffset`, if not null, it set to `UINT64_MAX`.\n\n# Arguments\n\n* `virtualBlock` - Virtual block\n* `pCreateInfo` - Parameters for the allocation\n* `pAllocation` (direction out) - Returned handle of the new allocation\n* `pOffset` (direction out) - Returned offset of the new allocation. Optional, can be null."]
993 pub fn vmaVirtualAllocate(
994 virtualBlock: VmaVirtualBlock,
995 pCreateInfo: *const VmaVirtualAllocationCreateInfo,
996 pAllocation: *mut VmaVirtualAllocation,
997 pOffset: *mut DeviceSize,
998 ) -> Result;
999}
1000unsafe extern "C" {
1001 #[doc = "Frees virtual allocation inside given #VmaVirtualBlock.\n\nIt is correct to call this function with `allocation == VK_NULL_HANDLE` - it does nothing."]
1002 pub fn vmaVirtualFree(virtualBlock: VmaVirtualBlock, allocation: VmaVirtualAllocation);
1003}
1004unsafe extern "C" {
1005 #[doc = "Frees all virtual allocations inside given #VmaVirtualBlock.\n\nYou must either call this function or free each virtual allocation individually with vmaVirtualFree()\nbefore destroying a virtual block. Otherwise, an assert is called.\n\nIf you keep pointer to some additional metadata associated with your virtual allocation in its `pUserData`,\ndon't forget to free it as well."]
1006 pub fn vmaClearVirtualBlock(virtualBlock: VmaVirtualBlock);
1007}
1008unsafe extern "C" {
1009 #[doc = "Changes custom pointer associated with given virtual allocation."]
1010 pub fn vmaSetVirtualAllocationUserData(
1011 virtualBlock: VmaVirtualBlock,
1012 allocation: VmaVirtualAllocation,
1013 pUserData: *mut ::core::ffi::c_void,
1014 );
1015}
1016unsafe extern "C" {
1017 #[doc = "Calculates and returns statistics about virtual allocations and memory usage in given #VmaVirtualBlock.\n\nThis function is fast to call. For more detailed statistics, see vmaCalculateVirtualBlockStatistics()."]
1018 pub fn vmaGetVirtualBlockStatistics(virtualBlock: VmaVirtualBlock, pStats: *mut VmaStatistics);
1019}
1020unsafe extern "C" {
1021 #[doc = "Calculates and returns detailed statistics about virtual allocations and memory usage in given #VmaVirtualBlock.\n\nThis function is slow to call. Use for debugging purposes.\nFor less detailed statistics, see vmaGetVirtualBlockStatistics()."]
1022 pub fn vmaCalculateVirtualBlockStatistics(
1023 virtualBlock: VmaVirtualBlock,
1024 pStats: *mut VmaDetailedStatistics,
1025 );
1026}
1027unsafe extern "C" {
1028 #[doc = "Builds and returns a null-terminated string in JSON format with information about given #VmaVirtualBlock.\n# Arguments\n\n* `virtualBlock` - Virtual block.\n* `ppStatsString` (direction out) - Returned string.\n* `detailedMap` - Pass `VK_FALSE` to only obtain statistics as returned by vmaCalculateVirtualBlockStatistics(). Pass `VK_TRUE` to also obtain full list of allocations and free spaces.\n\nReturned string must be freed using vmaFreeVirtualBlockStatsString()."]
1029 pub fn vmaBuildVirtualBlockStatsString(
1030 virtualBlock: VmaVirtualBlock,
1031 ppStatsString: *mut *mut ::core::ffi::c_char,
1032 detailedMap: Bool32,
1033 );
1034}
1035unsafe extern "C" {
1036 #[doc = "Frees a string returned by vmaBuildVirtualBlockStatsString()."]
1037 pub fn vmaFreeVirtualBlockStatsString(
1038 virtualBlock: VmaVirtualBlock,
1039 pStatsString: *mut ::core::ffi::c_char,
1040 );
1041}
1042unsafe extern "C" {
1043 #[doc = "Builds and returns statistics as a null-terminated string in JSON format.\n# Arguments\n\n* `allocator` -\n* `ppStatsString` (direction out) - Must be freed using vmaFreeStatsString() function.\n* `detailedMap` -"]
1044 pub fn vmaBuildStatsString(
1045 allocator: VmaAllocator,
1046 ppStatsString: *mut *mut ::core::ffi::c_char,
1047 detailedMap: Bool32,
1048 );
1049}
1050unsafe extern "C" {
1051 pub fn vmaFreeStatsString(allocator: VmaAllocator, pStatsString: *mut ::core::ffi::c_char);
1052}