Record Class VmaDefragmentationPassMoveInfo

java.lang.Object
java.lang.Record
club.doki7.vma.datatype.VmaDefragmentationPassMoveInfo
All Implemented Interfaces:
IPointer, IVmaDefragmentationPassMoveInfo

@ValueBasedCandidate @UnsafeConstructor public record VmaDefragmentationPassMoveInfo(@NotNull MemorySegment segment) extends Record implements IVmaDefragmentationPassMoveInfo

Parameters for incremental defragmentation steps.

To be used with function vmaBeginDefragmentationPass().

Structure

typedef struct VmaDefragmentationPassMoveInfo {
    uint32_t moveCount;
    VmaDefragmentationMove* pMoves; // optional
} VmaDefragmentationPassMoveInfo;

Contracts

The property segment() should always be not-null (segment != NULL && !segment.equals(MemorySegment.NULL)), and properly aligned to LAYOUT.byteAlignment() bytes. To represent null pointer, you may use a Java null instead. See the documentation of IPointer.segment() for more details.

The constructor of this class is marked as UnsafeConstructor, because it does not perform any runtime check. The constructor can be useful for automatic code generators.

Member documentation

  • moveCount() Number of elements in the `pMoves` array.
  • pMoves(club.doki7.vma.datatype.IVmaDefragmentationMove) 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.