1#![allow(non_camel_case_types)]
4#![allow(non_snake_case)]
5#![allow(dead_code)]
6use ash::vk::*;
7
8#[repr(u32)]
9#[doc = " Flags for created #VmaAllocator."]
10#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
11pub enum VmaAllocatorCreateFlagBits {
12 #[doc = " \\brief 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."]
13 VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT = 1,
14 #[doc = " \\brief 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."]
15 VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT = 2,
16 #[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()."]
17 VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT = 4,
18 #[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."]
19 VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT = 8,
20 #[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`."]
21 VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT = 16,
22 #[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 \\ref enabling_buffer_device_address."]
23 VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT = 32,
24 #[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."]
25 VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT = 64,
26 #[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."]
27 VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE4_BIT = 128,
28 #[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."]
29 VMA_ALLOCATOR_CREATE_KHR_MAINTENANCE5_BIT = 256,
30 #[doc = "Enables usage of VK_KHR_external_memory_win32 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.\nFor more information, see \\ref vk_khr_external_memory_win32."]
31 VMA_ALLOCATOR_CREATE_KHR_EXTERNAL_MEMORY_WIN32_BIT = 512,
32 #[doc = "Enables usage of VK_KHR_external_memory_win32 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.\nFor more information, see \\ref vk_khr_external_memory_win32."]
33 VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM = 2147483647,
34}
35#[doc = " See #VmaAllocatorCreateFlagBits."]
36pub type VmaAllocatorCreateFlags = Flags;
37#[repr(u32)]
38#[doc = " \\brief Intended usage of the allocated memory."]
39#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
40pub enum VmaMemoryUsage {
41 #[doc = " No intended memory usage specified.\nUse other members of VmaAllocationCreateInfo to specify your requirements."]
42 VMA_MEMORY_USAGE_UNKNOWN = 0,
43 #[doc = "\\deprecated Obsolete, preserved for backward compatibility.\nPrefers `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`."]
44 VMA_MEMORY_USAGE_GPU_ONLY = 1,
45 #[doc = "\\deprecated Obsolete, preserved for backward compatibility.\nGuarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` and `VK_MEMORY_PROPERTY_HOST_COHERENT_BIT`."]
46 VMA_MEMORY_USAGE_CPU_ONLY = 2,
47 #[doc = "\\deprecated Obsolete, preserved for backward compatibility.\nGuarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`, prefers `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`."]
48 VMA_MEMORY_USAGE_CPU_TO_GPU = 3,
49 #[doc = "\\deprecated Obsolete, preserved for backward compatibility.\nGuarantees `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT`, prefers `VK_MEMORY_PROPERTY_HOST_CACHED_BIT`."]
50 VMA_MEMORY_USAGE_GPU_TO_CPU = 4,
51 #[doc = "\\deprecated Obsolete, preserved for backward compatibility.\nPrefers not `VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT`."]
52 VMA_MEMORY_USAGE_CPU_COPY = 5,
53 #[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."]
54 VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED = 6,
55 #[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."]
56 VMA_MEMORY_USAGE_AUTO = 7,
57 #[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."]
58 VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE = 8,
59 #[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."]
60 VMA_MEMORY_USAGE_AUTO_PREFER_HOST = 9,
61 #[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."]
62 VMA_MEMORY_USAGE_MAX_ENUM = 2147483647,
63}
64impl VmaAllocationCreateFlagBits {
65 pub const VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT: VmaAllocationCreateFlagBits =
66 VmaAllocationCreateFlagBits::VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT;
67}
68impl VmaAllocationCreateFlagBits {
69 pub const VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT: VmaAllocationCreateFlagBits =
70 VmaAllocationCreateFlagBits::VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT;
71}
72#[repr(u32)]
73#[doc = " Flags to be passed as VmaAllocationCreateInfo::flags."]
74#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
75pub enum VmaAllocationCreateFlagBits {
76 #[doc = " \\brief 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."]
77 VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT = 1,
78 #[doc = " \\brief 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."]
79 VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT = 2,
80 #[doc = " \\brief 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)."]
81 VMA_ALLOCATION_CREATE_MAPPED_BIT = 4,
82 #[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()."]
83 VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT = 32,
84 #[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."]
85 VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT = 64,
86 #[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."]
87 VMA_ALLOCATION_CREATE_DONT_BIND_BIT = 128,
88 #[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`."]
89 VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT = 256,
90 #[doc = " \\brief 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."]
91 VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT = 512,
92 #[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 \\ref 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\n\\warning Violating 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."]
93 VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT = 1024,
94 #[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 \\ref 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."]
95 VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT = 2048,
96 #[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."]
97 VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT = 4096,
98 #[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."]
99 VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT = 65536,
100 #[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."]
101 VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT = 131072,
102 #[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."]
103 VMA_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT = 262144,
104 #[doc = " A bit mask to extract only `STRATEGY` bits from entire set of flags."]
105 VMA_ALLOCATION_CREATE_STRATEGY_MASK = 458752,
106 #[doc = " A bit mask to extract only `STRATEGY` bits from entire set of flags."]
107 VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM = 2147483647,
108}
109#[doc = " See #VmaAllocationCreateFlagBits."]
110pub type VmaAllocationCreateFlags = Flags;
111impl VmaPoolCreateFlagBits {
112 pub const VMA_POOL_CREATE_ALGORITHM_MASK: VmaPoolCreateFlagBits =
113 VmaPoolCreateFlagBits::VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT;
114}
115#[repr(u32)]
116#[doc = " Flags to be passed as VmaPoolCreateInfo::flags."]
117#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
118pub enum VmaPoolCreateFlagBits {
119 #[doc = " \\brief 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."]
120 VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT = 2,
121 #[doc = " \\brief 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 \\ref linear_algorithm."]
122 VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT = 4,
123 #[doc = " Bit mask to extract only `ALGORITHM` bits from entire set of flags."]
124 VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM = 2147483647,
125}
126#[doc = " Flags to be passed as VmaPoolCreateInfo::flags. See #VmaPoolCreateFlagBits."]
127pub type VmaPoolCreateFlags = Flags;
128#[repr(u32)]
129#[doc = " Flags to be passed as VmaDefragmentationInfo::flags."]
130#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
131pub enum VmaDefragmentationFlagBits {
132 VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FAST_BIT = 1,
133 VMA_DEFRAGMENTATION_FLAG_ALGORITHM_BALANCED_BIT = 2,
134 VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FULL_BIT = 4,
135 #[doc = " \\brief 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."]
136 VMA_DEFRAGMENTATION_FLAG_ALGORITHM_EXTENSIVE_BIT = 8,
137 #[doc = " A bit mask to extract only `ALGORITHM` bits from entire set of flags."]
138 VMA_DEFRAGMENTATION_FLAG_ALGORITHM_MASK = 15,
139 #[doc = " A bit mask to extract only `ALGORITHM` bits from entire set of flags."]
140 VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM = 2147483647,
141}
142#[doc = " See #VmaDefragmentationFlagBits."]
143pub type VmaDefragmentationFlags = Flags;
144#[repr(u32)]
145#[doc = " Operation performed on single defragmentation move. See structure #VmaDefragmentationMove."]
146#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
147pub enum VmaDefragmentationMoveOperation {
148 #[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()."]
149 VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY = 0,
150 #[doc = " Set this value if you cannot move the allocation. New place reserved at `dstTmpAllocation` will be freed. `srcAllocation` will remain unchanged."]
151 VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE = 1,
152 #[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."]
153 VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY = 2,
154}
155impl VmaVirtualBlockCreateFlagBits {
156 pub const VMA_VIRTUAL_BLOCK_CREATE_ALGORITHM_MASK: VmaVirtualBlockCreateFlagBits =
157 VmaVirtualBlockCreateFlagBits::VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT;
158}
159#[repr(u32)]
160#[doc = " Flags to be passed as VmaVirtualBlockCreateInfo::flags."]
161#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
162pub enum VmaVirtualBlockCreateFlagBits {
163 #[doc = " \\brief 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 \\ref linear_algorithm."]
164 VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT = 1,
165 #[doc = " \\brief Bit mask to extract only `ALGORITHM` bits from entire set of flags."]
166 VMA_VIRTUAL_BLOCK_CREATE_FLAG_BITS_MAX_ENUM = 2147483647,
167}
168#[doc = " Flags to be passed as VmaVirtualBlockCreateInfo::flags. See #VmaVirtualBlockCreateFlagBits."]
169pub type VmaVirtualBlockCreateFlags = Flags;
170#[repr(u32)]
171#[doc = " Flags to be passed as VmaVirtualAllocationCreateInfo::flags."]
172#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
173pub enum VmaVirtualAllocationCreateFlagBits {
174 #[doc = " \\brief 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."]
175 VMA_VIRTUAL_ALLOCATION_CREATE_UPPER_ADDRESS_BIT = 64,
176 #[doc = " \\brief Allocation strategy that tries to minimize memory usage."]
177 VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT = 65536,
178 #[doc = " \\brief Allocation strategy that tries to minimize allocation time."]
179 VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT = 131072,
180 #[doc = " Allocation strategy that chooses always the lowest offset in available space.\nThis is not the most efficient strategy but achieves highly packed data."]
181 VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT = 262144,
182 #[doc = " \\brief 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 VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MASK = 458752,
184 #[doc = " \\brief 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."]
185 VMA_VIRTUAL_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM = 2147483647,
186}
187#[doc = " Flags to be passed as VmaVirtualAllocationCreateInfo::flags. See #VmaVirtualAllocationCreateFlagBits."]
188pub type VmaVirtualAllocationCreateFlags = Flags;
189#[repr(C)]
190#[derive(Debug, Copy, Clone)]
191pub struct VmaAllocator_T {
192 _unused: [u8; 0],
193}
194#[doc = " \\struct VmaAllocator\n\\brief Represents main object of this library initialized.\n\nFill structure #VmaAllocatorCreateInfo and call function vmaCreateAllocator() to create it.\nCall function vmaDestroyAllocator() to destroy it.\n\nIt is recommended to create just one object of this type per `VkDevice` object,\nright after Vulkan is initialized and keep it alive until before Vulkan device is destroyed."]
195pub type VmaAllocator = *mut VmaAllocator_T;
196#[repr(C)]
197#[derive(Debug, Copy, Clone)]
198pub struct VmaPool_T {
199 _unused: [u8; 0],
200}
201#[doc = " \\struct VmaPool\n\\brief Represents custom memory pool\n\nFill structure VmaPoolCreateInfo and call function vmaCreatePool() to create it.\nCall function vmaDestroyPool() to destroy it.\n\nFor more information see [Custom memory pools](@ref choosing_memory_type_custom_memory_pools)."]
202pub type VmaPool = *mut VmaPool_T;
203#[repr(C)]
204#[derive(Debug, Copy, Clone)]
205pub struct VmaAllocation_T {
206 _unused: [u8; 0],
207}
208#[doc = " \\struct VmaAllocation\n\\brief Represents single memory allocation.\n\nIt may be either dedicated block of `VkDeviceMemory` or a specific region of a bigger block of this type\nplus unique offset.\n\nThere are multiple ways to create such object.\nYou need to fill structure VmaAllocationCreateInfo.\nFor more information see [Choosing memory type](@ref choosing_memory_type).\n\nAlthough the library provides convenience functions that create Vulkan buffer or image,\nallocate memory for it and bind them together,\nbinding of the allocation to a buffer or an image is out of scope of the allocation itself.\nAllocation object can exist without buffer/image bound,\nbinding can be done manually by the user, and destruction of it can be done\nindependently of destruction of the allocation.\n\nThe object also remembers its size and some other information.\nTo retrieve this information, use function vmaGetAllocationInfo() and inspect\nreturned structure VmaAllocationInfo."]
209pub type VmaAllocation = *mut VmaAllocation_T;
210#[repr(C)]
211#[derive(Debug, Copy, Clone)]
212pub struct VmaDefragmentationContext_T {
213 _unused: [u8; 0],
214}
215#[doc = " \\struct VmaDefragmentationContext\n\\brief An opaque object that represents started defragmentation process.\n\nFill structure #VmaDefragmentationInfo and call function vmaBeginDefragmentation() to create it.\nCall function vmaEndDefragmentation() to destroy it."]
216pub type VmaDefragmentationContext = *mut VmaDefragmentationContext_T;
217#[repr(C)]
218#[derive(Debug, Copy, Clone)]
219pub struct VmaVirtualAllocation_T {
220 _unused: [u8; 0],
221}
222#[doc = " \\struct VmaVirtualAllocation\n\\brief Represents single memory allocation done inside VmaVirtualBlock.\n\nUse it as a unique identifier to virtual allocation within the single block.\n\nUse value `VK_NULL_HANDLE` to represent a null/invalid allocation."]
223pub type VmaVirtualAllocation = *mut VmaVirtualAllocation_T;
224#[repr(C)]
225#[derive(Debug, Copy, Clone)]
226pub struct VmaVirtualBlock_T {
227 _unused: [u8; 0],
228}
229#[doc = " \\struct VmaVirtualBlock\n\\brief Handle to a virtual block object that allows to use core allocation algorithm without allocating any real GPU memory.\n\nFill in #VmaVirtualBlockCreateInfo structure and use vmaCreateVirtualBlock() to create it. Use vmaDestroyVirtualBlock() to destroy it.\nFor more information, see documentation chapter \\ref virtual_allocator.\n\nThis object is not thread-safe - should not be used from multiple threads simultaneously, must be synchronized externally."]
230pub type VmaVirtualBlock = *mut VmaVirtualBlock_T;
231#[doc = " Callback function called after successful vkAllocateMemory."]
232pub type PFN_vmaAllocateDeviceMemoryFunction = ::std::option::Option<
233 unsafe extern "C" fn(
234 allocator: VmaAllocator,
235 memoryType: u32,
236 memory: DeviceMemory,
237 size: DeviceSize,
238 pUserData: *mut ::std::os::raw::c_void,
239 ),
240>;
241#[doc = " Callback function called before vkFreeMemory."]
242pub type PFN_vmaFreeDeviceMemoryFunction = ::std::option::Option<
243 unsafe extern "C" fn(
244 allocator: VmaAllocator,
245 memoryType: u32,
246 memory: DeviceMemory,
247 size: DeviceSize,
248 pUserData: *mut ::std::os::raw::c_void,
249 ),
250>;
251#[doc = " \\brief 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."]
252#[repr(C)]
253#[derive(Debug, Copy, Clone)]
254pub struct VmaDeviceMemoryCallbacks {
255 #[doc = " Optional, can be null."]
256 pub pfnAllocate: PFN_vmaAllocateDeviceMemoryFunction,
257 #[doc = " Optional, can be null."]
258 pub pfnFree: PFN_vmaFreeDeviceMemoryFunction,
259 #[doc = " Optional, can be null."]
260 pub pUserData: *mut ::std::os::raw::c_void,
261}
262#[doc = " \\brief Pointers to some Vulkan functions - a subset used by the library.\n\nUsed in VmaAllocatorCreateInfo::pVulkanFunctions."]
263#[repr(C)]
264pub struct VmaVulkanFunctions {
265 #[doc = " Required when using VMA_DYNAMIC_VULKAN_FUNCTIONS."]
266 pub vkGetInstanceProcAddr: PFN_vkGetInstanceProcAddr,
267 #[doc = " Required when using VMA_DYNAMIC_VULKAN_FUNCTIONS."]
268 pub vkGetDeviceProcAddr: PFN_vkGetDeviceProcAddr,
269 pub vkGetPhysicalDeviceProperties: PFN_vkGetPhysicalDeviceProperties,
270 pub vkGetPhysicalDeviceMemoryProperties: PFN_vkGetPhysicalDeviceMemoryProperties,
271 pub vkAllocateMemory: PFN_vkAllocateMemory,
272 pub vkFreeMemory: PFN_vkFreeMemory,
273 pub vkMapMemory: PFN_vkMapMemory,
274 pub vkUnmapMemory: PFN_vkUnmapMemory,
275 pub vkFlushMappedMemoryRanges: PFN_vkFlushMappedMemoryRanges,
276 pub vkInvalidateMappedMemoryRanges: PFN_vkInvalidateMappedMemoryRanges,
277 pub vkBindBufferMemory: PFN_vkBindBufferMemory,
278 pub vkBindImageMemory: PFN_vkBindImageMemory,
279 pub vkGetBufferMemoryRequirements: PFN_vkGetBufferMemoryRequirements,
280 pub vkGetImageMemoryRequirements: PFN_vkGetImageMemoryRequirements,
281 pub vkCreateBuffer: PFN_vkCreateBuffer,
282 pub vkDestroyBuffer: PFN_vkDestroyBuffer,
283 pub vkCreateImage: PFN_vkCreateImage,
284 pub vkDestroyImage: PFN_vkDestroyImage,
285 pub vkCmdCopyBuffer: PFN_vkCmdCopyBuffer,
286 #[doc = " Fetch \"vkGetBufferMemoryRequirements2\" on Vulkan >= 1.1, fetch \"vkGetBufferMemoryRequirements2KHR\" when using VK_KHR_dedicated_allocation extension."]
287 pub vkGetBufferMemoryRequirements2KHR: PFN_vkGetBufferMemoryRequirements2,
288 #[doc = " Fetch \"vkGetImageMemoryRequirements2\" on Vulkan >= 1.1, fetch \"vkGetImageMemoryRequirements2KHR\" when using VK_KHR_dedicated_allocation extension."]
289 pub vkGetImageMemoryRequirements2KHR: PFN_vkGetImageMemoryRequirements2,
290 #[doc = " Fetch \"vkBindBufferMemory2\" on Vulkan >= 1.1, fetch \"vkBindBufferMemory2KHR\" when using VK_KHR_bind_memory2 extension."]
291 pub vkBindBufferMemory2KHR: PFN_vkBindBufferMemory2,
292 #[doc = " Fetch \"vkBindImageMemory2\" on Vulkan >= 1.1, fetch \"vkBindImageMemory2KHR\" when using VK_KHR_bind_memory2 extension."]
293 pub vkBindImageMemory2KHR: PFN_vkBindImageMemory2,
294 #[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."]
295 pub vkGetPhysicalDeviceMemoryProperties2KHR: PFN_vkGetPhysicalDeviceMemoryProperties2,
296 #[doc = " Fetch from \"vkGetDeviceBufferMemoryRequirements\" on Vulkan >= 1.3, but you can also fetch it from \"vkGetDeviceBufferMemoryRequirementsKHR\" if you enabled extension VK_KHR_maintenance4."]
297 pub vkGetDeviceBufferMemoryRequirements: PFN_vkGetDeviceBufferMemoryRequirements,
298 #[doc = " Fetch from \"vkGetDeviceImageMemoryRequirements\" on Vulkan >= 1.3, but you can also fetch it from \"vkGetDeviceImageMemoryRequirementsKHR\" if you enabled extension VK_KHR_maintenance4."]
299 pub vkGetDeviceImageMemoryRequirements: PFN_vkGetDeviceImageMemoryRequirements,
300 pub vkGetMemoryWin32HandleKHR: *mut ::std::os::raw::c_void,
301}
302#[doc = " Description of a Allocator to be created."]
303#[repr(C)]
304pub struct VmaAllocatorCreateInfo {
305 #[doc = " Flags for created allocator. Use #VmaAllocatorCreateFlagBits enum."]
306 pub flags: VmaAllocatorCreateFlags,
307 #[doc = " Vulkan physical device.\n** It must be valid throughout whole lifetime of created allocator. */"]
308 pub physicalDevice: PhysicalDevice,
309 #[doc = " Vulkan device.\n** It must be valid throughout whole lifetime of created allocator. */"]
310 pub device: Device,
311 #[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. */"]
312 pub preferredLargeHeapBlockSize: DeviceSize,
313 #[doc = " Custom CPU memory allocation callbacks. Optional.\n** Optional, can be null. When specified, will also be used for all CPU-side memory allocations. */"]
314 pub pAllocationCallbacks: *const AllocationCallbacks<'static>,
315 #[doc = " Informative callbacks for `vkAllocateMemory`, `vkFreeMemory`. Optional.\n** Optional, can be null. */"]
316 pub pDeviceMemoryCallbacks: *const VmaDeviceMemoryCallbacks,
317 #[doc = " \\brief 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."]
318 pub pHeapSizeLimit: *const DeviceSize,
319 #[doc = " \\brief Pointers to Vulkan functions. Can be null.\n\nFor details see [Pointers to Vulkan functions](@ref config_Vulkan_functions)."]
320 pub pVulkanFunctions: *const VmaVulkanFunctions,
321 #[doc = " \\brief Handle to Vulkan instance object.\n\nStarting from version 3.0.0 this member is no longer optional, it must be set!"]
322 pub instance: Instance,
323 #[doc = " \\brief 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.4 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."]
324 pub vulkanApiVersion: u32,
325 #[doc = " \\brief 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."]
326 pub pTypeExternalMemoryHandleTypes: *const ExternalMemoryHandleTypeFlagsKHR,
327}
328#[doc = " Information about existing #VmaAllocator object."]
329#[repr(C)]
330pub struct VmaAllocatorInfo {
331 #[doc = " \\brief Handle to Vulkan instance object.\n\nThis is the same value as has been passed through VmaAllocatorCreateInfo::instance."]
332 pub instance: Instance,
333 #[doc = " \\brief Handle to Vulkan physical device object.\n\nThis is the same value as has been passed through VmaAllocatorCreateInfo::physicalDevice."]
334 pub physicalDevice: PhysicalDevice,
335 #[doc = " \\brief Handle to Vulkan device object.\n\nThis is the same value as has been passed through VmaAllocatorCreateInfo::device."]
336 pub device: Device,
337}
338#[doc = " \\brief 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()."]
339#[repr(C)]
340pub struct VmaStatistics {
341 #[doc = " \\brief Number of `VkDeviceMemory` objects - Vulkan memory blocks allocated."]
342 pub blockCount: u32,
343 #[doc = " \\brief Number of #VmaAllocation objects allocated.\n\nDedicated allocations have their own blocks, so each one adds 1 to `allocationCount` as well as `blockCount`."]
344 pub allocationCount: u32,
345 #[doc = " \\brief 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."]
346 pub blockBytes: DeviceSize,
347 #[doc = " \\brief 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."]
348 pub allocationBytes: DeviceSize,
349}
350#[doc = " \\brief 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\n\\code\nVkDeviceSize allocationSizeAvg = detailedStats.statistics.allocationBytes / detailedStats.statistics.allocationCount;\nVkDeviceSize unusedBytes = detailedStats.statistics.blockBytes - detailedStats.statistics.allocationBytes;\nVkDeviceSize unusedRangeSizeAvg = unusedBytes / detailedStats.unusedRangeCount;\n\\endcode"]
351#[repr(C)]
352pub struct VmaDetailedStatistics {
353 #[doc = " Basic statistics."]
354 pub statistics: VmaStatistics,
355 #[doc = " Number of free ranges of memory between allocations."]
356 pub unusedRangeCount: u32,
357 #[doc = " Smallest allocation size. `VK_WHOLE_SIZE` if there are 0 allocations."]
358 pub allocationSizeMin: DeviceSize,
359 #[doc = " Largest allocation size. 0 if there are 0 allocations."]
360 pub allocationSizeMax: DeviceSize,
361 #[doc = " Smallest empty range size. `VK_WHOLE_SIZE` if there are 0 empty ranges."]
362 pub unusedRangeSizeMin: DeviceSize,
363 #[doc = " Largest empty range size. 0 if there are 0 empty ranges."]
364 pub unusedRangeSizeMax: DeviceSize,
365}
366#[doc = " \\brief 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()."]
367#[repr(C)]
368pub struct VmaTotalStatistics {
369 pub memoryType: [VmaDetailedStatistics; 32usize],
370 pub memoryHeap: [VmaDetailedStatistics; 16usize],
371 pub total: VmaDetailedStatistics,
372}
373#[doc = " \\brief Statistics of current memory usage and available budget for a specific memory heap.\n\nThese are fast to calculate.\nSee function vmaGetHeapBudgets()."]
374#[repr(C)]
375pub struct VmaBudget {
376 #[doc = " \\brief Statistics fetched from the library."]
377 pub statistics: VmaStatistics,
378 #[doc = " \\brief 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."]
379 pub usage: DeviceSize,
380 #[doc = " \\brief 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."]
381 pub budget: DeviceSize,
382}
383#[doc = " \\brief Parameters of new #VmaAllocation.\n\nTo be used with functions like vmaCreateBuffer(), vmaCreateImage(), and many others."]
384#[repr(C)]
385pub struct VmaAllocationCreateInfo {
386 #[doc = " Use #VmaAllocationCreateFlagBits enum."]
387 pub flags: VmaAllocationCreateFlags,
388 #[doc = " \\brief Intended usage of memory.\n\nYou can leave #VMA_MEMORY_USAGE_UNKNOWN if you specify memory requirements in other way. \\n\nIf `pool` is not null, this member is ignored."]
389 pub usage: VmaMemoryUsage,
390 #[doc = " \\brief Flags that must be set in a Memory Type chosen for an allocation.\n\nLeave 0 if you specify memory requirements in other way. \\n\nIf `pool` is not null, this member is ignored."]
391 pub requiredFlags: MemoryPropertyFlags,
392 #[doc = " \\brief Flags that preferably should be set in a memory type chosen for an allocation.\n\nSet to 0 if no additional flags are preferred. \\n\nIf `pool` is not null, this member is ignored."]
393 pub preferredFlags: MemoryPropertyFlags,
394 #[doc = " \\brief 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. \\n\nIf `pool` is not null, this member is ignored."]
395 pub memoryTypeBits: u32,
396 #[doc = " \\brief 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."]
397 pub pool: VmaPool,
398 #[doc = " \\brief 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."]
399 pub pUserData: *mut ::std::os::raw::c_void,
400 #[doc = " \\brief 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."]
401 pub priority: f32,
402}
403#[doc = " Describes parameter of created #VmaPool."]
404#[repr(C)]
405pub struct VmaPoolCreateInfo {
406 #[doc = " \\brief Vulkan memory type index to allocate this pool from."]
407 pub memoryTypeIndex: u32,
408 #[doc = " \\brief Use combination of #VmaPoolCreateFlagBits."]
409 pub flags: VmaPoolCreateFlags,
410 #[doc = " \\brief 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."]
411 pub blockSize: DeviceSize,
412 #[doc = " \\brief 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."]
413 pub minBlockCount: usize,
414 #[doc = " \\brief 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."]
415 pub maxBlockCount: usize,
416 #[doc = " \\brief 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."]
417 pub priority: f32,
418 #[doc = " \\brief 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."]
419 pub minAllocationAlignment: DeviceSize,
420 #[doc = " \\brief 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."]
421 pub pMemoryAllocateNext: *mut ::std::os::raw::c_void,
422}
423#[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."]
424#[repr(C)]
425#[derive(Debug, Copy, Clone)]
426pub struct VmaAllocationInfo {
427 #[doc = " \\brief Memory type index that this allocation was allocated from.\n\nIt never changes."]
428 pub memoryType: u32,
429 #[doc = " \\brief 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 \\ref defragmentation."]
430 pub deviceMemory: DeviceMemory,
431 #[doc = " \\brief 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 \\ref defragmentation."]
432 pub offset: DeviceSize,
433 #[doc = " \\brief 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."]
434 pub size: DeviceSize,
435 #[doc = " \\brief 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 \\ref defragmentation."]
436 pub pMappedData: *mut ::std::os::raw::c_void,
437 #[doc = " \\brief 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."]
438 pub pUserData: *mut ::std::os::raw::c_void,
439 #[doc = " \\brief 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]."]
440 pub pName: *const ::std::os::raw::c_char,
441}
442#[doc = " Extended parameters of a #VmaAllocation object that can be retrieved using function vmaGetAllocationInfo2()."]
443#[repr(C)]
444#[derive(Debug, Copy, Clone)]
445pub struct VmaAllocationInfo2 {
446 #[doc = " \\brief Basic parameters of the allocation.\n\nIf you need only these, you can use function vmaGetAllocationInfo() and structure #VmaAllocationInfo instead."]
447 pub allocationInfo: VmaAllocationInfo,
448 #[doc = " \\brief 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`."]
449 pub blockSize: DeviceSize,
450 #[doc = " \\brief `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)."]
451 pub dedicatedMemory: Bool32,
452}
453#[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."]
454pub type PFN_vmaCheckDefragmentationBreakFunction =
455 ::std::option::Option<unsafe extern "C" fn(pUserData: *mut ::std::os::raw::c_void) -> Bool32>;
456#[doc = " \\brief Parameters for defragmentation.\n\nTo be used with function vmaBeginDefragmentation()."]
457#[repr(C)]
458pub struct VmaDefragmentationInfo {
459 #[doc = " \\brief Use combination of #VmaDefragmentationFlagBits."]
460 pub flags: VmaDefragmentationFlags,
461 #[doc = " \\brief Custom pool to be defragmented.\n\nIf null then default pools will undergo defragmentation process."]
462 pub pool: VmaPool,
463 #[doc = " \\brief Maximum numbers of bytes that can be copied during single pass, while moving allocations to different places.\n\n`0` means no limit."]
464 pub maxBytesPerPass: DeviceSize,
465 #[doc = " \\brief Maximum number of allocations that can be moved during single pass to a different place.\n\n`0` means no limit."]
466 pub maxAllocationsPerPass: u32,
467 #[doc = " \\brief Optional custom callback for stopping vmaBeginDefragmentation().\n\nHave to return true for breaking current defragmentation pass."]
468 pub pfnBreakCallback: PFN_vmaCheckDefragmentationBreakFunction,
469 #[doc = " \\brief Optional data to pass to custom callback for stopping pass of defragmentation."]
470 pub pBreakCallbackUserData: *mut ::std::os::raw::c_void,
471}
472#[doc = " Single move of an allocation to be done for defragmentation."]
473#[repr(C)]
474#[derive(Debug, Copy, Clone)]
475pub struct VmaDefragmentationMove {
476 #[doc = " Operation to be performed on the allocation by vmaEndDefragmentationPass(). Default value is #VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY. You can modify it."]
477 pub operation: VmaDefragmentationMoveOperation,
478 #[doc = " Allocation that should be moved."]
479 pub srcAllocation: VmaAllocation,
480 #[doc = " \\brief Temporary allocation pointing to destination memory that will replace `srcAllocation`.\n\n\\warning Do 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."]
481 pub dstTmpAllocation: VmaAllocation,
482}
483#[doc = " \\brief Parameters for incremental defragmentation steps.\n\nTo be used with function vmaBeginDefragmentationPass()."]
484#[repr(C)]
485#[derive(Debug, Copy, Clone)]
486pub struct VmaDefragmentationPassMoveInfo {
487 #[doc = " Number of elements in the `pMoves` array."]
488 pub moveCount: u32,
489 #[doc = " \\brief 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."]
490 pub pMoves: *mut VmaDefragmentationMove,
491}
492#[doc = " Statistics returned for defragmentation process in function vmaEndDefragmentation()."]
493#[repr(C)]
494#[derive(Debug, Copy, Clone)]
495pub struct VmaDefragmentationStats {
496 #[doc = " Total number of bytes that have been copied while moving allocations to different places."]
497 pub bytesMoved: DeviceSize,
498 #[doc = " Total number of bytes that have been released to the system by freeing empty `VkDeviceMemory` objects."]
499 pub bytesFreed: DeviceSize,
500 #[doc = " Number of allocations that have been moved to different places."]
501 pub allocationsMoved: u32,
502 #[doc = " Number of empty `VkDeviceMemory` objects that have been released to the system."]
503 pub deviceMemoryBlocksFreed: u32,
504}
505#[doc = " Parameters of created #VmaVirtualBlock object to be passed to vmaCreateVirtualBlock()."]
506#[repr(C)]
507pub struct VmaVirtualBlockCreateInfo {
508 #[doc = " \\brief 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."]
509 pub size: DeviceSize,
510 #[doc = " \\brief Use combination of #VmaVirtualBlockCreateFlagBits."]
511 pub flags: VmaVirtualBlockCreateFlags,
512 #[doc = " \\brief Custom CPU memory allocation callbacks. Optional.\n\nOptional, can be null. When specified, they will be used for all CPU-side memory allocations."]
513 pub pAllocationCallbacks: *const AllocationCallbacks<'static>,
514}
515#[doc = " Parameters of created virtual allocation to be passed to vmaVirtualAllocate()."]
516#[repr(C)]
517pub struct VmaVirtualAllocationCreateInfo {
518 #[doc = " \\brief Size of the allocation.\n\nCannot be zero."]
519 pub size: DeviceSize,
520 #[doc = " \\brief 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."]
521 pub alignment: DeviceSize,
522 #[doc = " \\brief Use combination of #VmaVirtualAllocationCreateFlagBits."]
523 pub flags: VmaVirtualAllocationCreateFlags,
524 #[doc = " \\brief 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."]
525 pub pUserData: *mut ::std::os::raw::c_void,
526}
527#[doc = " Parameters of an existing virtual allocation, returned by vmaGetVirtualAllocationInfo()."]
528#[repr(C)]
529pub struct VmaVirtualAllocationInfo {
530 #[doc = " \\brief Offset of the allocation.\n\nOffset at which the allocation was made."]
531 pub offset: DeviceSize,
532 #[doc = " \\brief Size of the allocation.\n\nSame value as passed in VmaVirtualAllocationCreateInfo::size."]
533 pub size: DeviceSize,
534 #[doc = " \\brief Custom pointer associated with the allocation.\n\nSame value as passed in VmaVirtualAllocationCreateInfo::pUserData or to vmaSetVirtualAllocationUserData()."]
535 pub pUserData: *mut ::std::os::raw::c_void,
536}
537extern "C" {
538 #[doc = " Creates #VmaAllocator object."]
539 pub fn vmaCreateAllocator(
540 pCreateInfo: *const VmaAllocatorCreateInfo,
541 pAllocator: *mut VmaAllocator,
542 ) -> Result;
543}
544extern "C" {
545 #[doc = " Destroys allocator object."]
546 pub fn vmaDestroyAllocator(allocator: VmaAllocator);
547}
548extern "C" {
549 #[doc = " \\brief 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."]
550 pub fn vmaGetAllocatorInfo(allocator: VmaAllocator, pAllocatorInfo: *mut VmaAllocatorInfo);
551}
552extern "C" {
553 #[doc = "PhysicalDeviceProperties are fetched from physicalDevice by the allocator.\nYou can access it here, without fetching it again on your own."]
554 pub fn vmaGetPhysicalDeviceProperties(
555 allocator: VmaAllocator,
556 ppPhysicalDeviceProperties: *mut *const PhysicalDeviceProperties,
557 );
558}
559extern "C" {
560 #[doc = "PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator.\nYou can access it here, without fetching it again on your own."]
561 pub fn vmaGetMemoryProperties(
562 allocator: VmaAllocator,
563 ppPhysicalDeviceMemoryProperties: *mut *const PhysicalDeviceMemoryProperties,
564 );
565}
566extern "C" {
567 #[doc = "\\brief 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()."]
568 pub fn vmaGetMemoryTypeProperties(
569 allocator: VmaAllocator,
570 memoryTypeIndex: u32,
571 pFlags: *mut MemoryPropertyFlags,
572 );
573}
574extern "C" {
575 #[doc = " \\brief Sets index of the current frame."]
576 pub fn vmaSetCurrentFrameIndex(allocator: VmaAllocator, frameIndex: u32);
577}
578extern "C" {
579 #[doc = " \\brief 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."]
580 pub fn vmaCalculateStatistics(allocator: VmaAllocator, pStats: *mut VmaTotalStatistics);
581}
582extern "C" {
583 #[doc = " \\brief Retrieves information about current memory usage and budget for all memory heaps.\n\n\\param allocator\n\\param[out] pBudgets 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."]
584 pub fn vmaGetHeapBudgets(allocator: VmaAllocator, pBudgets: *mut VmaBudget);
585}
586extern "C" {
587 #[doc = "\\brief 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\\return Returns `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."]
588 pub fn vmaFindMemoryTypeIndex(
589 allocator: VmaAllocator,
590 memoryTypeBits: u32,
591 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
592 pMemoryTypeIndex: *mut u32,
593 ) -> Result;
594}
595extern "C" {
596 #[doc = "\\brief 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 may need to internally create a temporary, dummy buffer that never has memory bound."]
597 pub fn vmaFindMemoryTypeIndexForBufferInfo(
598 allocator: VmaAllocator,
599 pBufferCreateInfo: *const BufferCreateInfo,
600 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
601 pMemoryTypeIndex: *mut u32,
602 ) -> Result;
603}
604extern "C" {
605 #[doc = "\\brief 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 may need to internally create a temporary, dummy image that never has memory bound."]
606 pub fn vmaFindMemoryTypeIndexForImageInfo(
607 allocator: VmaAllocator,
608 pImageCreateInfo: *const ImageCreateInfo,
609 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
610 pMemoryTypeIndex: *mut u32,
611 ) -> Result;
612}
613extern "C" {
614 #[doc = " \\brief Allocates Vulkan device memory and creates #VmaPool object.\n\n\\param allocator Allocator object.\n\\param pCreateInfo Parameters of pool to create.\n\\param[out] pPool Handle to created pool."]
615 pub fn vmaCreatePool(
616 allocator: VmaAllocator,
617 pCreateInfo: *const VmaPoolCreateInfo,
618 pPool: *mut VmaPool,
619 ) -> Result;
620}
621extern "C" {
622 #[doc = " \\brief Destroys #VmaPool object and frees Vulkan device memory."]
623 pub fn vmaDestroyPool(allocator: VmaAllocator, pool: VmaPool);
624}
625extern "C" {
626 #[doc = " \\brief Retrieves statistics of existing #VmaPool object.\n\n\\param allocator Allocator object.\n\\param pool Pool object.\n\\param[out] pPoolStats Statistics of specified pool.\n\nNote that when using the pool from multiple threads, returned information may immediately\nbecome outdated."]
627 pub fn vmaGetPoolStatistics(
628 allocator: VmaAllocator,
629 pool: VmaPool,
630 pPoolStats: *mut VmaStatistics,
631 );
632}
633extern "C" {
634 #[doc = " \\brief Retrieves detailed statistics of existing #VmaPool object.\n\n\\param allocator Allocator object.\n\\param pool Pool object.\n\\param[out] pPoolStats Statistics of specified pool."]
635 pub fn vmaCalculatePoolStatistics(
636 allocator: VmaAllocator,
637 pool: VmaPool,
638 pPoolStats: *mut VmaDetailedStatistics,
639 );
640}
641extern "C" {
642 #[doc = " \\brief 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](@ref 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."]
643 pub fn vmaCheckPoolCorruption(allocator: VmaAllocator, pool: VmaPool) -> Result;
644}
645extern "C" {
646 #[doc = " \\brief 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()."]
647 pub fn vmaGetPoolName(
648 allocator: VmaAllocator,
649 pool: VmaPool,
650 ppName: *mut *const ::std::os::raw::c_char,
651 );
652}
653extern "C" {
654 #[doc = " \\brief 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."]
655 pub fn vmaSetPoolName(
656 allocator: VmaAllocator,
657 pool: VmaPool,
658 pName: *const ::std::os::raw::c_char,
659 );
660}
661extern "C" {
662 #[doc = " \\brief General purpose memory allocation.\n\n\\param allocator\n\\param pVkMemoryRequirements\n\\param pCreateInfo\n\\param[out] pAllocation Handle to allocated memory.\n\\param[out] pAllocationInfo 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."]
663 pub fn vmaAllocateMemory(
664 allocator: VmaAllocator,
665 pVkMemoryRequirements: *const MemoryRequirements,
666 pCreateInfo: *const VmaAllocationCreateInfo,
667 pAllocation: *mut VmaAllocation,
668 pAllocationInfo: *mut VmaAllocationInfo,
669 ) -> Result;
670}
671extern "C" {
672 #[doc = " \\brief General purpose memory allocation for multiple allocation objects at once.\n\n\\param allocator Allocator object.\n\\param pVkMemoryRequirements Memory requirements for each allocation.\n\\param pCreateInfo Creation parameters for each allocation.\n\\param allocationCount Number of allocations to make.\n\\param[out] pAllocations Pointer to array that will be filled with handles to created allocations.\n\\param[out] pAllocationInfo 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`."]
673 pub fn vmaAllocateMemoryPages(
674 allocator: VmaAllocator,
675 pVkMemoryRequirements: *const MemoryRequirements,
676 pCreateInfo: *const VmaAllocationCreateInfo,
677 allocationCount: usize,
678 pAllocations: *mut VmaAllocation,
679 pAllocationInfo: *mut VmaAllocationInfo,
680 ) -> Result;
681}
682extern "C" {
683 #[doc = " \\brief Allocates memory suitable for given `VkBuffer`.\n\n\\param allocator\n\\param buffer\n\\param pCreateInfo\n\\param[out] pAllocation Handle to allocated memory.\n\\param[out] pAllocationInfo 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."]
684 pub fn vmaAllocateMemoryForBuffer(
685 allocator: VmaAllocator,
686 buffer: Buffer,
687 pCreateInfo: *const VmaAllocationCreateInfo,
688 pAllocation: *mut VmaAllocation,
689 pAllocationInfo: *mut VmaAllocationInfo,
690 ) -> Result;
691}
692extern "C" {
693 #[doc = " \\brief Allocates memory suitable for given `VkImage`.\n\n\\param allocator\n\\param image\n\\param pCreateInfo\n\\param[out] pAllocation Handle to allocated memory.\n\\param[out] pAllocationInfo 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."]
694 pub fn vmaAllocateMemoryForImage(
695 allocator: VmaAllocator,
696 image: Image,
697 pCreateInfo: *const VmaAllocationCreateInfo,
698 pAllocation: *mut VmaAllocation,
699 pAllocationInfo: *mut VmaAllocationInfo,
700 ) -> Result;
701}
702extern "C" {
703 #[doc = " \\brief Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage().\n\nPassing `VK_NULL_HANDLE` as `allocation` is valid. Such function call is just skipped."]
704 pub fn vmaFreeMemory(allocator: VmaAllocator, allocation: VmaAllocation);
705}
706extern "C" {
707 #[doc = " \\brief 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."]
708 pub fn vmaFreeMemoryPages(
709 allocator: VmaAllocator,
710 allocationCount: usize,
711 pAllocations: *const *mut VmaAllocation_T,
712 );
713}
714extern "C" {
715 #[doc = " \\brief 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."]
716 pub fn vmaGetAllocationInfo(
717 allocator: VmaAllocator,
718 allocation: VmaAllocation,
719 pAllocationInfo: *mut VmaAllocationInfo,
720 );
721}
722extern "C" {
723 #[doc = " \\brief 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."]
724 pub fn vmaGetAllocationInfo2(
725 allocator: VmaAllocator,
726 allocation: VmaAllocation,
727 pAllocationInfo: *mut VmaAllocationInfo2,
728 );
729}
730extern "C" {
731 #[doc = " \\brief 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."]
732 pub fn vmaSetAllocationUserData(
733 allocator: VmaAllocator,
734 allocation: VmaAllocation,
735 pUserData: *mut ::std::os::raw::c_void,
736 );
737}
738extern "C" {
739 #[doc = " \\brief 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."]
740 pub fn vmaSetAllocationName(
741 allocator: VmaAllocator,
742 allocation: VmaAllocation,
743 pName: *const ::std::os::raw::c_char,
744 );
745}
746extern "C" {
747 #[doc = "\\brief 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()."]
748 pub fn vmaGetAllocationMemoryProperties(
749 allocator: VmaAllocator,
750 allocation: VmaAllocation,
751 pFlags: *mut MemoryPropertyFlags,
752 );
753}
754extern "C" {
755 #[doc = " \\brief 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\n\\warning\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."]
756 pub fn vmaMapMemory(
757 allocator: VmaAllocator,
758 allocation: VmaAllocation,
759 ppData: *mut *mut ::std::os::raw::c_void,
760 ) -> Result;
761}
762extern "C" {
763 #[doc = " \\brief 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."]
764 pub fn vmaUnmapMemory(allocator: VmaAllocator, allocation: VmaAllocation);
765}
766extern "C" {
767 #[doc = " \\brief 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`."]
768 pub fn vmaFlushAllocation(
769 allocator: VmaAllocator,
770 allocation: VmaAllocation,
771 offset: DeviceSize,
772 size: DeviceSize,
773 ) -> Result;
774}
775extern "C" {
776 #[doc = " \\brief 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`."]
777 pub fn vmaInvalidateAllocation(
778 allocator: VmaAllocator,
779 allocation: VmaAllocation,
780 offset: DeviceSize,
781 size: DeviceSize,
782 ) -> Result;
783}
784extern "C" {
785 #[doc = " \\brief 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\\param allocator\n\\param allocationCount\n\\param allocations\n\\param 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\\param 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`."]
786 pub fn vmaFlushAllocations(
787 allocator: VmaAllocator,
788 allocationCount: u32,
789 allocations: *const *mut VmaAllocation_T,
790 offsets: *const DeviceSize,
791 sizes: *const DeviceSize,
792 ) -> Result;
793}
794extern "C" {
795 #[doc = " \\brief 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\\param allocator\n\\param allocationCount\n\\param allocations\n\\param 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\\param 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`."]
796 pub fn vmaInvalidateAllocations(
797 allocator: VmaAllocator,
798 allocationCount: u32,
799 allocations: *const *mut VmaAllocation_T,
800 offsets: *const DeviceSize,
801 sizes: *const DeviceSize,
802 ) -> Result;
803}
804extern "C" {
805 #[doc = " \\brief 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\\param allocator\n\\param pSrcHostPointer Pointer to the host data that become source of the copy.\n\\param dstAllocation Handle to the allocation that becomes destination of the copy.\n\\param dstAllocationLocalOffset Offset within `dstAllocation` where to write copied data, in bytes.\n\\param 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!"]
806 pub fn vmaCopyMemoryToAllocation(
807 allocator: VmaAllocator,
808 pSrcHostPointer: *const ::std::os::raw::c_void,
809 dstAllocation: VmaAllocation,
810 dstAllocationLocalOffset: DeviceSize,
811 size: DeviceSize,
812 ) -> Result;
813}
814extern "C" {
815 #[doc = " \\brief 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\\param allocator\n\\param srcAllocation Handle to the allocation that becomes source of the copy.\n\\param srcAllocationLocalOffset Offset within `srcAllocation` where to read copied data, in bytes.\n\\param pDstHostPointer Pointer to the host memory that become destination of the copy.\n\\param 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!"]
816 pub fn vmaCopyAllocationToMemory(
817 allocator: VmaAllocator,
818 srcAllocation: VmaAllocation,
819 srcAllocationLocalOffset: DeviceSize,
820 pDstHostPointer: *mut ::std::os::raw::c_void,
821 size: DeviceSize,
822 ) -> Result;
823}
824extern "C" {
825 #[doc = " \\brief Checks magic number in margins around all allocations in given memory types (in both default and custom pools) in search for corruptions.\n\n\\param allocator\n\\param 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](@ref 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."]
826 pub fn vmaCheckCorruption(allocator: VmaAllocator, memoryTypeBits: u32) -> Result;
827}
828extern "C" {
829 #[doc = " \\brief Begins defragmentation process.\n\n\\param allocator Allocator object.\n\\param pInfo Structure filled with parameters of defragmentation.\n\\param[out] pContext Context object that must be passed to vmaEndDefragmentation() to finish defragmentation.\n\\returns\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](@ref defragmentation)."]
830 pub fn vmaBeginDefragmentation(
831 allocator: VmaAllocator,
832 pInfo: *const VmaDefragmentationInfo,
833 pContext: *mut VmaDefragmentationContext,
834 ) -> Result;
835}
836extern "C" {
837 #[doc = " \\brief Ends defragmentation process.\n\n\\param allocator Allocator object.\n\\param context Context object that has been created by vmaBeginDefragmentation().\n\\param[out] pStats Optional stats for the defragmentation. Can be null.\n\nUse this function to finish defragmentation started by vmaBeginDefragmentation()."]
838 pub fn vmaEndDefragmentation(
839 allocator: VmaAllocator,
840 context: VmaDefragmentationContext,
841 pStats: *mut VmaDefragmentationStats,
842 );
843}
844extern "C" {
845 #[doc = " \\brief Starts single defragmentation pass.\n\n\\param allocator Allocator object.\n\\param context Context object that has been created by vmaBeginDefragmentation().\n\\param[out] pPassInfo Computed information for current pass.\n\\returns\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()."]
846 pub fn vmaBeginDefragmentationPass(
847 allocator: VmaAllocator,
848 context: VmaDefragmentationContext,
849 pPassInfo: *mut VmaDefragmentationPassMoveInfo,
850 ) -> Result;
851}
852extern "C" {
853 #[doc = " \\brief Ends single defragmentation pass.\n\n\\param allocator Allocator object.\n\\param context Context object that has been created by vmaBeginDefragmentation().\n\\param 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."]
854 pub fn vmaEndDefragmentationPass(
855 allocator: VmaAllocator,
856 context: VmaDefragmentationContext,
857 pPassInfo: *mut VmaDefragmentationPassMoveInfo,
858 ) -> Result;
859}
860extern "C" {
861 #[doc = " \\brief 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."]
862 pub fn vmaBindBufferMemory(
863 allocator: VmaAllocator,
864 allocation: VmaAllocation,
865 buffer: Buffer,
866 ) -> Result;
867}
868extern "C" {
869 #[doc = " \\brief Binds buffer to allocation with additional parameters.\n\n\\param allocator\n\\param allocation\n\\param allocationLocalOffset Additional offset to be added while binding, relative to the beginning of the `allocation`. Normally it should be 0.\n\\param buffer\n\\param 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."]
870 pub fn vmaBindBufferMemory2(
871 allocator: VmaAllocator,
872 allocation: VmaAllocation,
873 allocationLocalOffset: DeviceSize,
874 buffer: Buffer,
875 pNext: *const ::std::os::raw::c_void,
876 ) -> Result;
877}
878extern "C" {
879 #[doc = " \\brief 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."]
880 pub fn vmaBindImageMemory(
881 allocator: VmaAllocator,
882 allocation: VmaAllocation,
883 image: Image,
884 ) -> Result;
885}
886extern "C" {
887 #[doc = " \\brief Binds image to allocation with additional parameters.\n\n\\param allocator\n\\param allocation\n\\param allocationLocalOffset Additional offset to be added while binding, relative to the beginning of the `allocation`. Normally it should be 0.\n\\param image\n\\param 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."]
888 pub fn vmaBindImageMemory2(
889 allocator: VmaAllocator,
890 allocation: VmaAllocation,
891 allocationLocalOffset: DeviceSize,
892 image: Image,
893 pNext: *const ::std::os::raw::c_void,
894 ) -> Result;
895}
896extern "C" {
897 #[doc = " \\brief Creates a new `VkBuffer`, allocates and binds memory for it.\n\n\\param allocator\n\\param pBufferCreateInfo\n\\param pAllocationCreateInfo\n\\param[out] pBuffer Buffer that was created.\n\\param[out] pAllocation Allocation that was created.\n\\param[out] pAllocationInfo 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."]
898 pub fn vmaCreateBuffer(
899 allocator: VmaAllocator,
900 pBufferCreateInfo: *const BufferCreateInfo,
901 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
902 pBuffer: *mut Buffer,
903 pAllocation: *mut VmaAllocation,
904 pAllocationInfo: *mut VmaAllocationInfo,
905 ) -> Result;
906}
907extern "C" {
908 #[doc = " \\brief 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."]
909 pub fn vmaCreateBufferWithAlignment(
910 allocator: VmaAllocator,
911 pBufferCreateInfo: *const BufferCreateInfo,
912 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
913 minAlignment: DeviceSize,
914 pBuffer: *mut Buffer,
915 pAllocation: *mut VmaAllocation,
916 pAllocationInfo: *mut VmaAllocationInfo,
917 ) -> Result;
918}
919extern "C" {
920 #[doc = " \\brief Creates a new `VkBuffer`, binds already created memory for it.\n\n\\param allocator\n\\param allocation Allocation that provides memory to be used for binding new buffer to it.\n\\param pBufferCreateInfo\n\\param[out] pBuffer 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()."]
921 pub fn vmaCreateAliasingBuffer(
922 allocator: VmaAllocator,
923 allocation: VmaAllocation,
924 pBufferCreateInfo: *const BufferCreateInfo,
925 pBuffer: *mut Buffer,
926 ) -> Result;
927}
928extern "C" {
929 #[doc = " \\brief Creates a new `VkBuffer`, binds already created memory for it.\n\n\\param allocator\n\\param allocation Allocation that provides memory to be used for binding new buffer to it.\n\\param allocationLocalOffset Additional offset to be added while binding, relative to the beginning of the allocation. Normally it should be 0.\n\\param pBufferCreateInfo\n\\param[out] pBuffer 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`."]
930 pub fn vmaCreateAliasingBuffer2(
931 allocator: VmaAllocator,
932 allocation: VmaAllocation,
933 allocationLocalOffset: DeviceSize,
934 pBufferCreateInfo: *const BufferCreateInfo,
935 pBuffer: *mut Buffer,
936 ) -> Result;
937}
938extern "C" {
939 #[doc = " \\brief Destroys Vulkan buffer and frees allocated memory.\n\nThis is just a convenience function equivalent to:\n\n\\code\nvkDestroyBuffer(device, buffer, allocationCallbacks);\nvmaFreeMemory(allocator, allocation);\n\\endcode\n\nIt is safe to pass null as buffer and/or allocation."]
940 pub fn vmaDestroyBuffer(allocator: VmaAllocator, buffer: Buffer, allocation: VmaAllocation);
941}
942extern "C" {
943 #[doc = " Function similar to vmaCreateBuffer()."]
944 pub fn vmaCreateImage(
945 allocator: VmaAllocator,
946 pImageCreateInfo: *const ImageCreateInfo,
947 pAllocationCreateInfo: *const VmaAllocationCreateInfo,
948 pImage: *mut Image,
949 pAllocation: *mut VmaAllocation,
950 pAllocationInfo: *mut VmaAllocationInfo,
951 ) -> Result;
952}
953extern "C" {
954 #[doc = " Function similar to vmaCreateAliasingBuffer() but for images."]
955 pub fn vmaCreateAliasingImage(
956 allocator: VmaAllocator,
957 allocation: VmaAllocation,
958 pImageCreateInfo: *const ImageCreateInfo,
959 pImage: *mut Image,
960 ) -> Result;
961}
962extern "C" {
963 #[doc = " Function similar to vmaCreateAliasingBuffer2() but for images."]
964 pub fn vmaCreateAliasingImage2(
965 allocator: VmaAllocator,
966 allocation: VmaAllocation,
967 allocationLocalOffset: DeviceSize,
968 pImageCreateInfo: *const ImageCreateInfo,
969 pImage: *mut Image,
970 ) -> Result;
971}
972extern "C" {
973 #[doc = " \\brief Destroys Vulkan image and frees allocated memory.\n\nThis is just a convenience function equivalent to:\n\n\\code\nvkDestroyImage(device, image, allocationCallbacks);\nvmaFreeMemory(allocator, allocation);\n\\endcode\n\nIt is safe to pass null as image and/or allocation."]
974 pub fn vmaDestroyImage(allocator: VmaAllocator, image: Image, allocation: VmaAllocation);
975}
976extern "C" {
977 #[doc = " \\brief Creates new #VmaVirtualBlock object.\n\n\\param pCreateInfo Parameters for creation.\n\\param[out] pVirtualBlock Returned virtual block object or `VMA_NULL` if creation failed."]
978 pub fn vmaCreateVirtualBlock(
979 pCreateInfo: *const VmaVirtualBlockCreateInfo,
980 pVirtualBlock: *mut VmaVirtualBlock,
981 ) -> Result;
982}
983extern "C" {
984 #[doc = " \\brief 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."]
985 pub fn vmaDestroyVirtualBlock(virtualBlock: VmaVirtualBlock);
986}
987extern "C" {
988 #[doc = " \\brief Returns true of the #VmaVirtualBlock is empty - contains 0 virtual allocations and has all its space available for new allocations."]
989 pub fn vmaIsVirtualBlockEmpty(virtualBlock: VmaVirtualBlock) -> Bool32;
990}
991extern "C" {
992 #[doc = " \\brief Returns information about a specific virtual allocation within a virtual block, like its size and `pUserData` pointer."]
993 pub fn vmaGetVirtualAllocationInfo(
994 virtualBlock: VmaVirtualBlock,
995 allocation: VmaVirtualAllocation,
996 pVirtualAllocInfo: *mut VmaVirtualAllocationInfo,
997 );
998}
999extern "C" {
1000 #[doc = " \\brief 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\\param virtualBlock Virtual block\n\\param pCreateInfo Parameters for the allocation\n\\param[out] pAllocation Returned handle of the new allocation\n\\param[out] pOffset Returned offset of the new allocation. Optional, can be null."]
1001 pub fn vmaVirtualAllocate(
1002 virtualBlock: VmaVirtualBlock,
1003 pCreateInfo: *const VmaVirtualAllocationCreateInfo,
1004 pAllocation: *mut VmaVirtualAllocation,
1005 pOffset: *mut DeviceSize,
1006 ) -> Result;
1007}
1008extern "C" {
1009 #[doc = " \\brief Frees virtual allocation inside given #VmaVirtualBlock.\n\nIt is correct to call this function with `allocation == VK_NULL_HANDLE` - it does nothing."]
1010 pub fn vmaVirtualFree(virtualBlock: VmaVirtualBlock, allocation: VmaVirtualAllocation);
1011}
1012extern "C" {
1013 #[doc = " \\brief 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."]
1014 pub fn vmaClearVirtualBlock(virtualBlock: VmaVirtualBlock);
1015}
1016extern "C" {
1017 #[doc = " \\brief Changes custom pointer associated with given virtual allocation."]
1018 pub fn vmaSetVirtualAllocationUserData(
1019 virtualBlock: VmaVirtualBlock,
1020 allocation: VmaVirtualAllocation,
1021 pUserData: *mut ::std::os::raw::c_void,
1022 );
1023}
1024extern "C" {
1025 #[doc = " \\brief 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()."]
1026 pub fn vmaGetVirtualBlockStatistics(virtualBlock: VmaVirtualBlock, pStats: *mut VmaStatistics);
1027}
1028extern "C" {
1029 #[doc = " \\brief 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()."]
1030 pub fn vmaCalculateVirtualBlockStatistics(
1031 virtualBlock: VmaVirtualBlock,
1032 pStats: *mut VmaDetailedStatistics,
1033 );
1034}
1035extern "C" {
1036 #[doc = " \\brief Builds and returns a null-terminated string in JSON format with information about given #VmaVirtualBlock.\n\\param virtualBlock Virtual block.\n\\param[out] ppStatsString Returned string.\n\\param 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()."]
1037 pub fn vmaBuildVirtualBlockStatsString(
1038 virtualBlock: VmaVirtualBlock,
1039 ppStatsString: *mut *mut ::std::os::raw::c_char,
1040 detailedMap: Bool32,
1041 );
1042}
1043extern "C" {
1044 #[doc = " Frees a string returned by vmaBuildVirtualBlockStatsString()."]
1045 pub fn vmaFreeVirtualBlockStatsString(
1046 virtualBlock: VmaVirtualBlock,
1047 pStatsString: *mut ::std::os::raw::c_char,
1048 );
1049}
1050extern "C" {
1051 #[doc = " \\brief Builds and returns statistics as a null-terminated string in JSON format.\n\\param allocator\n\\param[out] ppStatsString Must be freed using vmaFreeStatsString() function.\n\\param detailedMap"]
1052 pub fn vmaBuildStatsString(
1053 allocator: VmaAllocator,
1054 ppStatsString: *mut *mut ::std::os::raw::c_char,
1055 detailedMap: Bool32,
1056 );
1057}
1058extern "C" {
1059 pub fn vmaFreeStatsString(allocator: VmaAllocator, pStatsString: *mut ::std::os::raw::c_char);
1060}