Direct3D 12 Memory Allocator
Loading...
Searching...
No Matches
Public Attributes | List of all members
D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO Struct Reference

Parameters for incremental defragmentation steps. More...

#include <D3D12MemAlloc.h>

Public Attributes

UINT32 MoveCount
 Number of elements in the pMoves array.
 
DEFRAGMENTATION_MOVEpMoves
 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 DefragmentationContext::BeginPass().

Member Data Documentation

◆ MoveCount

UINT32 D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO::MoveCount

Number of elements in the pMoves array.

◆ pMoves

DEFRAGMENTATION_MOVE* D3D12MA::DEFRAGMENTATION_PASS_MOVE_INFO::pMoves

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

Pointer to an array of MoveCount elements, owned by D3D12MA, created in DefragmentationContext::BeginPass(), destroyed in DefragmentationContext::EndPass().

For each element, you should:

  1. Create a new resource in the place pointed by pMoves[i].pDstTmpAllocation->GetHeap() + pMoves[i].pDstTmpAllocation->GetOffset().
  2. Store new resource in pMoves[i].pDstTmpAllocation by using Allocation::SetResource(). It will later replace old resource from pMoves[i].pSrcAllocation.
  3. Copy data from the pMoves[i].pSrcAllocation e.g. using D3D12GraphicsCommandList::CopyResource.
  4. Make sure these commands finished executing on the GPU.

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

Alternatively, if you cannot move specific allocation, you can set DEFRAGMENTATION_MOVE::Operation to D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_IGNORE.

Alternatively, if you decide you want to completely remove the allocation, set DEFRAGMENTATION_MOVE::Operation to D3D12MA::DEFRAGMENTATION_MOVE_OPERATION_DESTROY. Then, after DefragmentationContext::EndPass() the allocation will be released.


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