Vulkan Memory Allocator: VmaDefragmentationPassMoveInfo Struct Reference

Vulkan Memory Allocator

Loading...
Searching...
No Matches
Public Attributes | List of all members
VmaDefragmentationPassMoveInfo Struct Reference
Memory allocation

Parameters for incremental defragmentation steps. More...

`#include <vk_mem_alloc.h>`

## Public Attributes
uint32_t | moveCount
| Number of elements in the `pMoves` array.
VmaDefragmentationMove * | pMoves
| Array of moves to be performed by the user in the current defragmentation pass.

## Detailed Description

Parameters for incremental defragmentation steps.

To be used with function vmaBeginDefragmentationPass().

## Member Data Documentation

## ◆ moveCount

uint32_t VmaDefragmentationPassMoveInfo::moveCount

Number of elements in the `pMoves` array.

## ◆ pMoves

VmaDefragmentationMove* VmaDefragmentationPassMoveInfo::pMoves

Array of moves to be performed by the user in the current defragmentation pass.

Pointer to an array of `moveCount` elements, owned by VMA, created in vmaBeginDefragmentationPass(), destroyed in vmaEndDefragmentationPass().

For each element, you should:

1. Create a new buffer/image in the place pointed by VmaDefragmentationMove::dstMemory + VmaDefragmentationMove::dstOffset.
2. Copy data from the VmaDefragmentationMove::srcAllocation e.g. using `vkCmdCopyBuffer`, `vkCmdCopyImage`.
3. Make sure these commands finished executing on the GPU.
4. Destroy the old buffer/image.

Only then you can finish defragmentation pass by calling vmaEndDefragmentationPass(). After this call, the allocation will point to the new place in memory.

Alternatively, if you cannot move specific allocation, you can set VmaDefragmentationMove::operation to VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE.

Alternatively, if you decide you want to completely remove the allocation:

1. Destroy its buffer/image.
2. Set VmaDefragmentationMove::operation to VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY.

Then, after vmaEndDefragmentationPass() the allocation will be freed.

The documentation for this struct was generated from the following file:

- D:/PROJECTS/Vulkan Memory Allocator/REPO/include/vk_mem_alloc.h