mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-10 10:41:52 +00:00
Merge pull request #115 from expipiplus1/joe-annotations
Add annotations for nullability and length
This commit is contained in:
commit
fb3a33777d
@ -2188,7 +2188,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED = VMA_CALL_PRE= VMA_CALL_POST=
|
||||
PREDEFINED = VMA_CALL_PRE= VMA_CALL_POST= VMA_NOT_NULL= VMA_NULLABLE= VMA_LEN_IF_NOT_NULL(len)= VMA_NOT_NULL_NON_DISPATCHABLE= VMA_NULLABLE_NON_DISPATCHABLE=
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
|
@ -1997,6 +1997,59 @@ available through VmaAllocatorCreateInfo::pRecordSettings.
|
||||
#define VMA_CALL_POST
|
||||
#endif
|
||||
|
||||
// Define this macro to decorate pointers with an attribute specifying the
|
||||
// length of the array they point to if they are not null.
|
||||
//
|
||||
// The length may be one of
|
||||
// - The name of another parameter in the argument list where the pointer is declared
|
||||
// - The name of another member in the struct where the pointer is declared
|
||||
// - The name of a member of a struct type, meaning the value of that member in
|
||||
// the context of the call. For example
|
||||
// VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryHeapCount"),
|
||||
// this means the number of memory heaps available in the device associated
|
||||
// with the VmaAllocator being dealt with.
|
||||
#ifndef VMA_LEN_IF_NOT_NULL
|
||||
#define VMA_LEN_IF_NOT_NULL(len)
|
||||
#endif
|
||||
|
||||
// The VMA_NULLABLE macro is defined to be _Nullable when compiling with Clang.
|
||||
// see: https://clang.llvm.org/docs/AttributeReference.html#nullable
|
||||
#ifndef VMA_NULLABLE
|
||||
#ifdef __clang__
|
||||
#define VMA_NULLABLE _Nullable
|
||||
#else
|
||||
#define VMA_NULLABLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// The VMA_NOT_NULL macro is defined to be _Nonnull when compiling with Clang.
|
||||
// see: https://clang.llvm.org/docs/AttributeReference.html#nonnull
|
||||
#ifndef VMA_NOT_NULL
|
||||
#ifdef __clang__
|
||||
#define VMA_NOT_NULL _Nonnull
|
||||
#else
|
||||
#define VMA_NOT_NULL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If non-dispatchable handles are represented as pointers then we can give
|
||||
// then nullability annotations
|
||||
#ifndef VMA_NOT_NULL_NON_DISPATCHABLE
|
||||
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||
#define VMA_NOT_NULL_NON_DISPATCHABLE VMA_NOT_NULL
|
||||
#else
|
||||
#define VMA_NOT_NULL_NON_DISPATCHABLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef VMA_NULLABLE_NON_DISPATCHABLE
|
||||
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||
#define VMA_NULLABLE_NON_DISPATCHABLE VMA_NULLABLE
|
||||
#else
|
||||
#define VMA_NULLABLE_NON_DISPATCHABLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** \struct VmaAllocator
|
||||
\brief Represents main object of this library initialized.
|
||||
|
||||
@ -2010,18 +2063,18 @@ VK_DEFINE_HANDLE(VmaAllocator)
|
||||
|
||||
/// Callback function called after successful vkAllocateMemory.
|
||||
typedef void (VKAPI_PTR *PFN_vmaAllocateDeviceMemoryFunction)(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
uint32_t memoryType,
|
||||
VkDeviceMemory memory,
|
||||
VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,
|
||||
VkDeviceSize size,
|
||||
void* pUserData);
|
||||
void* VMA_NULLABLE pUserData);
|
||||
/// Callback function called before vkFreeMemory.
|
||||
typedef void (VKAPI_PTR *PFN_vmaFreeDeviceMemoryFunction)(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
uint32_t memoryType,
|
||||
VkDeviceMemory memory,
|
||||
VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory,
|
||||
VkDeviceSize size,
|
||||
void* pUserData);
|
||||
void* VMA_NULLABLE pUserData);
|
||||
|
||||
/** \brief Set of callbacks that the library will call for `vkAllocateMemory` and `vkFreeMemory`.
|
||||
|
||||
@ -2032,11 +2085,11 @@ Used in VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.
|
||||
*/
|
||||
typedef struct VmaDeviceMemoryCallbacks {
|
||||
/// Optional, can be null.
|
||||
PFN_vmaAllocateDeviceMemoryFunction pfnAllocate;
|
||||
PFN_vmaAllocateDeviceMemoryFunction VMA_NULLABLE pfnAllocate;
|
||||
/// Optional, can be null.
|
||||
PFN_vmaFreeDeviceMemoryFunction pfnFree;
|
||||
PFN_vmaFreeDeviceMemoryFunction VMA_NULLABLE pfnFree;
|
||||
/// Optional, can be null.
|
||||
void* pUserData;
|
||||
void* VMA_NULLABLE pUserData;
|
||||
} VmaDeviceMemoryCallbacks;
|
||||
|
||||
/// Flags for created #VmaAllocator.
|
||||
@ -2144,33 +2197,33 @@ typedef VkFlags VmaAllocatorCreateFlags;
|
||||
Used in VmaAllocatorCreateInfo::pVulkanFunctions.
|
||||
*/
|
||||
typedef struct VmaVulkanFunctions {
|
||||
PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
|
||||
PFN_vkAllocateMemory vkAllocateMemory;
|
||||
PFN_vkFreeMemory vkFreeMemory;
|
||||
PFN_vkMapMemory vkMapMemory;
|
||||
PFN_vkUnmapMemory vkUnmapMemory;
|
||||
PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
|
||||
PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;
|
||||
PFN_vkBindBufferMemory vkBindBufferMemory;
|
||||
PFN_vkBindImageMemory vkBindImageMemory;
|
||||
PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
|
||||
PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
|
||||
PFN_vkCreateBuffer vkCreateBuffer;
|
||||
PFN_vkDestroyBuffer vkDestroyBuffer;
|
||||
PFN_vkCreateImage vkCreateImage;
|
||||
PFN_vkDestroyImage vkDestroyImage;
|
||||
PFN_vkCmdCopyBuffer vkCmdCopyBuffer;
|
||||
PFN_vkGetPhysicalDeviceProperties VMA_NOT_NULL vkGetPhysicalDeviceProperties;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties VMA_NOT_NULL vkGetPhysicalDeviceMemoryProperties;
|
||||
PFN_vkAllocateMemory VMA_NOT_NULL vkAllocateMemory;
|
||||
PFN_vkFreeMemory VMA_NOT_NULL vkFreeMemory;
|
||||
PFN_vkMapMemory VMA_NOT_NULL vkMapMemory;
|
||||
PFN_vkUnmapMemory VMA_NOT_NULL vkUnmapMemory;
|
||||
PFN_vkFlushMappedMemoryRanges VMA_NOT_NULL vkFlushMappedMemoryRanges;
|
||||
PFN_vkInvalidateMappedMemoryRanges VMA_NOT_NULL vkInvalidateMappedMemoryRanges;
|
||||
PFN_vkBindBufferMemory VMA_NOT_NULL vkBindBufferMemory;
|
||||
PFN_vkBindImageMemory VMA_NOT_NULL vkBindImageMemory;
|
||||
PFN_vkGetBufferMemoryRequirements VMA_NOT_NULL vkGetBufferMemoryRequirements;
|
||||
PFN_vkGetImageMemoryRequirements VMA_NOT_NULL vkGetImageMemoryRequirements;
|
||||
PFN_vkCreateBuffer VMA_NOT_NULL vkCreateBuffer;
|
||||
PFN_vkDestroyBuffer VMA_NOT_NULL vkDestroyBuffer;
|
||||
PFN_vkCreateImage VMA_NOT_NULL vkCreateImage;
|
||||
PFN_vkDestroyImage VMA_NOT_NULL vkDestroyImage;
|
||||
PFN_vkCmdCopyBuffer VMA_NOT_NULL vkCmdCopyBuffer;
|
||||
#if VMA_DEDICATED_ALLOCATION || VMA_VULKAN_VERSION >= 1001000
|
||||
PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR;
|
||||
PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR;
|
||||
PFN_vkGetBufferMemoryRequirements2KHR VMA_NOT_NULL vkGetBufferMemoryRequirements2KHR;
|
||||
PFN_vkGetImageMemoryRequirements2KHR VMA_NOT_NULL vkGetImageMemoryRequirements2KHR;
|
||||
#endif
|
||||
#if VMA_BIND_MEMORY2 || VMA_VULKAN_VERSION >= 1001000
|
||||
PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR;
|
||||
PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR;
|
||||
PFN_vkBindBufferMemory2KHR VMA_NOT_NULL vkBindBufferMemory2KHR;
|
||||
PFN_vkBindImageMemory2KHR VMA_NOT_NULL vkBindImageMemory2KHR;
|
||||
#endif
|
||||
#if VMA_MEMORY_BUDGET || VMA_VULKAN_VERSION >= 1001000
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties2KHR vkGetPhysicalDeviceMemoryProperties2KHR;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties2KHR VMA_NOT_NULL vkGetPhysicalDeviceMemoryProperties2KHR;
|
||||
#endif
|
||||
} VmaVulkanFunctions;
|
||||
|
||||
@ -2199,7 +2252,7 @@ typedef struct VmaRecordSettings
|
||||
It will be opened for the whole time #VmaAllocator object is alive.
|
||||
If opening this file fails, creation of the whole allocator object fails.
|
||||
*/
|
||||
const char* pFilePath;
|
||||
const char* VMA_NOT_NULL pFilePath;
|
||||
} VmaRecordSettings;
|
||||
|
||||
/// Description of a Allocator to be created.
|
||||
@ -2209,19 +2262,19 @@ typedef struct VmaAllocatorCreateInfo
|
||||
VmaAllocatorCreateFlags flags;
|
||||
/// Vulkan physical device.
|
||||
/** It must be valid throughout whole lifetime of created allocator. */
|
||||
VkPhysicalDevice physicalDevice;
|
||||
VkPhysicalDevice VMA_NOT_NULL physicalDevice;
|
||||
/// Vulkan device.
|
||||
/** It must be valid throughout whole lifetime of created allocator. */
|
||||
VkDevice device;
|
||||
VkDevice VMA_NOT_NULL device;
|
||||
/// Preferred size of a single `VkDeviceMemory` block to be allocated from large heaps > 1 GiB. Optional.
|
||||
/** Set to 0 to use default, which is currently 256 MiB. */
|
||||
VkDeviceSize preferredLargeHeapBlockSize;
|
||||
/// Custom CPU memory allocation callbacks. Optional.
|
||||
/** Optional, can be null. When specified, will also be used for all CPU-side memory allocations. */
|
||||
const VkAllocationCallbacks* pAllocationCallbacks;
|
||||
const VkAllocationCallbacks* VMA_NULLABLE pAllocationCallbacks;
|
||||
/// Informative callbacks for `vkAllocateMemory`, `vkFreeMemory`. Optional.
|
||||
/** Optional, can be null. */
|
||||
const VmaDeviceMemoryCallbacks* pDeviceMemoryCallbacks;
|
||||
const VmaDeviceMemoryCallbacks* VMA_NULLABLE pDeviceMemoryCallbacks;
|
||||
/** \brief Maximum number of additional frames that are in use at the same time as current frame.
|
||||
|
||||
This value is used only when you make allocations with
|
||||
@ -2260,24 +2313,25 @@ typedef struct VmaAllocatorCreateInfo
|
||||
blocks to system RAM. This driver behavior can also be controlled using
|
||||
VK_AMD_memory_overallocation_behavior extension.
|
||||
*/
|
||||
const VkDeviceSize* pHeapSizeLimit;
|
||||
const VkDeviceSize* VMA_NULLABLE VMA_LEN_IF_NOT_NULL("VkPhysicalDeviceMemoryProperties::memoryHeapCount") pHeapSizeLimit;
|
||||
|
||||
/** \brief Pointers to Vulkan functions. Can be null.
|
||||
|
||||
For details see [Pointers to Vulkan functions](@ref config_Vulkan_functions).
|
||||
*/
|
||||
const VmaVulkanFunctions* pVulkanFunctions;
|
||||
const VmaVulkanFunctions* VMA_NULLABLE pVulkanFunctions;
|
||||
/** \brief Parameters for recording of VMA calls. Can be null.
|
||||
|
||||
If not null, it enables recording of calls to VMA functions to a file.
|
||||
If support for recording is not enabled using `VMA_RECORDING_ENABLED` macro,
|
||||
creation of the allocator object fails with `VK_ERROR_FEATURE_NOT_PRESENT`.
|
||||
*/
|
||||
const VmaRecordSettings* pRecordSettings;
|
||||
const VmaRecordSettings* VMA_NULLABLE pRecordSettings;
|
||||
/** \brief Handle to Vulkan instance object.
|
||||
|
||||
Starting from version 3.0.0 this member is no longer optional, it must be set!
|
||||
*/
|
||||
VkInstance instance;
|
||||
VkInstance VMA_NOT_NULL instance;
|
||||
/** \brief Optional. The highest version of Vulkan that the application is designed to use.
|
||||
|
||||
It 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`.
|
||||
@ -2291,12 +2345,12 @@ typedef struct VmaAllocatorCreateInfo
|
||||
|
||||
/// Creates Allocator object.
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator(
|
||||
const VmaAllocatorCreateInfo* pCreateInfo,
|
||||
VmaAllocator* pAllocator);
|
||||
const VmaAllocatorCreateInfo* VMA_NOT_NULL pCreateInfo,
|
||||
VmaAllocator VMA_NULLABLE * VMA_NOT_NULL pAllocator);
|
||||
|
||||
/// Destroys allocator object.
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaDestroyAllocator(
|
||||
VmaAllocator allocator);
|
||||
VmaAllocator VMA_NULLABLE allocator);
|
||||
|
||||
/** \brief Information about existing #VmaAllocator object.
|
||||
*/
|
||||
@ -2306,17 +2360,17 @@ typedef struct VmaAllocatorInfo
|
||||
|
||||
This is the same value as has been passed through VmaAllocatorCreateInfo::instance.
|
||||
*/
|
||||
VkInstance instance;
|
||||
VkInstance VMA_NOT_NULL instance;
|
||||
/** \brief Handle to Vulkan physical device object.
|
||||
|
||||
This is the same value as has been passed through VmaAllocatorCreateInfo::physicalDevice.
|
||||
*/
|
||||
VkPhysicalDevice physicalDevice;
|
||||
VkPhysicalDevice VMA_NOT_NULL physicalDevice;
|
||||
/** \brief Handle to Vulkan device object.
|
||||
|
||||
This is the same value as has been passed through VmaAllocatorCreateInfo::device.
|
||||
*/
|
||||
VkDevice device;
|
||||
VkDevice VMA_NOT_NULL device;
|
||||
} VmaAllocatorInfo;
|
||||
|
||||
/** \brief Returns information about existing #VmaAllocator object - handle to Vulkan device etc.
|
||||
@ -2324,23 +2378,23 @@ typedef struct VmaAllocatorInfo
|
||||
It might be useful if you want to keep just the #VmaAllocator handle and fetch other required handles to
|
||||
`VkPhysicalDevice`, `VkDevice` etc. every time using this function.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocatorInfo(VmaAllocator allocator, VmaAllocatorInfo* pAllocatorInfo);
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocatorInfo(VmaAllocator VMA_NOT_NULL allocator, VmaAllocatorInfo* VMA_NOT_NULL pAllocatorInfo);
|
||||
|
||||
/**
|
||||
PhysicalDeviceProperties are fetched from physicalDevice by the allocator.
|
||||
You can access it here, without fetching it again on your own.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetPhysicalDeviceProperties(
|
||||
VmaAllocator allocator,
|
||||
const VkPhysicalDeviceProperties** ppPhysicalDeviceProperties);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VkPhysicalDeviceProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceProperties);
|
||||
|
||||
/**
|
||||
PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator.
|
||||
You can access it here, without fetching it again on your own.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryProperties(
|
||||
VmaAllocator allocator,
|
||||
const VkPhysicalDeviceMemoryProperties** ppPhysicalDeviceMemoryProperties);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VkPhysicalDeviceMemoryProperties* VMA_NULLABLE * VMA_NOT_NULL ppPhysicalDeviceMemoryProperties);
|
||||
|
||||
/**
|
||||
\brief Given Memory Type Index, returns Property Flags of this memory type.
|
||||
@ -2349,9 +2403,9 @@ This is just a convenience function. Same information can be obtained using
|
||||
vmaGetMemoryProperties().
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetMemoryTypeProperties(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
uint32_t memoryTypeIndex,
|
||||
VkMemoryPropertyFlags* pFlags);
|
||||
VkMemoryPropertyFlags* VMA_NOT_NULL pFlags);
|
||||
|
||||
/** \brief Sets index of the current frame.
|
||||
|
||||
@ -2362,7 +2416,7 @@ when a new frame begins. Allocations queried using vmaGetAllocationInfo() cannot
|
||||
become lost in the current frame.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaSetCurrentFrameIndex(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
uint32_t frameIndex);
|
||||
|
||||
/** \brief Calculated statistics of memory usage in entire allocator.
|
||||
@ -2401,8 +2455,8 @@ Note that when using allocator from multiple threads, returned information may i
|
||||
become outdated.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaCalculateStats(
|
||||
VmaAllocator allocator,
|
||||
VmaStats* pStats);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaStats* VMA_NOT_NULL pStats);
|
||||
|
||||
/** \brief Statistics of current memory usage and available budget, in bytes, for specific memory heap.
|
||||
*/
|
||||
@ -2456,8 +2510,8 @@ Note that when using allocator from multiple threads, returned information may i
|
||||
become outdated.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetBudget(
|
||||
VmaAllocator allocator,
|
||||
VmaBudget* pBudget);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaBudget* VMA_NOT_NULL pBudget);
|
||||
|
||||
#ifndef VMA_STATS_STRING_ENABLED
|
||||
#define VMA_STATS_STRING_ENABLED 1
|
||||
@ -2469,13 +2523,13 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetBudget(
|
||||
/** @param[out] ppStatsString Must be freed using vmaFreeStatsString() function.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaBuildStatsString(
|
||||
VmaAllocator allocator,
|
||||
char** ppStatsString,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
char* VMA_NULLABLE * VMA_NOT_NULL ppStatsString,
|
||||
VkBool32 detailedMap);
|
||||
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaFreeStatsString(
|
||||
VmaAllocator allocator,
|
||||
char* pStatsString);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
char* VMA_NULLABLE pStatsString);
|
||||
|
||||
#endif // #if VMA_STATS_STRING_ENABLED
|
||||
|
||||
@ -2701,14 +2755,14 @@ typedef struct VmaAllocationCreateInfo
|
||||
Leave `VK_NULL_HANDLE` to allocate from default pool. If not null, members:
|
||||
`usage`, `requiredFlags`, `preferredFlags`, `memoryTypeBits` are ignored.
|
||||
*/
|
||||
VmaPool pool;
|
||||
VmaPool VMA_NULLABLE pool;
|
||||
/** \brief Custom general-purpose pointer that will be stored in #VmaAllocation, can be read as VmaAllocationInfo::pUserData and changed using vmaSetAllocationUserData().
|
||||
|
||||
If #VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT is used, it must be either
|
||||
null or pointer to a null-terminated string. The string will be then copied to
|
||||
internal buffer, so it doesn't need to be valid after allocation call.
|
||||
*/
|
||||
void* pUserData;
|
||||
void* VMA_NULLABLE pUserData;
|
||||
} VmaAllocationCreateInfo;
|
||||
|
||||
/**
|
||||
@ -2728,10 +2782,10 @@ type of resource you want to use it for. Please check parameters of your
|
||||
resource, like image layout (OPTIMAL versus LINEAR) or mip level count.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndex(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
uint32_t memoryTypeBits,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
uint32_t* pMemoryTypeIndex);
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
|
||||
uint32_t* VMA_NOT_NULL pMemoryTypeIndex);
|
||||
|
||||
/**
|
||||
\brief Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.
|
||||
@ -2746,10 +2800,10 @@ It is just a convenience function, equivalent to calling:
|
||||
- `vkDestroyBuffer`
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForBufferInfo(
|
||||
VmaAllocator allocator,
|
||||
const VkBufferCreateInfo* pBufferCreateInfo,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
uint32_t* pMemoryTypeIndex);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
|
||||
uint32_t* VMA_NOT_NULL pMemoryTypeIndex);
|
||||
|
||||
/**
|
||||
\brief Helps to find memoryTypeIndex, given VkImageCreateInfo and VmaAllocationCreateInfo.
|
||||
@ -2764,10 +2818,10 @@ It is just a convenience function, equivalent to calling:
|
||||
- `vkDestroyImage`
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaFindMemoryTypeIndexForImageInfo(
|
||||
VmaAllocator allocator,
|
||||
const VkImageCreateInfo* pImageCreateInfo,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
uint32_t* pMemoryTypeIndex);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
|
||||
uint32_t* VMA_NOT_NULL pMemoryTypeIndex);
|
||||
|
||||
/// Flags to be passed as VmaPoolCreateInfo::flags.
|
||||
typedef enum VmaPoolCreateFlagBits {
|
||||
@ -2909,15 +2963,15 @@ typedef struct VmaPoolStats {
|
||||
@param[out] pPool Handle to created pool.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreatePool(
|
||||
VmaAllocator allocator,
|
||||
const VmaPoolCreateInfo* pCreateInfo,
|
||||
VmaPool* pPool);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VmaPoolCreateInfo* VMA_NOT_NULL pCreateInfo,
|
||||
VmaPool VMA_NULLABLE * VMA_NOT_NULL pPool);
|
||||
|
||||
/** \brief Destroys #VmaPool object and frees Vulkan device memory.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaDestroyPool(
|
||||
VmaAllocator allocator,
|
||||
VmaPool pool);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaPool VMA_NULLABLE pool);
|
||||
|
||||
/** \brief Retrieves statistics of existing #VmaPool object.
|
||||
|
||||
@ -2926,9 +2980,9 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyPool(
|
||||
@param[out] pPoolStats Statistics of specified pool.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolStats(
|
||||
VmaAllocator allocator,
|
||||
VmaPool pool,
|
||||
VmaPoolStats* pPoolStats);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaPool VMA_NOT_NULL pool,
|
||||
VmaPoolStats* VMA_NOT_NULL pPoolStats);
|
||||
|
||||
/** \brief Marks all allocations in given pool as lost if they are not used in current frame or VmaPoolCreateInfo::frameInUseCount back from now.
|
||||
|
||||
@ -2937,9 +2991,9 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolStats(
|
||||
@param[out] pLostAllocationCount Number of allocations marked as lost. Optional - pass null if you don't need this information.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaMakePoolAllocationsLost(
|
||||
VmaAllocator allocator,
|
||||
VmaPool pool,
|
||||
size_t* pLostAllocationCount);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaPool VMA_NOT_NULL pool,
|
||||
size_t* VMA_NULLABLE pLostAllocationCount);
|
||||
|
||||
/** \brief Checks magic number in margins around all allocations in given memory pool in search for corruptions.
|
||||
|
||||
@ -2955,7 +3009,7 @@ Possible return values:
|
||||
`VMA_ASSERT` is also fired in that case.
|
||||
- Other value: Error returned by Vulkan, e.g. memory mapping failure.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckPoolCorruption(VmaAllocator allocator, VmaPool pool);
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckPoolCorruption(VmaAllocator VMA_NOT_NULL allocator, VmaPool VMA_NOT_NULL pool);
|
||||
|
||||
/** \brief Retrieves name of a custom pool.
|
||||
|
||||
@ -2964,9 +3018,9 @@ containing name of the pool that was previously set. The pointer becomes invalid
|
||||
destroyed or its name is changed using vmaSetPoolName().
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(
|
||||
VmaAllocator allocator,
|
||||
VmaPool pool,
|
||||
const char** ppName);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaPool VMA_NOT_NULL pool,
|
||||
const char* VMA_NULLABLE * VMA_NOT_NULL ppName);
|
||||
|
||||
/** \brief Sets name of a custom pool.
|
||||
|
||||
@ -2974,9 +3028,9 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(
|
||||
Function makes internal copy of the string, so it can be changed or freed immediately after this call.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName(
|
||||
VmaAllocator allocator,
|
||||
VmaPool pool,
|
||||
const char* pName);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaPool VMA_NOT_NULL pool,
|
||||
const char* VMA_NULLABLE pName);
|
||||
|
||||
/** \struct VmaAllocation
|
||||
\brief Represents single memory allocation.
|
||||
@ -3020,7 +3074,7 @@ typedef struct VmaAllocationInfo {
|
||||
|
||||
If the allocation is lost, it is equal to `VK_NULL_HANDLE`.
|
||||
*/
|
||||
VkDeviceMemory deviceMemory;
|
||||
VkDeviceMemory VMA_NULLABLE_NON_DISPATCHABLE deviceMemory;
|
||||
/** \brief Offset into deviceMemory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation.
|
||||
|
||||
It can change after call to vmaDefragment() if this allocation is passed to the function, or if allocation is lost.
|
||||
@ -3034,17 +3088,17 @@ typedef struct VmaAllocationInfo {
|
||||
/** \brief Pointer to the beginning of this allocation as mapped data.
|
||||
|
||||
If the allocation hasn't been mapped using vmaMapMemory() and hasn't been
|
||||
created with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag, this value null.
|
||||
created with #VMA_ALLOCATION_CREATE_MAPPED_BIT flag, this value is null.
|
||||
|
||||
It can change after call to vmaMapMemory(), vmaUnmapMemory().
|
||||
It can also change after call to vmaDefragment() if this allocation is passed to the function.
|
||||
*/
|
||||
void* pMappedData;
|
||||
void* VMA_NULLABLE pMappedData;
|
||||
/** \brief Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vmaSetAllocationUserData().
|
||||
|
||||
It can change after call to vmaSetAllocationUserData() for this allocation.
|
||||
*/
|
||||
void* pUserData;
|
||||
void* VMA_NULLABLE pUserData;
|
||||
} VmaAllocationInfo;
|
||||
|
||||
/** \brief General purpose memory allocation.
|
||||
@ -3058,11 +3112,11 @@ It is recommended to use vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage
|
||||
vmaCreateBuffer(), vmaCreateImage() instead whenever possible.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemory(
|
||||
VmaAllocator allocator,
|
||||
const VkMemoryRequirements* pVkMemoryRequirements,
|
||||
const VmaAllocationCreateInfo* pCreateInfo,
|
||||
VmaAllocation* pAllocation,
|
||||
VmaAllocationInfo* pAllocationInfo);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VkMemoryRequirements* VMA_NOT_NULL pVkMemoryRequirements,
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,
|
||||
VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
|
||||
VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
|
||||
|
||||
/** \brief General purpose memory allocation for multiple allocation objects at once.
|
||||
|
||||
@ -3084,12 +3138,12 @@ If any allocation fails, all allocations already made within this function call
|
||||
returned result is not `VK_SUCCESS`, `pAllocation` array is always entirely filled with `VK_NULL_HANDLE`.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryPages(
|
||||
VmaAllocator allocator,
|
||||
const VkMemoryRequirements* pVkMemoryRequirements,
|
||||
const VmaAllocationCreateInfo* pCreateInfo,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VkMemoryRequirements* VMA_NOT_NULL pVkMemoryRequirements,
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,
|
||||
size_t allocationCount,
|
||||
VmaAllocation* pAllocations,
|
||||
VmaAllocationInfo* pAllocationInfo);
|
||||
VmaAllocation VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,
|
||||
VmaAllocationInfo* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationInfo);
|
||||
|
||||
/**
|
||||
@param[out] pAllocation Handle to allocated memory.
|
||||
@ -3098,27 +3152,27 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryPages(
|
||||
You should free the memory using vmaFreeMemory().
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForBuffer(
|
||||
VmaAllocator allocator,
|
||||
VkBuffer buffer,
|
||||
const VmaAllocationCreateInfo* pCreateInfo,
|
||||
VmaAllocation* pAllocation,
|
||||
VmaAllocationInfo* pAllocationInfo);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,
|
||||
VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
|
||||
VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
|
||||
|
||||
/// Function similar to vmaAllocateMemoryForBuffer().
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForImage(
|
||||
VmaAllocator allocator,
|
||||
VkImage image,
|
||||
const VmaAllocationCreateInfo* pCreateInfo,
|
||||
VmaAllocation* pAllocation,
|
||||
VmaAllocationInfo* pAllocationInfo);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pCreateInfo,
|
||||
VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
|
||||
VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
|
||||
|
||||
/** \brief Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage().
|
||||
|
||||
Passing `VK_NULL_HANDLE` as `allocation` is valid. Such function call is just skipped.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemory(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VmaAllocation VMA_NULLABLE allocation);
|
||||
|
||||
/** \brief Frees memory and destroys multiple allocations.
|
||||
|
||||
@ -3131,9 +3185,9 @@ Allocations in `pAllocations` array can come from any memory pools and types.
|
||||
Passing `VK_NULL_HANDLE` as elements of `pAllocations` array is valid. Such entries are just skipped.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemoryPages(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
size_t allocationCount,
|
||||
VmaAllocation* pAllocations);
|
||||
const VmaAllocation VMA_NULLABLE * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations);
|
||||
|
||||
/** \brief Deprecated.
|
||||
|
||||
@ -3143,8 +3197,8 @@ In current version it returns `VK_SUCCESS` only if `newSize` equals current allo
|
||||
Otherwise returns `VK_ERROR_OUT_OF_POOL_MEMORY`, indicating that allocation's size could not be changed.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaResizeAllocation(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
VkDeviceSize newSize);
|
||||
|
||||
/** \brief Returns current information about specified allocation and atomically marks it as used in current frame.
|
||||
@ -3164,9 +3218,9 @@ you can avoid calling it too often.
|
||||
- If you just want to check if allocation is not lost, vmaTouchAllocation() will work faster.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationInfo(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VmaAllocationInfo* pAllocationInfo);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
VmaAllocationInfo* VMA_NOT_NULL pAllocationInfo);
|
||||
|
||||
/** \brief Returns `VK_TRUE` if allocation is not lost and atomically marks it as used in current frame.
|
||||
|
||||
@ -3183,8 +3237,8 @@ If the allocation has been created without #VMA_ALLOCATION_CREATE_CAN_BECOME_LOS
|
||||
this function always returns `VK_TRUE`.
|
||||
*/
|
||||
VMA_CALL_PRE VkBool32 VMA_CALL_POST vmaTouchAllocation(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation);
|
||||
|
||||
/** \brief Sets pUserData in given allocation to new value.
|
||||
|
||||
@ -3200,9 +3254,9 @@ allocation's `pUserData`. It is opaque, so you can use it however you want - e.g
|
||||
as a pointer, ordinal number or some handle to you own data.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaSetAllocationUserData(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
void* pUserData);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
void* VMA_NULLABLE pUserData);
|
||||
|
||||
/** \brief Creates new allocation that is in lost state from the beginning.
|
||||
|
||||
@ -3215,8 +3269,8 @@ not bound to any image or buffer. It has size = 0. It cannot be turned into
|
||||
a real, non-empty allocation.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaCreateLostAllocation(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation* pAllocation);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation);
|
||||
|
||||
/** \brief Maps memory represented by given allocation and returns pointer to it.
|
||||
|
||||
@ -3257,9 +3311,9 @@ If the allocation is made from a memory types that is not `HOST_COHERENT`,
|
||||
you also need to use vmaInvalidateAllocation() / vmaFlushAllocation(), as required by Vulkan specification.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaMapMemory(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
void** ppData);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
void* VMA_NULLABLE * VMA_NOT_NULL ppData);
|
||||
|
||||
/** \brief Unmaps memory represented by given allocation, mapped previously using vmaMapMemory().
|
||||
|
||||
@ -3270,8 +3324,8 @@ If the allocation is made from a memory types that is not `HOST_COHERENT`,
|
||||
you also need to use vmaInvalidateAllocation() / vmaFlushAllocation(), as required by Vulkan specification.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaUnmapMemory(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation);
|
||||
|
||||
/** \brief Flushes memory of given allocation.
|
||||
|
||||
@ -3291,7 +3345,11 @@ Warning! `offset` and `size` are relative to the contents of given `allocation`.
|
||||
If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.
|
||||
Do not pass allocation's offset as `offset`!!!
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaFlushAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size);
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaFlushAllocation(
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
VkDeviceSize offset,
|
||||
VkDeviceSize size);
|
||||
|
||||
/** \brief Invalidates memory of given allocation.
|
||||
|
||||
@ -3311,7 +3369,11 @@ Warning! `offset` and `size` are relative to the contents of given `allocation`.
|
||||
If you mean whole allocation, you can pass 0 and `VK_WHOLE_SIZE`, respectively.
|
||||
Do not pass allocation's offset as `offset`!!!
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaInvalidateAllocation(VmaAllocator allocator, VmaAllocation allocation, VkDeviceSize offset, VkDeviceSize size);
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaInvalidateAllocation(
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
VkDeviceSize offset,
|
||||
VkDeviceSize size);
|
||||
|
||||
/** \brief Checks magic number in margins around all allocations in given memory types (in both default and custom pools) in search for corruptions.
|
||||
|
||||
@ -3329,7 +3391,7 @@ Possible return values:
|
||||
`VMA_ASSERT` is also fired in that case.
|
||||
- Other value: Error returned by Vulkan, e.g. memory mapping failure.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator allocator, uint32_t memoryTypeBits);
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator VMA_NOT_NULL allocator, uint32_t memoryTypeBits);
|
||||
|
||||
/** \struct VmaDefragmentationContext
|
||||
\brief Represents Opaque object that represents started defragmentation process.
|
||||
@ -3365,13 +3427,13 @@ typedef struct VmaDefragmentationInfo2 {
|
||||
It is safe to pass allocations that are in the lost state - they are ignored.
|
||||
All allocations not present in this array are considered non-moveable during this defragmentation.
|
||||
*/
|
||||
VmaAllocation* pAllocations;
|
||||
const VmaAllocation VMA_NOT_NULL * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations;
|
||||
/** \brief Optional, output. Pointer to array that will be filled with information whether the allocation at certain index has been changed during defragmentation.
|
||||
|
||||
The array should have `allocationCount` elements.
|
||||
You can pass null if you are not interested in this information.
|
||||
*/
|
||||
VkBool32* pAllocationsChanged;
|
||||
VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationsChanged;
|
||||
/** \brief Numer of pools in `pPools` array.
|
||||
*/
|
||||
uint32_t poolCount;
|
||||
@ -3390,7 +3452,7 @@ typedef struct VmaDefragmentationInfo2 {
|
||||
Using this array is equivalent to specifying all allocations from the pools in `pAllocations`.
|
||||
It might be more efficient.
|
||||
*/
|
||||
VmaPool* pPools;
|
||||
const VmaPool VMA_NOT_NULL * VMA_NULLABLE VMA_LEN_IF_NOT_NULL(poolCount) pPools;
|
||||
/** \brief Maximum total numbers of bytes that can be copied while moving allocations to different places using transfers on CPU side, like `memcpy()`, `memmove()`.
|
||||
|
||||
`VK_WHOLE_SIZE` means no limit.
|
||||
@ -3419,12 +3481,12 @@ typedef struct VmaDefragmentationInfo2 {
|
||||
|
||||
Passing null means that only CPU defragmentation will be performed.
|
||||
*/
|
||||
VkCommandBuffer commandBuffer;
|
||||
VkCommandBuffer VMA_NULLABLE commandBuffer;
|
||||
} VmaDefragmentationInfo2;
|
||||
|
||||
typedef struct VmaDefragmentationPassMoveInfo {
|
||||
VmaAllocation allocation;
|
||||
VkDeviceMemory memory;
|
||||
VmaAllocation VMA_NOT_NULL allocation;
|
||||
VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory;
|
||||
VkDeviceSize offset;
|
||||
} VmaDefragmentationPassMoveInfo;
|
||||
|
||||
@ -3434,7 +3496,7 @@ To be used with function vmaBeginDefragmentationPass().
|
||||
*/
|
||||
typedef struct VmaDefragmentationPassInfo {
|
||||
uint32_t moveCount;
|
||||
VmaDefragmentationPassMoveInfo* pMoves;
|
||||
VmaDefragmentationPassMoveInfo* VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(moveCount) pMoves;
|
||||
} VmaDefragmentationPassInfo;
|
||||
|
||||
/** \brief Deprecated. Optional configuration parameters to be passed to function vmaDefragment().
|
||||
@ -3496,10 +3558,10 @@ For more information and important limitations regarding defragmentation, see do
|
||||
[Defragmentation](@ref defragmentation).
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationBegin(
|
||||
VmaAllocator allocator,
|
||||
const VmaDefragmentationInfo2* pInfo,
|
||||
VmaDefragmentationStats* pStats,
|
||||
VmaDefragmentationContext *pContext);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VmaDefragmentationInfo2* VMA_NOT_NULL pInfo,
|
||||
VmaDefragmentationStats* VMA_NULLABLE pStats,
|
||||
VmaDefragmentationContext VMA_NULLABLE * VMA_NOT_NULL pContext);
|
||||
|
||||
/** \brief Ends defragmentation process.
|
||||
|
||||
@ -3507,17 +3569,17 @@ Use this function to finish defragmentation started by vmaDefragmentationBegin()
|
||||
It is safe to pass `context == null`. The function then does nothing.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragmentationEnd(
|
||||
VmaAllocator allocator,
|
||||
VmaDefragmentationContext context);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaDefragmentationContext VMA_NULLABLE context);
|
||||
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass(
|
||||
VmaAllocator allocator,
|
||||
VmaDefragmentationContext context,
|
||||
VmaDefragmentationPassInfo* pInfo
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaDefragmentationContext VMA_NULLABLE context,
|
||||
VmaDefragmentationPassInfo* VMA_NOT_NULL pInfo
|
||||
);
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentationPass(
|
||||
VmaAllocator allocator,
|
||||
VmaDefragmentationContext context
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaDefragmentationContext VMA_NULLABLE context
|
||||
);
|
||||
|
||||
/** \brief Deprecated. Compacts memory by moving allocations.
|
||||
@ -3561,12 +3623,12 @@ you should measure that on your platform.
|
||||
For more information, see [Defragmentation](@ref defragmentation) chapter.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragment(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation* pAllocations,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VmaAllocation VMA_NOT_NULL * VMA_NOT_NULL VMA_LEN_IF_NOT_NULL(allocationCount) pAllocations,
|
||||
size_t allocationCount,
|
||||
VkBool32* pAllocationsChanged,
|
||||
const VmaDefragmentationInfo *pDefragmentationInfo,
|
||||
VmaDefragmentationStats* pDefragmentationStats);
|
||||
VkBool32* VMA_NULLABLE VMA_LEN_IF_NOT_NULL(allocationCount) pAllocationsChanged,
|
||||
const VmaDefragmentationInfo* VMA_NULLABLE pDefragmentationInfo,
|
||||
VmaDefragmentationStats* VMA_NULLABLE pDefragmentationStats);
|
||||
|
||||
/** \brief Binds buffer to allocation.
|
||||
|
||||
@ -3581,9 +3643,9 @@ allocations, calls to `vkBind*Memory()` or `vkMapMemory()` won't happen from mul
|
||||
It is recommended to use function vmaCreateBuffer() instead of this one.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VkBuffer buffer);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer);
|
||||
|
||||
/** \brief Binds buffer to allocation with additional parameters.
|
||||
|
||||
@ -3596,11 +3658,11 @@ If `pNext` is not null, #VmaAllocator object must have been created with #VMA_AL
|
||||
or with VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_1`. Otherwise the call fails.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory2(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkBuffer buffer,
|
||||
const void* pNext);
|
||||
VkBuffer VMA_NOT_NULL_NON_DISPATCHABLE buffer,
|
||||
const void* VMA_NULLABLE pNext);
|
||||
|
||||
/** \brief Binds image to allocation.
|
||||
|
||||
@ -3615,9 +3677,9 @@ allocations, calls to `vkBind*Memory()` or `vkMapMemory()` won't happen from mul
|
||||
It is recommended to use function vmaCreateImage() instead of this one.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VkImage image);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
VkImage VMA_NOT_NULL_NON_DISPATCHABLE image);
|
||||
|
||||
/** \brief Binds image to allocation with additional parameters.
|
||||
|
||||
@ -3630,11 +3692,11 @@ If `pNext` is not null, #VmaAllocator object must have been created with #VMA_AL
|
||||
or with VmaAllocatorCreateInfo::vulkanApiVersion `== VK_API_VERSION_1_1`. Otherwise the call fails.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VmaAllocation VMA_NOT_NULL allocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkImage image,
|
||||
const void* pNext);
|
||||
VkImage VMA_NOT_NULL_NON_DISPATCHABLE image,
|
||||
const void* VMA_NULLABLE pNext);
|
||||
|
||||
/**
|
||||
@param[out] pBuffer Buffer that was created.
|
||||
@ -3663,12 +3725,12 @@ allocation for this buffer, just like when using
|
||||
VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
|
||||
*/
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateBuffer(
|
||||
VmaAllocator allocator,
|
||||
const VkBufferCreateInfo* pBufferCreateInfo,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
VkBuffer* pBuffer,
|
||||
VmaAllocation* pAllocation,
|
||||
VmaAllocationInfo* pAllocationInfo);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VkBufferCreateInfo* VMA_NOT_NULL pBufferCreateInfo,
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
|
||||
VkBuffer VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pBuffer,
|
||||
VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
|
||||
VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
|
||||
|
||||
/** \brief Destroys Vulkan buffer and frees allocated memory.
|
||||
|
||||
@ -3682,18 +3744,18 @@ vmaFreeMemory(allocator, allocation);
|
||||
It it safe to pass null as buffer and/or allocation.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaDestroyBuffer(
|
||||
VmaAllocator allocator,
|
||||
VkBuffer buffer,
|
||||
VmaAllocation allocation);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VkBuffer VMA_NULLABLE_NON_DISPATCHABLE buffer,
|
||||
VmaAllocation VMA_NULLABLE allocation);
|
||||
|
||||
/// Function similar to vmaCreateBuffer().
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateImage(
|
||||
VmaAllocator allocator,
|
||||
const VkImageCreateInfo* pImageCreateInfo,
|
||||
const VmaAllocationCreateInfo* pAllocationCreateInfo,
|
||||
VkImage* pImage,
|
||||
VmaAllocation* pAllocation,
|
||||
VmaAllocationInfo* pAllocationInfo);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
const VkImageCreateInfo* VMA_NOT_NULL pImageCreateInfo,
|
||||
const VmaAllocationCreateInfo* VMA_NOT_NULL pAllocationCreateInfo,
|
||||
VkImage VMA_NULLABLE_NON_DISPATCHABLE * VMA_NOT_NULL pImage,
|
||||
VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation,
|
||||
VmaAllocationInfo* VMA_NULLABLE pAllocationInfo);
|
||||
|
||||
/** \brief Destroys Vulkan image and frees allocated memory.
|
||||
|
||||
@ -3707,9 +3769,9 @@ vmaFreeMemory(allocator, allocation);
|
||||
It it safe to pass null as image and/or allocation.
|
||||
*/
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage(
|
||||
VmaAllocator allocator,
|
||||
VkImage image,
|
||||
VmaAllocation allocation);
|
||||
VmaAllocator VMA_NOT_NULL allocator,
|
||||
VkImage VMA_NULLABLE_NON_DISPATCHABLE image,
|
||||
VmaAllocation VMA_NULLABLE allocation);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -3725,6 +3787,12 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage(
|
||||
#ifdef VMA_IMPLEMENTATION
|
||||
#undef VMA_IMPLEMENTATION
|
||||
|
||||
// Only the public API has nullability annotations, not the implementation
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wnullability-completeness"
|
||||
#endif
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
@ -7127,10 +7195,10 @@ public:
|
||||
VmaDefragmentationStats* pStats);
|
||||
~VmaDefragmentationContext_T();
|
||||
|
||||
void AddPools(uint32_t poolCount, VmaPool* pPools);
|
||||
void AddPools(uint32_t poolCount, const VmaPool* pPools);
|
||||
void AddAllocations(
|
||||
uint32_t allocationCount,
|
||||
VmaAllocation* pAllocations,
|
||||
const VmaAllocation* pAllocations,
|
||||
VkBool32* pAllocationsChanged);
|
||||
|
||||
/*
|
||||
@ -14237,7 +14305,7 @@ VmaDefragmentationContext_T::~VmaDefragmentationContext_T()
|
||||
}
|
||||
}
|
||||
|
||||
void VmaDefragmentationContext_T::AddPools(uint32_t poolCount, VmaPool* pPools)
|
||||
void VmaDefragmentationContext_T::AddPools(uint32_t poolCount, const VmaPool* pPools)
|
||||
{
|
||||
for(uint32_t poolIndex = 0; poolIndex < poolCount; ++poolIndex)
|
||||
{
|
||||
@ -14274,7 +14342,7 @@ void VmaDefragmentationContext_T::AddPools(uint32_t poolCount, VmaPool* pPools)
|
||||
|
||||
void VmaDefragmentationContext_T::AddAllocations(
|
||||
uint32_t allocationCount,
|
||||
VmaAllocation* pAllocations,
|
||||
const VmaAllocation* pAllocations,
|
||||
VkBool32* pAllocationsChanged)
|
||||
{
|
||||
// Dispatch pAllocations among defragmentators. Create them when necessary.
|
||||
@ -17630,7 +17698,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName(
|
||||
VmaPool pool,
|
||||
const char** ppName)
|
||||
{
|
||||
VMA_ASSERT(allocator && pool);
|
||||
VMA_ASSERT(allocator && pool && ppName);
|
||||
|
||||
VMA_DEBUG_LOG("vmaGetPoolName");
|
||||
|
||||
@ -17895,7 +17963,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemory(
|
||||
VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemoryPages(
|
||||
VmaAllocator allocator,
|
||||
size_t allocationCount,
|
||||
VmaAllocation* pAllocations)
|
||||
const VmaAllocation* pAllocations)
|
||||
{
|
||||
if(allocationCount == 0)
|
||||
{
|
||||
@ -18114,7 +18182,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption(VmaAllocator allocator, u
|
||||
|
||||
VMA_CALL_PRE VkResult VMA_CALL_POST vmaDefragment(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation* pAllocations,
|
||||
const VmaAllocation* pAllocations,
|
||||
size_t allocationCount,
|
||||
VkBool32* pAllocationsChanged,
|
||||
const VmaDefragmentationInfo *pDefragmentationInfo,
|
||||
@ -18588,4 +18656,9 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
// -Wnullability-completeness
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // #ifdef VMA_IMPLEMENTATION
|
||||
|
Loading…
Reference in New Issue
Block a user