VulkanMemoryAllocator-0.7.3: Bindings to the VulkanMemoryAllocator library
Safe HaskellNone
LanguageHaskell2010

VulkanMemoryAllocator

Synopsis

Documentation

createAllocator :: forall io. MonadIO io => AllocatorCreateInfo -> io Allocator Source #

Creates Allocator object.

withAllocator :: forall io r. MonadIO io => AllocatorCreateInfo -> (io Allocator -> (Allocator -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to createAllocator and destroyAllocator

To ensure that destroyAllocator is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

destroyAllocator :: forall io. MonadIO io => Allocator -> io () Source #

Destroys allocator object.

getAllocatorInfo :: forall io. MonadIO io => Allocator -> io AllocatorInfo Source #

Returns information about existing Allocator object - handle to Vulkan device etc.

It might be useful if you want to keep just the Allocator handle and fetch other required handles to VkPhysicalDevice, VkDevice etc. every time using this function.

getPhysicalDeviceProperties :: forall io. MonadIO io => Allocator -> io (Ptr PhysicalDeviceProperties) Source #

PhysicalDeviceProperties are fetched from physicalDevice by the allocator. You can access it here, without fetching it again on your own.

getMemoryProperties :: forall io. MonadIO io => Allocator -> io (Ptr PhysicalDeviceMemoryProperties) Source #

PhysicalDeviceMemoryProperties are fetched from physicalDevice by the allocator. You can access it here, without fetching it again on your own.

getMemoryTypeProperties :: forall io. MonadIO io => Allocator -> ("memoryTypeIndex" ::: Word32) -> io MemoryPropertyFlags Source #

Given Memory Type Index, returns Property Flags of this memory type.

This is just a convenience function. Same information can be obtained using getMemoryProperties.

setCurrentFrameIndex :: forall io. MonadIO io => Allocator -> ("frameIndex" ::: Word32) -> io () Source #

Sets index of the current frame.

This function must be used if you make allocations with ALLOCATION_CREATE_CAN_BECOME_LOST_BIT and ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flags to inform the allocator when a new frame begins. Allocations queried using getAllocationInfo cannot become lost in the current frame.

calculateStats :: forall io. MonadIO io => Allocator -> io Stats Source #

Retrieves statistics from current state of the Allocator.

This function is called "calculate" not "get" because it has to traverse all internal data structures, so it may be quite slow. For faster but more brief statistics suitable to be called every frame or every allocation, use getBudget.

Note that when using allocator from multiple threads, returned information may immediately become outdated.

getBudget :: forall io. MonadIO io => Allocator -> io ("budget" ::: Vector Budget) Source #

Retrieves information about current memory budget for all memory heaps.

Parameters

allocator
out pBudget Must point to array with number of elements at least equal to number of memory heaps in physical device used.

This function is called "get" not "calculate" because it is very fast, suitable to be called every frame or every allocation. For more detailed statistics use calculateStats.

Note that when using allocator from multiple threads, returned information may immediately become outdated.

buildStatsString :: forall io. MonadIO io => Allocator -> ("detailedMap" ::: Bool) -> io ("statsString" ::: Ptr CChar) Source #

Builds and returns statistics as a null-terminated string in JSON format.

Parameters

allocator
out ppStatsString Must be freed using freeStatsString function.
detailedMap

freeStatsString :: forall io. MonadIO io => Allocator -> ("statsString" ::: Ptr CChar) -> io () Source #

findMemoryTypeIndex :: forall io. MonadIO io => Allocator -> ("memoryTypeBits" ::: Word32) -> AllocationCreateInfo -> io ("memoryTypeIndex" ::: Word32) Source #

Helps to find memoryTypeIndex, given memoryTypeBits and AllocationCreateInfo.

This algorithm tries to find a memory type that:

  • Is allowed by memoryTypeBits.
  • Contains all the flags from pAllocationCreateInfo->requiredFlags.
  • Matches intended usage.
  • Has as many flags from pAllocationCreateInfo->preferredFlags as possible.

Returns

Returns VK_ERROR_FEATURE_NOT_PRESENT if not found. Receiving such result from this function or any other allocating function probably means that your device doesn't support any memory type with requested features for the specific 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.

findMemoryTypeIndexForBufferInfo :: forall a io. (Extendss BufferCreateInfo a, PokeChain a, MonadIO io) => Allocator -> BufferCreateInfo a -> AllocationCreateInfo -> io ("memoryTypeIndex" ::: Word32) Source #

Helps to find memoryTypeIndex, given VkBufferCreateInfo and AllocationCreateInfo.

It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex. It internally creates a temporary, dummy buffer that never has memory bound. It is just a convenience function, equivalent to calling:

findMemoryTypeIndexForImageInfo :: forall a io. (Extendss ImageCreateInfo a, PokeChain a, MonadIO io) => Allocator -> ImageCreateInfo a -> AllocationCreateInfo -> io ("memoryTypeIndex" ::: Word32) Source #

Helps to find memoryTypeIndex, given VkImageCreateInfo and AllocationCreateInfo.

It can be useful e.g. to determine value to be used as VmaPoolCreateInfo::memoryTypeIndex. It internally creates a temporary, dummy image that never has memory bound. It is just a convenience function, equivalent to calling:

createPool :: forall io. MonadIO io => Allocator -> PoolCreateInfo -> io Pool Source #

Allocates Vulkan device memory and creates Pool object.

Parameters

allocatorAllocator object.
pCreateInfoParameters of pool to create.
outpPoolHandle to created pool.

withPool :: forall io r. MonadIO io => Allocator -> PoolCreateInfo -> (io Pool -> (Pool -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to createPool and destroyPool

To ensure that destroyPool is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

destroyPool :: forall io. MonadIO io => Allocator -> Pool -> io () Source #

Destroys Pool object and frees Vulkan device memory.

getPoolStats :: forall io. MonadIO io => Allocator -> Pool -> io PoolStats Source #

Retrieves statistics of existing Pool object.

Parameters

allocatorAllocator object.
poolPool object.
outpPoolStatsStatistics of specified pool.

makePoolAllocationsLost :: forall io. MonadIO io => Allocator -> Pool -> io ("lostAllocationCount" ::: Word64) Source #

Marks all allocations in given pool as lost if they are not used in current frame or VmaPoolCreateInfo::frameInUseCount back from now.

Parameters

allocatorAllocator object.
poolPool.
out pLostAllocationCount Number of allocations marked as lost. Optional - pass null if you don't need this information.

checkPoolCorruption :: forall io. MonadIO io => Allocator -> Pool -> io () Source #

Checks magic number in margins around all allocations in given memory pool in search for corruptions.

Corruption detection is enabled only when VMA_DEBUG_DETECT_CORRUPTION macro is defined to nonzero, VMA_DEBUG_MARGIN is defined to nonzero and the pool is created in memory type that is HOST_VISIBLE and HOST_COHERENT. For more information, see Corruption detection.

Possible return values:

  • VK_ERROR_FEATURE_NOT_PRESENT - corruption detection is not enabled for specified pool.
  • VK_SUCCESS - corruption detection has been performed and succeeded.
  • VK_ERROR_UNKNOWN - corruption detection has been performed and found memory corruptions around one of the allocations. VMA_ASSERT is also fired in that case.
  • Other value: Error returned by Vulkan, e.g. memory mapping failure.

getPoolName :: forall io. MonadIO io => Allocator -> Pool -> io ("name" ::: Ptr CChar) Source #

Retrieves name of a custom pool.

After the call ppName is either null or points to an internally-owned null-terminated string containing name of the pool that was previously set. The pointer becomes invalid when the pool is destroyed or its name is changed using setPoolName.

setPoolName :: forall io. MonadIO io => Allocator -> Pool -> ("name" ::: Maybe ByteString) -> io () Source #

Sets name of a custom pool.

pName can be either null or pointer to a null-terminated string with new name for the pool. Function makes internal copy of the string, so it can be changed or freed immediately after this call.

allocateMemory :: forall io. MonadIO io => Allocator -> ("vkMemoryRequirements" ::: MemoryRequirements) -> AllocationCreateInfo -> io (Allocation, AllocationInfo) Source #

General purpose memory allocation.

Parameters

allocator
pVkMemoryRequirements
pCreateInfo
outpAllocationHandle to allocated memory.
out pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function getAllocationInfo.

You should free the memory using freeMemory or freeMemoryPages.

It is recommended to use allocateMemoryForBuffer, allocateMemoryForImage, createBuffer, createImage instead whenever possible.

withMemory :: forall io r. MonadIO io => Allocator -> MemoryRequirements -> AllocationCreateInfo -> (io (Allocation, AllocationInfo) -> ((Allocation, AllocationInfo) -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to allocateMemory and freeMemory

To ensure that freeMemory is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

allocateMemoryPages :: forall io. MonadIO io => Allocator -> ("vkMemoryRequirements" ::: Vector MemoryRequirements) -> ("createInfo" ::: Vector AllocationCreateInfo) -> io ("allocations" ::: Vector Allocation, "allocationInfo" ::: Vector AllocationInfo) Source #

General purpose memory allocation for multiple allocation objects at once.

Parameters

allocatorAllocator object.
pVkMemoryRequirementsMemory requirements for each allocation.
pCreateInfoCreation parameters for each alloction.
allocationCountNumber of allocations to make.
out pAllocations Pointer to array that will be filled with handles to created allocations.
out pAllocationInfo Optional. Pointer to array that will be filled with parameters of created allocations.

You should free the memory using freeMemory or freeMemoryPages.

Word "pages" is just a suggestion to use this function to allocate pieces of memory needed for sparse binding. It is just a general purpose allocation function able to make multiple allocations at once. It may be internally optimized to be more efficient than calling allocateMemory allocationCount times.

All allocations are made using same parameters. All of them are created out of the same memory pool and type. If any allocation fails, all allocations already made within this function call are also freed, so that when returned result is not VK_SUCCESS, pAllocation array is always entirely filled with VK_NULL_HANDLE.

withMemoryPages :: forall io r. MonadIO io => Allocator -> Vector MemoryRequirements -> Vector AllocationCreateInfo -> (io (Vector Allocation, Vector AllocationInfo) -> ((Vector Allocation, Vector AllocationInfo) -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to allocateMemoryPages and freeMemoryPages

To ensure that freeMemoryPages is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

allocateMemoryForBuffer :: forall io. MonadIO io => Allocator -> Buffer -> AllocationCreateInfo -> io (Allocation, AllocationInfo) Source #

Parameters

allocator
buffer
pCreateInfo
outpAllocationHandle to allocated memory.
out pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function getAllocationInfo.

You should free the memory using freeMemory.

withMemoryForBuffer :: forall io r. MonadIO io => Allocator -> Buffer -> AllocationCreateInfo -> (io (Allocation, AllocationInfo) -> ((Allocation, AllocationInfo) -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to allocateMemoryForBuffer and freeMemory

To ensure that freeMemory is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

withMemoryForImage :: forall io r. MonadIO io => Allocator -> Image -> AllocationCreateInfo -> (io (Allocation, AllocationInfo) -> ((Allocation, AllocationInfo) -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to allocateMemoryForImage and freeMemory

To ensure that freeMemory is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

freeMemory :: forall io. MonadIO io => Allocator -> Allocation -> io () Source #

Frees memory previously allocated using allocateMemory, allocateMemoryForBuffer, or allocateMemoryForImage.

Passing VK_NULL_HANDLE as allocation is valid. Such function call is just skipped.

freeMemoryPages :: forall io. MonadIO io => Allocator -> ("allocations" ::: Vector Allocation) -> io () Source #

Frees memory and destroys multiple allocations.

Word "pages" is just a suggestion to use this function to free pieces of memory used for sparse binding. It is just a general purpose function to free memory and destroy allocations made using e.g. allocateMemory, allocateMemoryPages and other functions. It may be internally optimized to be more efficient than calling freeMemory allocationCount times.

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.

getAllocationInfo :: forall io. MonadIO io => Allocator -> Allocation -> io AllocationInfo Source #

Returns current information about specified allocation and atomically marks it as used in current frame.

Current paramteres of given allocation are returned in pAllocationInfo.

This function also atomically "touches" allocation - marks it as used in current frame, just like touchAllocation. If the allocation is in lost state, pAllocationInfo->deviceMemory == VK_NULL_HANDLE.

Although this function uses atomics and doesn't lock any mutex, so it should be quite efficient, you can avoid calling it too often.

  • You can retrieve same AllocationInfo structure while creating your resource, from function createBuffer, createImage. You can remember it if you are sure parameters don't change (e.g. due to defragmentation or allocation becoming lost).
  • If you just want to check if allocation is not lost, touchAllocation will work faster.

touchAllocation :: forall io. MonadIO io => Allocator -> Allocation -> io Bool Source #

Returns VK_TRUE if allocation is not lost and atomically marks it as used in current frame.

If the allocation has been created with ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag, this function returns VK_TRUE if it is not in lost state, so it can still be used. It then also atomically "touches" the allocation - marks it as used in current frame, so that you can be sure it won't become lost in current frame or next frameInUseCount frames.

If the allocation is in lost state, the function returns VK_FALSE. Memory of such allocation, as well as buffer or image bound to it, should not be used. Lost allocation and the buffer/image still need to be destroyed.

If the allocation has been created without ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag, this function always returns VK_TRUE.

setAllocationUserData :: forall io. MonadIO io => Allocator -> Allocation -> ("userData" ::: Ptr ()) -> io () Source #

Sets pUserData in given allocation to new value.

If the allocation was created with VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT, pUserData must be either null, or pointer to a null-terminated string. The function makes local copy of the string and sets it as allocation's pUserData. String passed as pUserData doesn't need to be valid for whole lifetime of the allocation - you can free it after this call. String previously pointed by allocation's pUserData is freed from memory.

If the flag was not used, the value of pointer pUserData is just copied to 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.

createLostAllocation :: forall io. MonadIO io => Allocator -> io Allocation Source #

Creates new allocation that is in lost state from the beginning.

It can be useful if you need a dummy, non-null allocation.

You still need to destroy created object using freeMemory.

Returned allocation is not tied to any specific memory pool or memory type and not bound to any image or buffer. It has size = 0. It cannot be turned into a real, non-empty allocation.

withLostAllocation :: forall io r. MonadIO io => Allocator -> (io Allocation -> (Allocation -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to createLostAllocation and freeMemory

To ensure that freeMemory is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

mapMemory :: forall io. MonadIO io => Allocator -> Allocation -> io ("data" ::: Ptr ()) Source #

Maps memory represented by given allocation and returns pointer to it.

Maps memory represented by given allocation to make it accessible to CPU code. When succeeded, *ppData contains pointer to first byte of this memory. If the allocation is part of bigger VkDeviceMemory block, the pointer is correctly offsetted to the beginning of region assigned to this particular allocation.

Mapping is internally reference-counted and synchronized, so despite raw Vulkan function vkMapMemory() cannot be used to map same block of VkDeviceMemory multiple times simultaneously, it is safe to call this function on allocations assigned to the same memory block. Actual Vulkan memory will be mapped on first mapping and unmapped on last unmapping.

If the function succeeded, you must call unmapMemory to unmap the allocation when mapping is no longer needed or before freeing the allocation, at the latest.

It also safe to call this function multiple times on the same allocation. You must call unmapMemory same number of times as you called mapMemory.

It is also safe to call this function on allocation created with ALLOCATION_CREATE_MAPPED_BIT flag. Its memory stays mapped all the time. You must still call unmapMemory same number of times as you called mapMemory. You must not call unmapMemory additional time to free the "0-th" mapping made automatically due to ALLOCATION_CREATE_MAPPED_BIT flag.

This function fails when used on allocation made in memory type that is not HOST_VISIBLE.

This function always fails when called for allocation that was created with ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocations cannot be mapped.

This function doesn't automatically flush or invalidate caches. If the allocation is made from a memory types that is not HOST_COHERENT, you also need to use invalidateAllocation / flushAllocation, as required by Vulkan specification.

withMappedMemory :: forall io r. MonadIO io => Allocator -> Allocation -> (io (Ptr ()) -> (Ptr () -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to mapMemory and unmapMemory

To ensure that unmapMemory is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

unmapMemory :: forall io. MonadIO io => Allocator -> Allocation -> io () Source #

Unmaps memory represented by given allocation, mapped previously using mapMemory.

For details, see description of mapMemory.

This function doesn't automatically flush or invalidate caches. If the allocation is made from a memory types that is not HOST_COHERENT, you also need to use invalidateAllocation / flushAllocation, as required by Vulkan specification.

flushAllocation :: forall io. MonadIO io => Allocator -> Allocation -> ("offset" ::: DeviceSize) -> DeviceSize -> io () Source #

Flushes memory of given allocation.

Calls vkFlushMappedMemoryRanges() for memory associated with given range of given allocation. It needs to be called after writing to a mapped memory for memory types that are not HOST_COHERENT. Unmap operation doesn't do that automatically.

  • offset must be relative to the beginning of allocation.
  • size can be VK_WHOLE_SIZE. It means all memory from offset the the end of given allocation.
  • offset and size don't have to be aligned. They are internally rounded down/up to multiply of nonCoherentAtomSize.
  • If size is 0, this call is ignored.
  • If memory type that the allocation belongs to is not HOST_VISIBLE or it is HOST_COHERENT, this call is ignored.

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!!!

This function returns the VkResult from vkFlushMappedMemoryRanges if it is called, otherwise VK_SUCCESS.

invalidateAllocation :: forall io. MonadIO io => Allocator -> Allocation -> ("offset" ::: DeviceSize) -> DeviceSize -> io () Source #

Invalidates memory of given allocation.

Calls vkInvalidateMappedMemoryRanges() for memory associated with given range of given allocation. It needs to be called before reading from a mapped memory for memory types that are not HOST_COHERENT. Map operation doesn't do that automatically.

  • offset must be relative to the beginning of allocation.
  • size can be VK_WHOLE_SIZE. It means all memory from offset the the end of given allocation.
  • offset and size don't have to be aligned. They are internally rounded down/up to multiply of nonCoherentAtomSize.
  • If size is 0, this call is ignored.
  • If memory type that the allocation belongs to is not HOST_VISIBLE or it is HOST_COHERENT, this call is ignored.

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!!!

This function returns the VkResult from vkInvalidateMappedMemoryRanges if it is called, otherwise VK_SUCCESS.

flushAllocations :: forall io. MonadIO io => Allocator -> ("allocations" ::: Vector Allocation) -> ("offsets" ::: Vector DeviceSize) -> ("sizes" ::: Vector DeviceSize) -> io () Source #

Flushes memory of given set of allocations.

Calls vkFlushMappedMemoryRanges() for memory associated with given ranges of given allocations. For more information, see documentation of flushAllocation.

Parameters

allocator
allocationCount
allocations
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 ofsets are zero.
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.

This function returns the VkResult from vkFlushMappedMemoryRanges if it is called, otherwise VK_SUCCESS.

invalidateAllocations :: forall io. MonadIO io => Allocator -> ("allocations" ::: Vector Allocation) -> ("offsets" ::: Vector DeviceSize) -> ("sizes" ::: Vector DeviceSize) -> io () Source #

Invalidates memory of given set of allocations.

Calls vkInvalidateMappedMemoryRanges() for memory associated with given ranges of given allocations. For more information, see documentation of invalidateAllocation.

Parameters

allocator
allocationCount
allocations
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 ofsets are zero.
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.

This function returns the VkResult from vkInvalidateMappedMemoryRanges if it is called, otherwise VK_SUCCESS.

checkCorruption :: forall io. MonadIO io => Allocator -> ("memoryTypeBits" ::: Word32) -> io () Source #

Checks magic number in margins around all allocations in given memory types (in both default and custom pools) in search for corruptions.

Parameters

allocator
memoryTypeBits Bit mask, where each bit set means that a memory type with that index should be checked.

Corruption detection is enabled only when VMA_DEBUG_DETECT_CORRUPTION macro is defined to nonzero, VMA_DEBUG_MARGIN is defined to nonzero and only for memory types that are HOST_VISIBLE and HOST_COHERENT. For more information, see Corruption detection.

Possible return values:

  • VK_ERROR_FEATURE_NOT_PRESENT - corruption detection is not enabled for any of specified memory types.
  • VK_SUCCESS - corruption detection has been performed and succeeded.
  • VK_ERROR_UNKNOWN - corruption detection has been performed and found memory corruptions around one of the allocations. VMA_ASSERT is also fired in that case.
  • Other value: Error returned by Vulkan, e.g. memory mapping failure.

defragmentationBegin :: forall io. MonadIO io => Allocator -> DefragmentationInfo2 -> io (Result, DefragmentationStats, DefragmentationContext) Source #

Begins defragmentation process.

Parameters

allocatorAllocator object.
pInfo Structure filled with parameters of defragmentation.
out pStats Optional. Statistics of defragmentation. You can pass null if you are not interested in this information.
out pContext Context object that must be passed to defragmentationEnd to finish defragmentation.

Returns

VK_SUCCESS and *pContext == null if defragmentation finished within this function call. VK_NOT_READY and *pContext != null if defragmentation has been started and you need to call defragmentationEnd to finish it. Negative value in case of error.

Use this function instead of old, deprecated defragment.

Warning! Between the call to defragmentationBegin and defragmentationEnd:

  • You should not use any of allocations passed as pInfo->pAllocations or any allocations that belong to pools passed as pInfo->pPools, including calling getAllocationInfo, touchAllocation, or access their data.
  • Some mutexes protecting internal data structures may be locked, so trying to make or free any allocations, bind buffers or images, map memory, or launch another simultaneous defragmentation in between may cause stall (when done on another thread) or deadlock (when done on the same thread), unless you are 100% sure that defragmented allocations are in different pools.
  • Information returned via pStats and pInfo->pAllocationsChanged are undefined. They become valid after call to defragmentationEnd.
  • If pInfo->commandBuffer is not null, you must submit that command buffer and make sure it finished execution before calling defragmentationEnd.

For more information and important limitations regarding defragmentation, see documentation chapter: Defragmentation.

withDefragmentation :: forall io r. MonadIO io => Allocator -> DefragmentationInfo2 -> (io (Result, DefragmentationStats, DefragmentationContext) -> ((Result, DefragmentationStats, DefragmentationContext) -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to defragmentationBegin and defragmentationEnd

To ensure that defragmentationEnd is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

defragmentationEnd :: forall io. MonadIO io => Allocator -> DefragmentationContext -> io () Source #

Ends defragmentation process.

Use this function to finish defragmentation started by defragmentationBegin. It is safe to pass context == null. The function then does nothing.

useDefragmentationPass :: forall io r. MonadIO io => Allocator -> DefragmentationContext -> (DefragmentationPassInfo -> io r) -> io r Source #

This function will call the supplied action between calls to beginDefragmentationPass and endDefragmentationPass

Note that endDefragmentationPass is *not* called if an exception is thrown by the inner action.

defragment :: forall io. MonadIO io => Allocator -> ("allocations" ::: Vector Allocation) -> ("defragmentationInfo" ::: Maybe DefragmentationInfo) -> io ("allocationsChanged" ::: Vector Bool, DefragmentationStats) Source #

Deprecated. Compacts memory by moving allocations.

Parameters

allocator
pAllocations Array of allocations that can be moved during this compation.
allocationCount Number of elements in pAllocations and pAllocationsChanged arrays.
out pAllocationsChanged Array of boolean values that will indicate whether matching allocation in pAllocations array has been moved. This parameter is optional. Pass null if you don't need this information.
pDefragmentationInfo Configuration parameters. Optional - pass null to use default values.
out pDefragmentationStats Statistics returned by the function. Optional - pass null if you don't need this information.

Returns

VK_SUCCESS if completed, negative error code in case of error.

Deprecated

This is a part of the old interface. It is recommended to use structure DefragmentationInfo2 and function defragmentationBegin instead.

This function works by moving allocations to different places (different VkDeviceMemory objects and/or different offsets) in order to optimize memory usage. Only allocations that are in pAllocations array can be moved. All other allocations are considered nonmovable in this call. Basic rules:

  • Only allocations made in memory types that have VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT and VK_MEMORY_PROPERTY_HOST_COHERENT_BIT flags can be compacted. You may pass other allocations but it makes no sense - these will never be moved.
  • Custom pools created with POOL_CREATE_LINEAR_ALGORITHM_BIT or POOL_CREATE_BUDDY_ALGORITHM_BIT flag are not defragmented. Allocations passed to this function that come from such pools are ignored.
  • Allocations created with ALLOCATION_CREATE_DEDICATED_MEMORY_BIT or created as dedicated allocations for any other reason are also ignored.
  • Both allocations made with or without ALLOCATION_CREATE_MAPPED_BIT flag can be compacted. If not persistently mapped, memory will be mapped temporarily inside this function if needed.
  • You must not pass same Allocation object multiple times in pAllocations array.

The function also frees empty VkDeviceMemory blocks.

Warning: This function may be time-consuming, so you shouldn't call it too often (like after every resource creation/destruction). You can call it on special occasions (like when reloading a game level or when you just destroyed a lot of objects). Calling it every frame may be OK, but you should measure that on your platform.

For more information, see Defragmentation chapter.

bindBufferMemory :: forall io. MonadIO io => Allocator -> Allocation -> Buffer -> io () Source #

Binds buffer to allocation.

Binds specified buffer to region of memory represented by specified allocation. Gets VkDeviceMemory handle and offset from the allocation. If you want to create a buffer, allocate memory for it and bind them together separately, you should use this function for binding instead of standard vkBindBufferMemory(), because it ensures proper synchronization so that when a VkDeviceMemory object is used by multiple allocations, calls to vkBind*Memory() or vkMapMemory() won't happen from multiple threads simultaneously (which is illegal in Vulkan).

It is recommended to use function createBuffer instead of this one.

bindBufferMemory2 :: forall io. MonadIO io => Allocator -> Allocation -> ("allocationLocalOffset" ::: DeviceSize) -> Buffer -> ("next" ::: Ptr ()) -> io () Source #

Binds buffer to allocation with additional parameters.

Parameters

allocator
allocation
allocationLocalOffset Additional offset to be added while binding, relative to the beginning of the allocation. Normally it should be 0.
buffer
pNext A chain of structures to be attached to VkBindBufferMemoryInfoKHR structure used internally. Normally it should be null.

This function is similar to bindBufferMemory, but it provides additional parameters.

If pNext is not null, Allocator object must have been created with ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag or with VmaAllocatorCreateInfo::vulkanApiVersion >= VK_API_VERSION_1_1. Otherwise the call fails.

bindImageMemory :: forall io. MonadIO io => Allocator -> Allocation -> Image -> io () Source #

Binds image to allocation.

Binds specified image to region of memory represented by specified allocation. Gets VkDeviceMemory handle and offset from the allocation. If you want to create an image, allocate memory for it and bind them together separately, you should use this function for binding instead of standard vkBindImageMemory(), because it ensures proper synchronization so that when a VkDeviceMemory object is used by multiple allocations, calls to vkBind*Memory() or vkMapMemory() won't happen from multiple threads simultaneously (which is illegal in Vulkan).

It is recommended to use function createImage instead of this one.

bindImageMemory2 :: forall io. MonadIO io => Allocator -> Allocation -> ("allocationLocalOffset" ::: DeviceSize) -> Image -> ("next" ::: Ptr ()) -> io () Source #

Binds image to allocation with additional parameters.

Parameters

allocator
allocation
allocationLocalOffset Additional offset to be added while binding, relative to the beginning of the allocation. Normally it should be 0.
image
pNext A chain of structures to be attached to VkBindImageMemoryInfoKHR structure used internally. Normally it should be null.

This function is similar to bindImageMemory, but it provides additional parameters.

If pNext is not null, Allocator object must have been created with ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag or with VmaAllocatorCreateInfo::vulkanApiVersion >= VK_API_VERSION_1_1. Otherwise the call fails.

createBuffer :: forall a io. (Extendss BufferCreateInfo a, PokeChain a, MonadIO io) => Allocator -> BufferCreateInfo a -> AllocationCreateInfo -> io (Buffer, Allocation, AllocationInfo) Source #

Parameters

allocator
pBufferCreateInfo
pAllocationCreateInfo
outpBufferBuffer that was created.
outpAllocationAllocation that was created.
out pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function getAllocationInfo.

This function automatically:

  1. Creates buffer.
  2. Allocates appropriate memory for it.
  3. Binds the buffer with the memory.

If any of these operations fail, buffer and allocation are not created, returned value is negative error code, *pBuffer and *pAllocation are null.

If the function succeeded, you must destroy both buffer and allocation when you no longer need them using either convenience function destroyBuffer or separately, using vkDestroyBuffer() and freeMemory.

If ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT flag was used, VK_KHR_dedicated_allocation extension is used internally to query driver whether it requires or prefers the new buffer to have dedicated allocation. If yes, and if dedicated allocation is possible (VmaAllocationCreateInfo::pool is null and ALLOCATION_CREATE_NEVER_ALLOCATE_BIT is not used), it creates dedicated allocation for this buffer, just like when using ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.

Note

This function creates a new VkBuffer. Sub-allocation of parts of one large buffer, although recommended as a good practice, is out of scope of this library and could be implemented by the user as a higher-level logic on top of VMA.

withBuffer :: forall a io r. (Extendss BufferCreateInfo a, PokeChain a, MonadIO io) => Allocator -> BufferCreateInfo a -> AllocationCreateInfo -> (io (Buffer, Allocation, AllocationInfo) -> ((Buffer, Allocation, AllocationInfo) -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to createBuffer and destroyBuffer

To ensure that destroyBuffer is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

createBufferWithAlignment :: forall a io. (Extendss BufferCreateInfo a, PokeChain a, MonadIO io) => Allocator -> BufferCreateInfo a -> AllocationCreateInfo -> ("minAlignment" ::: DeviceSize) -> io (Buffer, Allocation, AllocationInfo) Source #

Creates a buffer with additional minimum alignment.

Similar to createBuffer but provides additional parameter minAlignment which allows to specify custom, minimum alignment to be used when placing the buffer inside a larger memory block, which may be needed e.g. for interop with OpenGL.

destroyBuffer :: forall io. MonadIO io => Allocator -> Buffer -> Allocation -> io () Source #

Destroys Vulkan buffer and frees allocated memory.

This is just a convenience function equivalent to:

vkDestroyBuffer(device, buffer, allocationCallbacks);
vmaFreeMemory(allocator, allocation);

It it safe to pass null as buffer and/or allocation.

withImage :: forall a io r. (Extendss ImageCreateInfo a, PokeChain a, MonadIO io) => Allocator -> ImageCreateInfo a -> AllocationCreateInfo -> (io (Image, Allocation, AllocationInfo) -> ((Image, Allocation, AllocationInfo) -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to createImage and destroyImage

To ensure that destroyImage is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

destroyImage :: forall io. MonadIO io => Allocator -> Image -> Allocation -> io () Source #

Destroys Vulkan image and frees allocated memory.

This is just a convenience function equivalent to:

vkDestroyImage(device, image, allocationCallbacks);
vmaFreeMemory(allocator, allocation);

It it safe to pass null as image and/or allocation.

createVirtualBlock :: forall io. MonadIO io => VirtualBlockCreateInfo -> io VirtualBlock Source #

Creates new VirtualBlock object.

Parameters

pCreateInfoParameters for creation.
out pVirtualBlock Returned virtual block object or VMA_NULL if creation failed.

withVirtualBlock :: forall io r. MonadIO io => VirtualBlockCreateInfo -> (io VirtualBlock -> (VirtualBlock -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to createVirtualBlock and destroyVirtualBlock

To ensure that destroyVirtualBlock is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

destroyVirtualBlock :: forall io. MonadIO io => VirtualBlock -> io () Source #

Destroys VirtualBlock object.

Please note that you should consciously handle virtual allocations that could remain unfreed in the block. You should either free them individually using virtualFree or call clearVirtualBlock if you are sure this is what you want. If you do neither, an assert is called.

If you keep pointers to some additional metadata associated with your virtual allocations in their pUserData, don't forget to free them.

isVirtualBlockEmpty :: forall io. MonadIO io => VirtualBlock -> io Bool Source #

Returns true of the VirtualBlock is empty - contains 0 virtual allocations and has all its space available for new allocations.

getVirtualAllocationInfo :: forall io. MonadIO io => VirtualBlock -> ("offset" ::: DeviceSize) -> io ("virtualAllocInfo" ::: VirtualAllocationInfo) Source #

Returns information about a specific virtual allocation within a virtual block, like its size and pUserData pointer.

virtualAllocate :: forall io. MonadIO io => VirtualBlock -> VirtualAllocationCreateInfo -> io ("offset" ::: DeviceSize) Source #

Allocates new virtual allocation inside given VirtualBlock.

There is no handle type for a virtual allocation. Virtual allocations within a specific virtual block are uniquely identified by their offsets.

If the allocation fails due to not enough free space available, VK_ERROR_OUT_OF_DEVICE_MEMORY is returned (despite the function doesn't ever allocate actual GPU memory).

withVirtualAllocation :: forall io r. MonadIO io => VirtualBlock -> VirtualAllocationCreateInfo -> (io DeviceSize -> (DeviceSize -> io ()) -> r) -> r Source #

A convenience wrapper to make a compatible pair of calls to virtualAllocate and virtualFree

To ensure that virtualFree is always called: pass bracket (or the allocate function from your favourite resource management library) as the last argument. To just extract the pair pass (,) as the last argument.

virtualFree :: forall io. MonadIO io => VirtualBlock -> ("offset" ::: DeviceSize) -> io () Source #

Frees virtual allocation inside given VirtualBlock.

clearVirtualBlock :: forall io. MonadIO io => VirtualBlock -> io () Source #

Frees all virtual allocations inside given VirtualBlock.

You must either call this function or free each virtual allocation individually with virtualFree before destroying a virtual block. Otherwise, an assert is called.

If you keep pointer to some additional metadata associated with your virtual allocation in its pUserData, don't forget to free it as well.

setVirtualAllocationUserData :: forall io. MonadIO io => VirtualBlock -> ("offset" ::: DeviceSize) -> ("userData" ::: Ptr ()) -> io () Source #

Changes custom pointer associated with given virtual allocation.

calculateVirtualBlockStats :: forall io. MonadIO io => VirtualBlock -> io StatInfo Source #

Calculates and returns statistics about virtual allocations and memory usage in given VirtualBlock.

buildVirtualBlockStatsString :: forall io. MonadIO io => VirtualBlock -> ("detailedMap" ::: Bool) -> io ("statsString" ::: Ptr CChar) Source #

Builds and returns a null-terminated string in JSON format with information about given VirtualBlock.

Parameters

virtualBlockVirtual block.
outppStatsStringReturned string.
detailedMap Pass VK_FALSE to only obtain statistics as returned by calculateVirtualBlockStats. Pass VK_TRUE to also obtain full list of allocations and free spaces.

Returned string must be freed using freeVirtualBlockStatsString.

freeVirtualBlockStatsString :: forall io. MonadIO io => VirtualBlock -> ("statsString" ::: Ptr CChar) -> io () Source #

Frees a string returned by buildVirtualBlockStatsString.

newtype Allocator Source #

VmaAllocator

Represents main object of this library initialized.

Fill structure AllocatorCreateInfo and call function createAllocator to create it. Call function destroyAllocator to destroy it.

It is recommended to create just one object of this type per VkDevice object, right after Vulkan is initialized and keep it alive until before Vulkan device is destroyed.

Constructors

Allocator Word64 

type FN_vmaAllocateDeviceMemoryFunction = Allocator -> ("memoryType" ::: Word32) -> DeviceMemory -> DeviceSize -> ("pUserData" ::: Ptr ()) -> IO () Source #

type FN_vmaFreeDeviceMemoryFunction = Allocator -> ("memoryType" ::: Word32) -> DeviceMemory -> DeviceSize -> ("pUserData" ::: Ptr ()) -> IO () Source #

data DeviceMemoryCallbacks Source #

VmaDeviceMemoryCallbacks

Set of callbacks that the library will call for vkAllocateMemory and vkFreeMemory.

Provided for informative purpose, e.g. to gather statistics about number of allocations or total amount of memory allocated in Vulkan.

Used in VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.

Constructors

DeviceMemoryCallbacks 

Fields

Instances

Instances details
Show DeviceMemoryCallbacks Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable DeviceMemoryCallbacks Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero DeviceMemoryCallbacks Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct DeviceMemoryCallbacks Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct DeviceMemoryCallbacks Source # 
Instance details

Defined in VulkanMemoryAllocator

newtype AllocatorCreateFlagBits Source #

Flags for created Allocator.

Bundled Patterns

pattern ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT :: AllocatorCreateFlagBits

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.

Using this flag may increase performance because internal mutexes are not used.

pattern ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT :: AllocatorCreateFlagBits

Enables usage of VK_KHR_dedicated_allocation extension.

The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion == VK_API_VERSION_1_0. When it is VK_API_VERSION_1_1, the flag is ignored because the extension has been promoted to Vulkan 1.1.

Using this extension will automatically allocate dedicated blocks of memory for some buffers and images instead of suballocating place for them out of bigger memory blocks (as if you explicitly used ALLOCATION_CREATE_DEDICATED_MEMORY_BIT flag) when it is recommended by the driver. It may improve performance on some GPUs.

You may set this flag only if you found out that following device extensions are supported, you enabled them while creating Vulkan device passed as VmaAllocatorCreateInfo::device, and you want them to be used internally by this library:

  • VK_KHR_get_memory_requirements2 (device extension)
  • VK_KHR_dedicated_allocation (device extension)

When this flag is set, you can experience following warnings reported by Vulkan validation layer. You can ignore them.

vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer.

pattern ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT :: AllocatorCreateFlagBits

Enables usage of VK_KHR_bind_memory2 extension.

The flag works only if VmaAllocatorCreateInfo::vulkanApiVersion == VK_API_VERSION_1_0. When it is VK_API_VERSION_1_1, the flag is ignored because the extension has been promoted to Vulkan 1.1.

You may set this flag only if you found out that this device extension is supported, you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device, and you want it to be used internally by this library.

The extension provides functions vkBindBufferMemory2KHR and vkBindImageMemory2KHR, which allow to pass a chain of pNext structures while binding. This flag is required if you use pNext parameter in bindBufferMemory2 or bindImageMemory2.

pattern ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT :: AllocatorCreateFlagBits

Enables usage of VK_EXT_memory_budget extension.

You may set this flag only if you found out that this device extension is supported, you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device, and you want it to be used internally by this library, along with another instance extension VK_KHR_get_physical_device_properties2, which is required by it (or Vulkan 1.1, where this extension is promoted).

The extension provides query for current memory usage and budget, which will probably be more accurate than an estimation used by the library otherwise.

pattern ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT :: AllocatorCreateFlagBits

Enables usage of VK_AMD_device_coherent_memory extension.

You may set this flag only if you:

  • found out that this device extension is supported and enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
  • checked that VkPhysicalDeviceCoherentMemoryFeaturesAMD::deviceCoherentMemory is true and set it while creating the Vulkan device,
  • want it to be used internally by this library.

The extension and accompanying device feature provide access to memory types with VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD and VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD flags. They are useful mostly for writing breadcrumb markers - a common method for debugging GPU crash/hang/TDR.

When the extension is not enabled, such memory types are still enumerated, but their usage is illegal. To 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, returning VK_ERROR_FEATURE_NOT_PRESENT.

pattern ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT :: AllocatorCreateFlagBits

Enables usage of "buffer device address" feature, which allows you to use function vkGetBufferDeviceAddress* to get raw GPU pointer to a buffer and pass it for usage inside a shader.

You may set this flag only if you:

  1. (For Vulkan version < 1.2) Found as available and enabled device extension VK_KHR_buffer_device_address. This extension is promoted to core Vulkan 1.2.
  2. Found as available and enabled device feature VkPhysicalDeviceBufferDeviceAddressFeatures::bufferDeviceAddress.

When this flag is set, you can create buffers with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT using VMA. The library automatically adds VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT to allocated memory blocks wherever it might be needed.

For more information, see documentation chapter /Enabling buffer device address/.

pattern ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT :: AllocatorCreateFlagBits

Enables usage of VK_EXT_memory_priority extension in the library.

You may set this flag only if you found available and enabled this device extension, along with VkPhysicalDeviceMemoryPriorityFeaturesEXT::memoryPriority == VK_TRUE, while creating Vulkan device passed as VmaAllocatorCreateInfo::device.

When this flag is used, VmaAllocationCreateInfo::priority and VmaPoolCreateInfo::priority are used to set priorities of allocated Vulkan memory. Without it, these variables are ignored.

A priority must be a floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations. Larger values are higher priority. The granularity of the priorities is implementation-dependent. It is automatically passed to every call to vkAllocateMemory done by the library using structure VkMemoryPriorityAllocateInfoEXT. The value to be used for default priority is 0.5. For more details, see the documentation of the VK_EXT_memory_priority extension.

Instances

Instances details
Eq AllocatorCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord AllocatorCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Read AllocatorCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Show AllocatorCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable AllocatorCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Bits AllocatorCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

FiniteBits AllocatorCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero AllocatorCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

data VulkanFunctions Source #

VmaVulkanFunctions

Pointers to some Vulkan functions - a subset used by the library.

Used in VmaAllocatorCreateInfo::pVulkanFunctions.

Constructors

VulkanFunctions 

Fields

Instances

Instances details
Eq VulkanFunctions Source # 
Instance details

Defined in VulkanMemoryAllocator

Show VulkanFunctions Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable VulkanFunctions Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero VulkanFunctions Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct VulkanFunctions Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct VulkanFunctions Source # 
Instance details

Defined in VulkanMemoryAllocator

newtype RecordFlagBits Source #

Flags to be used in VmaRecordSettings::flags.

Constructors

RecordFlagBits Flags 

Bundled Patterns

pattern RECORD_FLUSH_AFTER_CALL_BIT :: RecordFlagBits

Enables flush after recording every function call.

Enable it if you expect your application to crash, which may leave recording file truncated. It may degrade performance though.

Instances

Instances details
Eq RecordFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord RecordFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Read RecordFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Show RecordFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable RecordFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Bits RecordFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

FiniteBits RecordFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero RecordFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

data RecordSettings Source #

VmaRecordSettings

Parameters for recording calls to VMA functions. To be used in VmaAllocatorCreateInfo::pRecordSettings.

Constructors

RecordSettings 

Fields

  • flags :: RecordFlags

    Flags for recording. Use RecordFlagBits enum.

  • filePath :: ByteString

    Path to the file that should be written by the recording.

    Suggested extension: "csv". If the file already exists, it will be overwritten. It will be opened for the whole time Allocator object is alive. If opening this file fails, creation of the whole allocator object fails.

data AllocatorCreateInfo Source #

VmaAllocatorCreateInfo

Description of a Allocator to be created.

Constructors

AllocatorCreateInfo 

Fields

  • flags :: AllocatorCreateFlags

    Flags for created allocator. Use AllocatorCreateFlagBits enum.

  • physicalDevice :: Ptr PhysicalDevice_T

    Vulkan physical device.

    It must be valid throughout whole lifetime of created allocator.

  • device :: Ptr Device_T

    Vulkan device.

    It must be valid throughout whole lifetime of created allocator.

  • preferredLargeHeapBlockSize :: DeviceSize

    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.

  • allocationCallbacks :: Maybe AllocationCallbacks

    Custom CPU memory allocation callbacks. Optional.

    Optional, can be null. When specified, will also be used for all CPU-side memory allocations.

  • deviceMemoryCallbacks :: Maybe DeviceMemoryCallbacks

    Informative callbacks for vkAllocateMemory, vkFreeMemory. Optional.

    Optional, can be null.

  • frameInUseCount :: Word32

    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 VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocation cannot become lost if allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount.

    For example, if you double-buffer your command buffers, so resources used for rendering in previous frame may still be in use by the GPU at the moment you allocate resources needed for the current frame, set this value to 1.

    If you want to allow any allocations other than used in the current frame to become lost, set this value to 0.

  • heapSizeLimit :: Ptr DeviceSize

    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.

    If not NULL, it must be a pointer to an array of VkPhysicalDeviceMemoryProperties::memoryHeapCount elements, defining limit on maximum number of bytes that can be allocated out of particular Vulkan memory heap.

    Any of the elements may be equal to VK_WHOLE_SIZE, which means no limit on that heap. This is also the default in case of pHeapSizeLimit = NULL.

    If there is a limit defined for a heap:

    • If user tries to allocate more memory from that heap using this allocator, the allocation fails with VK_ERROR_OUT_OF_DEVICE_MEMORY.
    • If the limit is smaller than heap size reported in VkMemoryHeap::size, the value of this limit will be reported instead when using getMemoryProperties.

    Warning! Using this feature may not be equivalent to installing a GPU with smaller amount of memory, because graphics driver doesn't necessary fail new allocations with VK_ERROR_OUT_OF_DEVICE_MEMORY result when memory capacity is exceeded. It may return success and just silently migrate some device memory blocks to system RAM. This driver behavior can also be controlled using VK_AMD_memory_overallocation_behavior extension.

  • vulkanFunctions :: Maybe VulkanFunctions

    Pointers to Vulkan functions. Can be null.

    For details see Pointers to Vulkan functions.

  • recordSettings :: Maybe RecordSettings

    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.

  • instance' :: Ptr Instance_T

    Handle to Vulkan instance object.

    Starting from version 3.0.0 this member is no longer optional, it must be set!

  • vulkanApiVersion :: Word32

    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. The patch version number specified is ignored. Only the major and minor versions are considered. It must be less or equal (preferably equal) to value as passed to vkCreateInstance as VkApplicationInfo::apiVersion. Only versions 1.0, 1.1, 1.2 are supported by the current implementation. Leaving it initialized to zero is equivalent to VK_API_VERSION_1_0.

  • typeExternalMemoryHandleTypes :: Ptr ExternalMemoryHandleTypeFlagsKHR

    Either null or a pointer to an array of external memory handle types for each Vulkan memory type.

    If not NULL, it must be a pointer to an array of VkPhysicalDeviceMemoryProperties::memoryTypeCount elements, defining external memory handle types of particular Vulkan memory type, to be passed using VkExportMemoryAllocateInfoKHR.

    Any of the elements may be equal to 0, which means not to use VkExportMemoryAllocateInfoKHR on this memory type. This is also the default in case of pTypeExternalMemoryHandleTypes = NULL.

data AllocatorInfo Source #

VmaAllocatorInfo

Information about existing Allocator object.

Constructors

AllocatorInfo 

Fields

  • instance' :: Ptr Instance_T

    Handle to Vulkan instance object.

    This is the same value as has been passed through VmaAllocatorCreateInfo::instance.

  • physicalDevice :: Ptr PhysicalDevice_T

    Handle to Vulkan physical device object.

    This is the same value as has been passed through VmaAllocatorCreateInfo::physicalDevice.

  • device :: Ptr Device_T

    Handle to Vulkan device object.

    This is the same value as has been passed through VmaAllocatorCreateInfo::device.

Instances

Instances details
Eq AllocatorInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Show AllocatorInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable AllocatorInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero AllocatorInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

zero :: AllocatorInfo #

ToCStruct AllocatorInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct AllocatorInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

data StatInfo Source #

VmaStatInfo

Calculated statistics of memory usage in entire allocator.

Constructors

StatInfo 

Fields

Instances

Instances details
Eq StatInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Show StatInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable StatInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero StatInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

zero :: StatInfo #

ToCStruct StatInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct StatInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

data Stats Source #

VmaStats

General statistics from current state of Allocator.

memoryHeap

memoryHeap VmaStats VmaStats memoryHeap VmaStatInfo VmaStats::memoryHeap[VK_MAX_MEMORY_HEAPS]

memoryType

memoryType VmaStats VmaStats memoryType VmaStatInfo VmaStats::memoryType[VK_MAX_MEMORY_TYPES]

Instances

Instances details
Show Stats Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

showsPrec :: Int -> Stats -> ShowS #

show :: Stats -> String #

showList :: [Stats] -> ShowS #

Storable Stats Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

sizeOf :: Stats -> Int #

alignment :: Stats -> Int #

peekElemOff :: Ptr Stats -> Int -> IO Stats #

pokeElemOff :: Ptr Stats -> Int -> Stats -> IO () #

peekByteOff :: Ptr b -> Int -> IO Stats #

pokeByteOff :: Ptr b -> Int -> Stats -> IO () #

peek :: Ptr Stats -> IO Stats #

poke :: Ptr Stats -> Stats -> IO () #

Zero Stats Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

zero :: Stats #

ToCStruct Stats Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

withCStruct :: Stats -> (Ptr Stats -> IO b) -> IO b #

pokeCStruct :: Ptr Stats -> Stats -> IO b -> IO b #

withZeroCStruct :: (Ptr Stats -> IO b) -> IO b #

pokeZeroCStruct :: Ptr Stats -> IO b -> IO b #

cStructSize :: Int #

cStructAlignment :: Int #

FromCStruct Stats Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

peekCStruct :: Ptr Stats -> IO Stats #

data Budget Source #

VmaBudget

Statistics of current memory usage and available budget, in bytes, for specific memory heap.

Constructors

Budget 

Fields

  • blockBytes :: DeviceSize

    Sum size of all VkDeviceMemory blocks allocated from particular heap, in bytes.

  • allocationBytes :: DeviceSize

    Sum size of all allocations created in particular heap, in bytes.

    Usually less or equal than blockBytes. Difference blockBytes - allocationBytes is the amount of memory allocated but unused - available for new allocations or wasted due to fragmentation.

    It might be greater than blockBytes if there are some allocations in lost state, as they account to this value as well.

  • usage :: DeviceSize

    Estimated current memory usage of the program, in bytes.

    Fetched from system using VK_EXT_memory_budget extension if enabled.

    It might be different than blockBytes (usually higher) due to additional implicit objects also occupying the memory, like swapchain, pipelines, descriptor heaps, command buffers, or VkDeviceMemory blocks allocated outside of this library, if any.

  • budget :: DeviceSize

    Estimated amount of memory available to the program, in bytes.

    Fetched from system using VK_EXT_memory_budget extension if enabled.

    It might be different (most probably smaller) than VkMemoryHeap::size[heapIndex] due to factors external to the program, like other programs also consuming system resources. Difference budget - usage is the amount of additional memory that can probably be allocated without problems. Exceeding the budget may result in various problems.

Instances

Instances details
Eq Budget Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

(==) :: Budget -> Budget -> Bool #

(/=) :: Budget -> Budget -> Bool #

Show Budget Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable Budget Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero Budget Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

zero :: Budget #

ToCStruct Budget Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct Budget Source # 
Instance details

Defined in VulkanMemoryAllocator

newtype Pool Source #

VmaPool

Represents custom memory pool.

Fill structure PoolCreateInfo and call function createPool to create it. Call function destroyPool to destroy it.

For more information see Custom memory pools.

Constructors

Pool Word64 

Instances

Instances details
Eq Pool Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

(==) :: Pool -> Pool -> Bool #

(/=) :: Pool -> Pool -> Bool #

Ord Pool Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

compare :: Pool -> Pool -> Ordering #

(<) :: Pool -> Pool -> Bool #

(<=) :: Pool -> Pool -> Bool #

(>) :: Pool -> Pool -> Bool #

(>=) :: Pool -> Pool -> Bool #

max :: Pool -> Pool -> Pool #

min :: Pool -> Pool -> Pool #

Show Pool Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

showsPrec :: Int -> Pool -> ShowS #

show :: Pool -> String #

showList :: [Pool] -> ShowS #

Storable Pool Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

sizeOf :: Pool -> Int #

alignment :: Pool -> Int #

peekElemOff :: Ptr Pool -> Int -> IO Pool #

pokeElemOff :: Ptr Pool -> Int -> Pool -> IO () #

peekByteOff :: Ptr b -> Int -> IO Pool #

pokeByteOff :: Ptr b -> Int -> Pool -> IO () #

peek :: Ptr Pool -> IO Pool #

poke :: Ptr Pool -> Pool -> IO () #

IsHandle Pool Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero Pool Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

zero :: Pool #

newtype MemoryUsage Source #

Constructors

MemoryUsage Int32 

Bundled Patterns

pattern MEMORY_USAGE_UNKNOWN :: MemoryUsage

No intended memory usage specified. Use other members of AllocationCreateInfo to specify your requirements.

pattern MEMORY_USAGE_GPU_ONLY :: MemoryUsage

Memory will be used on device only, so fast access from the device is preferred. It usually means device-local GPU (video) memory. No need to be mappable on host. It is roughly equivalent of D3D12_HEAP_TYPE_DEFAULT.

Usage:

  • Resources written and read by device, e.g. images used as attachments.
  • Resources transferred from host once (immutable) or infrequently and read by device multiple times, e.g. textures to be sampled, vertex buffers, uniform (constant) buffers, and majority of other types of resources used on GPU.

Allocation may still end up in HOST_VISIBLE memory on some implementations. In such case, you are free to map it. You can use ALLOCATION_CREATE_MAPPED_BIT with this usage type.

pattern MEMORY_USAGE_CPU_ONLY :: MemoryUsage

Memory will be mappable on host. It usually means CPU (system) memory. Guarantees to be HOST_VISIBLE and HOST_COHERENT. CPU access is typically uncached. Writes may be write-combined. Resources created in this pool may still be accessible to the device, but access to them can be slow. It is roughly equivalent of D3D12_HEAP_TYPE_UPLOAD.

Usage: Staging copy of resources used as transfer source.

pattern MEMORY_USAGE_CPU_TO_GPU :: MemoryUsage

Memory that is both mappable on host (guarantees to be HOST_VISIBLE) and preferably fast to access by GPU. CPU access is typically uncached. Writes may be write-combined.

Usage: Resources written frequently by host (dynamic), read by device. E.g. textures (with LINEAR layout), vertex buffers, uniform buffers updated every frame or every draw call.

pattern MEMORY_USAGE_GPU_TO_CPU :: MemoryUsage

Memory mappable on host (guarantees to be HOST_VISIBLE) and cached. It is roughly equivalent of D3D12_HEAP_TYPE_READBACK.

Usage:

  • Resources written by device, read by host - results of some computations, e.g. screen capture, average scene luminance for HDR tone mapping.
  • Any resources read or accessed randomly on host, e.g. CPU-side copy of vertex buffer used as source of transfer, but also used for collision detection.
pattern MEMORY_USAGE_CPU_COPY :: MemoryUsage

CPU memory - memory that is preferably not DEVICE_LOCAL, but also not guaranteed to be HOST_VISIBLE.

Usage: Staging copy of resources moved from GPU memory to CPU memory as part of custom paging/residency mechanism, to be moved back to GPU memory when needed.

pattern MEMORY_USAGE_GPU_LAZILY_ALLOCATED :: MemoryUsage

Lazily allocated GPU memory having VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT. Exists mostly on mobile platforms. Using it on desktop PC or other GPUs with no such memory type present will fail the allocation.

Usage: Memory for transient attachment images (color attachments, depth attachments etc.), created with VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT.

Allocations with this usage are always created as dedicated - it implies ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.

Instances

Instances details
Eq MemoryUsage Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord MemoryUsage Source # 
Instance details

Defined in VulkanMemoryAllocator

Read MemoryUsage Source # 
Instance details

Defined in VulkanMemoryAllocator

Show MemoryUsage Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable MemoryUsage Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero MemoryUsage Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

zero :: MemoryUsage #

newtype AllocationCreateFlagBits Source #

Flags to be passed as VmaAllocationCreateInfo::flags.

Bundled Patterns

pattern ALLOCATION_CREATE_DEDICATED_MEMORY_BIT :: AllocationCreateFlagBits

Set this flag if the allocation should have its own memory block.

Use it for special, big resources, like fullscreen images used as attachments.

You should not use this flag if VmaAllocationCreateInfo::pool is not null.

pattern ALLOCATION_CREATE_NEVER_ALLOCATE_BIT :: AllocationCreateFlagBits

Set this flag to only try to allocate from existing VkDeviceMemory blocks and never create new such block.

If new allocation cannot be placed in any of the existing blocks, allocation fails with VK_ERROR_OUT_OF_DEVICE_MEMORY error.

You should not use ALLOCATION_CREATE_DEDICATED_MEMORY_BIT and ALLOCATION_CREATE_NEVER_ALLOCATE_BIT at the same time. It makes no sense.

If VmaAllocationCreateInfo::pool is not null, this flag is implied and ignored.

pattern ALLOCATION_CREATE_MAPPED_BIT :: AllocationCreateFlagBits

Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.

Pointer to mapped memory will be returned through VmaAllocationInfo::pMappedData.

It is valid to use this flag for allocation made from memory type that is not HOST_VISIBLE. This flag is then ignored and memory is not mapped. This is useful if you need an allocation that is efficient to use on GPU (DEVICE_LOCAL) and still want to map it directly if possible on platforms that support it (e.g. Intel GPU).

You should not use this flag together with ALLOCATION_CREATE_CAN_BECOME_LOST_BIT.

pattern ALLOCATION_CREATE_CAN_BECOME_LOST_BIT :: AllocationCreateFlagBits

Allocation created with this flag can become lost as a result of another allocation with ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT flag, so you must check it before use.

To check if allocation is not lost, call getAllocationInfo and check if VmaAllocationInfo::deviceMemory is not VK_NULL_HANDLE.

For details about supporting lost allocations, see Lost Allocations chapter of User Guide on Main Page.

You should not use this flag together with ALLOCATION_CREATE_MAPPED_BIT.

pattern ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT :: AllocationCreateFlagBits

While creating allocation using this flag, other allocations that were created with flag ALLOCATION_CREATE_CAN_BECOME_LOST_BIT can become lost.

For details about supporting lost allocations, see Lost Allocations chapter of User Guide on Main Page.

pattern ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT :: AllocationCreateFlagBits

Set this flag to treat VmaAllocationCreateInfo::pUserData as pointer to a null-terminated string. Instead of copying pointer value, a local copy of the string is made and stored in allocation's pUserData. The string is automatically freed together with the allocation. It is also used in buildStatsString.

pattern ALLOCATION_CREATE_UPPER_ADDRESS_BIT :: AllocationCreateFlagBits

Allocation will be created from upper stack in a double stack pool.

This flag is only allowed for custom pools created with POOL_CREATE_LINEAR_ALGORITHM_BIT flag.

pattern ALLOCATION_CREATE_DONT_BIND_BIT :: AllocationCreateFlagBits

Create both buffer/image and allocation, but don't bind them together. It is useful when you want to bind yourself to do some more advanced binding, e.g. using some extensions. The flag is meaningful only with functions that bind by default: createBuffer, createImage. Otherwise it is ignored.

pattern ALLOCATION_CREATE_WITHIN_BUDGET_BIT :: AllocationCreateFlagBits

Create allocation only if additional device memory required for it, if any, won't exceed memory budget. Otherwise return VK_ERROR_OUT_OF_DEVICE_MEMORY.

pattern ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT :: AllocationCreateFlagBits

Allocation strategy that chooses smallest possible free range for the allocation.

pattern ALLOCATION_CREATE_STRATEGY_WORST_FIT_BIT :: AllocationCreateFlagBits

Allocation strategy that chooses biggest possible free range for the allocation.

pattern ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT :: AllocationCreateFlagBits

Allocation strategy that chooses first suitable free range for the allocation.

"First" doesn't necessarily means the one with smallest offset in memory, but rather the one that is easiest and fastest to find.

pattern ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT :: AllocationCreateFlagBits

Allocation strategy that tries to minimize memory usage.

pattern ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT :: AllocationCreateFlagBits

Allocation strategy that tries to minimize allocation time.

pattern ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT :: AllocationCreateFlagBits

Allocation strategy that tries to minimize memory fragmentation.

pattern ALLOCATION_CREATE_STRATEGY_MASK :: AllocationCreateFlagBits

A bit mask to extract only STRATEGY bits from entire set of flags.

Instances

Instances details
Eq AllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord AllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Read AllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Show AllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable AllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Bits AllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

FiniteBits AllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero AllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

data AllocationCreateInfo Source #

VmaAllocationCreateInfo

Constructors

AllocationCreateInfo 

Fields

  • flags :: AllocationCreateFlags
  • usage :: MemoryUsage

    Intended usage of memory.

    You can leave MEMORY_USAGE_UNKNOWN if you specify memory requirements in other way.

     

    If pool is not null, this member is ignored.

  • requiredFlags :: MemoryPropertyFlags

    Flags that must be set in a Memory Type chosen for an allocation.

    Leave 0 if you specify memory requirements in other way.

     

    If pool is not null, this member is ignored.

  • preferredFlags :: MemoryPropertyFlags

    Flags that preferably should be set in a memory type chosen for an allocation.

    Set to 0 if no additional flags are preferred.

     

    If pool is not null, this member is ignored.

  • memoryTypeBits :: Word32

    Bitmask containing one bit set for every memory type acceptable for this allocation.

    Value 0 is equivalent to UINT32_MAX - it means any memory type is accepted if it meets other requirements specified by this structure, with no further restrictions on memory type index.

     

    If pool is not null, this member is ignored.

  • pool :: Pool

    Pool that this allocation should be created in.

    Leave VK_NULL_HANDLE to allocate from default pool. If not null, members: usage, requiredFlags, preferredFlags, memoryTypeBits are ignored.

  • userData :: Ptr ()

    Custom general-purpose pointer that will be stored in Allocation, can be read as VmaAllocationInfo::pUserData and changed using setAllocationUserData.

    If 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.

  • priority :: Float

    A floating-point value between 0 and 1, indicating the priority of the allocation relative to other memory allocations.

    It is used only when ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT flag was used during creation of the Allocator object and this allocation ends up as dedicated or is explicitly forced as dedicated using ALLOCATION_CREATE_DEDICATED_MEMORY_BIT. Otherwise, it has the priority of a memory block where it is placed and this variable is ignored.

Instances

Instances details
Show AllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable AllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero AllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct AllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct AllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

newtype PoolCreateFlagBits Source #

Flags to be passed as VmaPoolCreateInfo::flags.

Bundled Patterns

pattern POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT :: PoolCreateFlagBits

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.

This is an optional optimization flag.

If you always allocate using createBuffer, createImage, allocateMemoryForBuffer, then you don't need to use it because allocator knows exact type of your allocations so it can handle Buffer-Image Granularity in the optimal way.

If you also allocate using allocateMemoryForImage or allocateMemory, exact type of such allocations is not known, so allocator must be conservative in handling Buffer-Image Granularity, which can lead to suboptimal allocation (wasted memory). In that case, if you can make sure you always allocate only buffers and linear images or only optimal images out of this pool, use this flag to make allocator disregard Buffer-Image Granularity and so make allocations faster and more optimal.

pattern POOL_CREATE_LINEAR_ALGORITHM_BIT :: PoolCreateFlagBits

Enables alternative, linear allocation algorithm in this pool.

Specify this flag to enable linear allocation algorithm, which always creates new allocations after last one and doesn't reuse space from allocations freed in between. It trades memory consumption for simplified algorithm and data structure, which has better performance and uses less memory for metadata.

By using this flag, you can achieve behavior of free-at-once, stack, ring buffer, and double stack. For details, see documentation chapter Linear allocation algorithm.

When using this flag, you must specify VmaPoolCreateInfo::maxBlockCount == 1 (or 0 for default).

pattern POOL_CREATE_BUDDY_ALGORITHM_BIT :: PoolCreateFlagBits

Enables alternative, buddy allocation algorithm in this pool.

It operates on a tree of blocks, each having size that is a power of two and a half of its parent's size. Comparing to default algorithm, this one provides faster allocation and deallocation and decreased external fragmentation, at the expense of more memory wasted (internal fragmentation). For details, see documentation chapter /Buddy allocation algorithm/.

pattern POOL_CREATE_ALGORITHM_MASK :: PoolCreateFlagBits

Bit mask to extract only ALGORITHM bits from entire set of flags.

Instances

Instances details
Eq PoolCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord PoolCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Read PoolCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Show PoolCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable PoolCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Bits PoolCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

FiniteBits PoolCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero PoolCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

data PoolCreateInfo Source #

VmaPoolCreateInfo

Describes parameter of created Pool.

Constructors

PoolCreateInfo 

Fields

  • memoryTypeIndex :: Word32

    Vulkan memory type index to allocate this pool from.

  • flags :: PoolCreateFlags

    Use combination of PoolCreateFlagBits.

  • blockSize :: DeviceSize

    Size of a single VkDeviceMemory block to be allocated as part of this pool, in bytes. Optional.

    Specify nonzero to set explicit, constant size of memory blocks used by this pool.

    Leave 0 to use default and let the library manage block sizes automatically. Sizes of particular blocks may vary.

  • minBlockCount :: Word64

    Minimum number of blocks to be always allocated in this pool, even if they stay empty.

    Set to 0 to have no preallocated blocks and allow the pool be completely empty.

  • maxBlockCount :: Word64

    Maximum number of blocks that can be allocated in this pool. Optional.

    Set to 0 to use default, which is SIZE_MAX, which means no limit.

    Set to same value as VmaPoolCreateInfo::minBlockCount to have fixed amount of memory allocated throughout whole lifetime of this pool.

  • frameInUseCount :: Word32

    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 ALLOCATION_CREATE_CAN_BECOME_LOST_BIT flag. Such allocation cannot become lost if allocation.lastUseFrameIndex >= allocator.currentFrameIndex - frameInUseCount.

    For example, if you double-buffer your command buffers, so resources used for rendering in previous frame may still be in use by the GPU at the moment you allocate resources needed for the current frame, set this value to 1.

    If you want to allow any allocations other than used in the current frame to become lost, set this value to 0.

  • priority :: Float

    A floating-point value between 0 and 1, indicating the priority of the allocations in this pool relative to other memory allocations.

    It is used only when ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT flag was used during creation of the Allocator object. Otherwise, this variable is ignored.

  • minAllocationAlignment :: DeviceSize

    Additional minimum alignment to be used for all allocations created from this pool. Can be 0.

    Leave 0 (default) not to impose any additional alignment. If not 0, it must be a power of two. It can be useful in cases where alignment returned by Vulkan by functions like vkGetBufferMemoryRequirements is not enough, e.g. when doing interop with OpenGL.

  • memoryAllocateNext :: Ptr ()

    Additional pNext chain to be attached to VkMemoryAllocateInfo used for every allocation made by this pool. Optional.

    Optional, can be null. If not null, it must point to a pNext chain of structures that can be attached to VkMemoryAllocateInfo. It can be useful for special needs such as adding VkExportMemoryAllocateInfoKHR. Structures pointed by this member must remain alive and unchanged for the whole lifetime of the custom pool.

    Please note that some structures, e.g. VkMemoryPriorityAllocateInfoEXT, VkMemoryDedicatedAllocateInfoKHR, can be attached automatically by this library when using other, more convenient of its features.

data PoolStats Source #

VmaPoolStats

Describes parameter of existing Pool.

Constructors

PoolStats 

Fields

Instances

Instances details
Eq PoolStats Source # 
Instance details

Defined in VulkanMemoryAllocator

Show PoolStats Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable PoolStats Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero PoolStats Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

zero :: PoolStats #

ToCStruct PoolStats Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct PoolStats Source # 
Instance details

Defined in VulkanMemoryAllocator

newtype Allocation Source #

VmaAllocation

Represents single memory allocation.

It may be either dedicated block of VkDeviceMemory or a specific region of a bigger block of this type plus unique offset.

There are multiple ways to create such object. You need to fill structure AllocationCreateInfo. For more information see /Choosing memory type/.

Although the library provides convenience functions that create Vulkan buffer or image, allocate memory for it and bind them together, binding of the allocation to a buffer or an image is out of scope of the allocation itself. Allocation object can exist without buffer/image bound, binding can be done manually by the user, and destruction of it can be done independently of destruction of the allocation.

The object also remembers its size and some other information. To retrieve this information, use function getAllocationInfo and inspect returned structure AllocationInfo.

Some kinds allocations can be in lost state. For more information, see Lost allocations.

Constructors

Allocation Word64 

data AllocationInfo Source #

VmaAllocationInfo

Parameters of Allocation objects, that can be retrieved using function getAllocationInfo.

Constructors

AllocationInfo 

Fields

  • memoryType :: Word32

    Memory type index that this allocation was allocated from.

    It never changes.

  • deviceMemory :: DeviceMemory

    Handle to Vulkan memory object.

    Same memory object can be shared by multiple allocations.

    It can change after call to defragment if this allocation is passed to the function, or if allocation is lost.

    If the allocation is lost, it is equal to VK_NULL_HANDLE.

  • offset :: DeviceSize

    Offset in VkDeviceMemory object to the beginning of this allocation, in bytes. (deviceMemory, offset) pair is unique to this allocation.

    You usually don't need to use this offset. If you create a buffer or an image together with the allocation using e.g. function createBuffer, createImage, functions that operate on these resources refer to the beginning of the buffer or image, not entire device memory block. Functions like mapMemory, bindBufferMemory also refer to the beginning of the allocation and apply this offset automatically.

    It can change after call to defragment if this allocation is passed to the function, or if allocation is lost.

  • size :: DeviceSize

    Size of this allocation, in bytes.

    It never changes, unless allocation is lost.

    Note

    Allocation size returned in this variable may be greater than the size requested for the resource e.g. as VkBufferCreateInfo::size. Whole size of the allocation is accessible for operations on memory e.g. using a pointer after mapping with mapMemory, but operations on the resource e.g. using vkCmdCopyBuffer must be limited to the size of the resource.

  • mappedData :: Ptr ()

    Pointer to the beginning of this allocation as mapped data.

    If the allocation hasn't been mapped using mapMemory and hasn't been created with ALLOCATION_CREATE_MAPPED_BIT flag, this value is null.

    It can change after call to mapMemory, unmapMemory. It can also change after call to defragment if this allocation is passed to the function.

  • userData :: Ptr ()

    Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using setAllocationUserData.

    It can change after call to setAllocationUserData for this allocation.

newtype DefragmentationContext Source #

VmaDefragmentationContext

Represents Opaque object that represents started defragmentation process.

Fill structure DefragmentationInfo2 and call function defragmentationBegin to create it. Call function defragmentationEnd to destroy it.

Instances

Instances details
Eq DefragmentationContext Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord DefragmentationContext Source # 
Instance details

Defined in VulkanMemoryAllocator

Show DefragmentationContext Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable DefragmentationContext Source # 
Instance details

Defined in VulkanMemoryAllocator

IsHandle DefragmentationContext Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero DefragmentationContext Source # 
Instance details

Defined in VulkanMemoryAllocator

newtype DefragmentationFlagBits Source #

Flags to be used in defragmentationBegin. None at the moment. Reserved for future use.

Instances

Instances details
Eq DefragmentationFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord DefragmentationFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Read DefragmentationFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Show DefragmentationFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable DefragmentationFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Bits DefragmentationFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

FiniteBits DefragmentationFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero DefragmentationFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

data DefragmentationInfo2 Source #

VmaDefragmentationInfo2

Parameters for defragmentation.

To be used with function defragmentationBegin.

Constructors

DefragmentationInfo2 

Fields

  • flags :: DefragmentationFlags

    Reserved for future use. Should be 0.

  • allocations :: Vector Allocation

    Pointer to array of allocations that can be defragmented.

    The array should have allocationCount elements. The array should not contain nulls. Elements in the array should be unique - same allocation cannot occur twice. 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.

  • allocationsChanged :: Ptr Bool32

    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.

  • pools :: Vector Pool

    Either null or pointer to array of pools to be defragmented.

    All the allocations in the specified pools can be moved during defragmentation and there is no way to check if they were really moved as in pAllocationsChanged, so you must query all the allocations in all these pools for new VkDeviceMemory and offset using getAllocationInfo if you might need to recreate buffers and images bound to them.

    The array should have poolCount elements. The array should not contain nulls. Elements in the array should be unique - same pool cannot occur twice.

    Using this array is equivalent to specifying all allocations from the pools in pAllocations. It might be more efficient.

  • maxCpuBytesToMove :: DeviceSize

    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.

  • maxCpuAllocationsToMove :: Word32

    Maximum number of allocations that can be moved to a different place using transfers on CPU side, like memcpy(), memmove().

    UINT32_MAX means no limit.

  • maxGpuBytesToMove :: DeviceSize

    Maximum total numbers of bytes that can be copied while moving allocations to different places using transfers on GPU side, posted to commandBuffer.

    VK_WHOLE_SIZE means no limit.

  • maxGpuAllocationsToMove :: Word32

    Maximum number of allocations that can be moved to a different place using transfers on GPU side, posted to commandBuffer.

    UINT32_MAX means no limit.

  • commandBuffer :: Ptr CommandBuffer_T

    Optional. Command buffer where GPU copy commands will be posted.

    If not null, it must be a valid command buffer handle that supports Transfer queue type. It must be in the recording state and outside of a render pass instance. You need to submit it and make sure it finished execution before calling defragmentationEnd.

    Passing null means that only CPU defragmentation will be performed.

data DefragmentationPassMoveInfo Source #

VmaDefragmentationPassMoveInfo

Instances

Instances details
Eq DefragmentationPassMoveInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Show DefragmentationPassMoveInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable DefragmentationPassMoveInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero DefragmentationPassMoveInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct DefragmentationPassMoveInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct DefragmentationPassMoveInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

data DefragmentationPassInfo Source #

VmaDefragmentationPassInfo

Parameters for incremental defragmentation steps.

To be used with function beginDefragmentationPass.

Instances

Instances details
Eq DefragmentationPassInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Show DefragmentationPassInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable DefragmentationPassInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero DefragmentationPassInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct DefragmentationPassInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct DefragmentationPassInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

data DefragmentationInfo Source #

VmaDefragmentationInfo

Deprecated. Optional configuration parameters to be passed to function defragment.

Deprecated

This is a part of the old interface. It is recommended to use structure DefragmentationInfo2 and function defragmentationBegin instead.

Constructors

DefragmentationInfo 

Fields

  • maxBytesToMove :: DeviceSize

    Maximum total numbers of bytes that can be copied while moving allocations to different places.

    Default is VK_WHOLE_SIZE, which means no limit.

  • maxAllocationsToMove :: Word32

    Maximum number of allocations that can be moved to different place.

    Default is UINT32_MAX, which means no limit.

Instances

Instances details
Eq DefragmentationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Show DefragmentationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable DefragmentationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero DefragmentationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct DefragmentationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct DefragmentationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

data DefragmentationStats Source #

VmaDefragmentationStats

Statistics returned by function defragment.

Constructors

DefragmentationStats 

Fields

Instances

Instances details
Eq DefragmentationStats Source # 
Instance details

Defined in VulkanMemoryAllocator

Show DefragmentationStats Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable DefragmentationStats Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero DefragmentationStats Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct DefragmentationStats Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct DefragmentationStats Source # 
Instance details

Defined in VulkanMemoryAllocator

newtype VirtualBlockCreateFlagBits Source #

Flags to be passed as VmaVirtualBlockCreateInfo::flags.

Bundled Patterns

pattern VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT :: VirtualBlockCreateFlagBits

Enables alternative, linear allocation algorithm in this virtual block.

Specify this flag to enable linear allocation algorithm, which always creates new allocations after last one and doesn't reuse space from allocations freed in between. It trades memory consumption for simplified algorithm and data structure, which has better performance and uses less memory for metadata.

By using this flag, you can achieve behavior of free-at-once, stack, ring buffer, and double stack. For details, see documentation chapter Linear allocation algorithm.

pattern VIRTUAL_BLOCK_CREATE_BUDDY_ALGORITHM_BIT :: VirtualBlockCreateFlagBits

Enables alternative, buddy allocation algorithm in this virtual block.

It operates on a tree of blocks, each having size that is a power of two and a half of its parent's size. Comparing to default algorithm, this one provides faster allocation and deallocation and decreased external fragmentation, at the expense of more memory wasted (internal fragmentation). For details, see documentation chapter /Buddy allocation algorithm/.

pattern VIRTUAL_BLOCK_CREATE_ALGORITHM_MASK :: VirtualBlockCreateFlagBits

Bit mask to extract only ALGORITHM bits from entire set of flags.

Instances

Instances details
Eq VirtualBlockCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord VirtualBlockCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Read VirtualBlockCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Show VirtualBlockCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable VirtualBlockCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Bits VirtualBlockCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

(.&.) :: VirtualBlockCreateFlagBits -> VirtualBlockCreateFlagBits -> VirtualBlockCreateFlagBits #

(.|.) :: VirtualBlockCreateFlagBits -> VirtualBlockCreateFlagBits -> VirtualBlockCreateFlagBits #

xor :: VirtualBlockCreateFlagBits -> VirtualBlockCreateFlagBits -> VirtualBlockCreateFlagBits #

complement :: VirtualBlockCreateFlagBits -> VirtualBlockCreateFlagBits #

shift :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

rotate :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

zeroBits :: VirtualBlockCreateFlagBits #

bit :: Int -> VirtualBlockCreateFlagBits #

setBit :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

clearBit :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

complementBit :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

testBit :: VirtualBlockCreateFlagBits -> Int -> Bool #

bitSizeMaybe :: VirtualBlockCreateFlagBits -> Maybe Int #

bitSize :: VirtualBlockCreateFlagBits -> Int #

isSigned :: VirtualBlockCreateFlagBits -> Bool #

shiftL :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

unsafeShiftL :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

shiftR :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

unsafeShiftR :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

rotateL :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

rotateR :: VirtualBlockCreateFlagBits -> Int -> VirtualBlockCreateFlagBits #

popCount :: VirtualBlockCreateFlagBits -> Int #

FiniteBits VirtualBlockCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero VirtualBlockCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

data VirtualBlockCreateInfo Source #

VmaVirtualBlockCreateInfo

Parameters of created VirtualBlock object to be passed to createVirtualBlock.

Constructors

VirtualBlockCreateInfo 

Fields

newtype VirtualAllocationCreateFlagBits Source #

Flags to be passed as VmaVirtualAllocationCreateInfo::flags.

Bundled Patterns

pattern VIRTUAL_ALLOCATION_CREATE_UPPER_ADDRESS_BIT :: VirtualAllocationCreateFlagBits

Allocation will be created from upper stack in a double stack pool.

This flag is only allowed for virtual blocks created with VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT flag.

pattern VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT :: VirtualAllocationCreateFlagBits

Allocation strategy that tries to minimize memory usage.

pattern VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT :: VirtualAllocationCreateFlagBits

Allocation strategy that tries to minimize allocation time.

pattern VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_FRAGMENTATION_BIT :: VirtualAllocationCreateFlagBits

Allocation strategy that tries to minimize memory fragmentation.

pattern VIRTUAL_ALLOCATION_CREATE_STRATEGY_MASK :: VirtualAllocationCreateFlagBits

A bit mask to extract only STRATEGY bits from entire set of flags.

These stategy flags are binary compatible with equivalent flags in AllocationCreateFlagBits.

Instances

Instances details
Eq VirtualAllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Ord VirtualAllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Read VirtualAllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Show VirtualAllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable VirtualAllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Bits VirtualAllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Methods

(.&.) :: VirtualAllocationCreateFlagBits -> VirtualAllocationCreateFlagBits -> VirtualAllocationCreateFlagBits #

(.|.) :: VirtualAllocationCreateFlagBits -> VirtualAllocationCreateFlagBits -> VirtualAllocationCreateFlagBits #

xor :: VirtualAllocationCreateFlagBits -> VirtualAllocationCreateFlagBits -> VirtualAllocationCreateFlagBits #

complement :: VirtualAllocationCreateFlagBits -> VirtualAllocationCreateFlagBits #

shift :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

rotate :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

zeroBits :: VirtualAllocationCreateFlagBits #

bit :: Int -> VirtualAllocationCreateFlagBits #

setBit :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

clearBit :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

complementBit :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

testBit :: VirtualAllocationCreateFlagBits -> Int -> Bool #

bitSizeMaybe :: VirtualAllocationCreateFlagBits -> Maybe Int #

bitSize :: VirtualAllocationCreateFlagBits -> Int #

isSigned :: VirtualAllocationCreateFlagBits -> Bool #

shiftL :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

unsafeShiftL :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

shiftR :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

unsafeShiftR :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

rotateL :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

rotateR :: VirtualAllocationCreateFlagBits -> Int -> VirtualAllocationCreateFlagBits #

popCount :: VirtualAllocationCreateFlagBits -> Int #

FiniteBits VirtualAllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero VirtualAllocationCreateFlagBits Source # 
Instance details

Defined in VulkanMemoryAllocator

data VirtualAllocationCreateInfo Source #

VmaVirtualAllocationCreateInfo

Parameters of created virtual allocation to be passed to virtualAllocate.

Constructors

VirtualAllocationCreateInfo 

Fields

Instances

Instances details
Show VirtualAllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable VirtualAllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero VirtualAllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct VirtualAllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct VirtualAllocationCreateInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

data VirtualAllocationInfo Source #

VmaVirtualAllocationInfo

Parameters of an existing virtual allocation, returned by getVirtualAllocationInfo.

Constructors

VirtualAllocationInfo 

Fields

  • size :: DeviceSize

    Size of the allocation.

    Same value as passed in VmaVirtualAllocationCreateInfo::size.

  • userData :: Ptr ()

    Custom pointer associated with the allocation.

    Same value as passed in VmaVirtualAllocationCreateInfo::pUserData or to setVirtualAllocationUserData.

Instances

Instances details
Show VirtualAllocationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Storable VirtualAllocationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

Zero VirtualAllocationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

ToCStruct VirtualAllocationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

FromCStruct VirtualAllocationInfo Source # 
Instance details

Defined in VulkanMemoryAllocator

newtype VirtualBlock Source #

VmaVirtualBlock

Handle to a virtual block object that allows to use core allocation algorithm without allocating any real GPU memory.

Fill in VirtualBlockCreateInfo structure and Use createVirtualBlock to create it. Use destroyVirtualBlock to destroy it. For more information, see documentation chapter Virtual allocator.

Constructors

VirtualBlock Word64