UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FD3D12PoolAllocator Class Reference

D3D12 specific implementation of the FRHIPoolAllocator. More...

#include <D3D12PoolAllocator.h>

+ Inheritance diagram for FD3D12PoolAllocator:

Classes

struct  FrameFencedAllocationData
 

Public Member Functions

 FD3D12PoolAllocator (FD3D12Device *ParentDevice, FRHIGPUMask VisibleNodes, const FD3D12ResourceInitConfig &InInitConfig, const FString &InName, EResourceAllocationStrategy InAllocationStrategy, uint64 InDefaultPoolSize, uint32 InPoolAlignment, uint32 InMaxAllocationSize, FRHIMemoryPool::EFreeListOrder InFreeListOrder, bool bInDefragEnabled, HeapId InTraceParentHeapId)
 
 ~FD3D12PoolAllocator ()
 
bool SupportsAllocation (D3D12_HEAP_TYPE InHeapType, D3D12_RESOURCE_FLAGS InResourceFlags, EBufferUsageFlags InBufferUsage, ED3D12ResourceStateMode InResourceStateMode, uint32 Alignment) const
 
void AllocDefaultResource (D3D12_HEAP_TYPE InHeapType, const FD3D12ResourceDesc &InDesc, EBufferUsageFlags InBufferUsage, ED3D12ResourceStateMode InResourceStateMode, ED3D12Access InCreateD3D12Access, uint32 InAlignment, const TCHAR *InName, FD3D12ResourceLocation &ResourceLocation)
 
virtual void DeallocateResource (FD3D12ResourceLocation &ResourceLocation, bool bDefragFree=false)
 
virtual void AllocateResource (uint32 GPUIndex, D3D12_HEAP_TYPE InHeapType, const FD3D12ResourceDesc &InDesc, uint64 InSize, uint32 InAllocationAlignment, ED3D12Access InInitialD3D12Access, ED3D12ResourceStateMode InResourceStateMode, ED3D12Access InDefaultD3D12Access, const D3D12_CLEAR_VALUE *InClearValue, const TCHAR *InName, FD3D12ResourceLocation &ResourceLocation) override
 
void CleanUpAllocations (uint64 InFrameLag, bool bForceFree=false)
 
void FlushPendingCopyOps (FD3D12CommandContext &InCommandContext)
 
void TransferOwnership (FD3D12ResourceLocation &InSource, FD3D12ResourceLocation &InDest)
 
bool IsOwner (FD3D12ResourceLocation &ResourceLocation) const
 
EResourceAllocationStrategy GetAllocationStrategy () const
 
FD3D12ResourceGetBackingResource (FD3D12ResourceLocation &InResourceLocation) const
 
FD3D12HeapAndOffset GetBackingHeapAndAllocationOffsetInBytes (FD3D12ResourceLocation &InResourceLocation) const
 
FD3D12HeapAndOffset GetBackingHeapAndAllocationOffsetInBytes (const FRHIPoolAllocationData &InAllocationData) const
 
uint64 GetPendingDeleteRequestSize () const
 
- Public Member Functions inherited from FRHIPoolAllocator
RHICORE_API FRHIPoolAllocator (uint64 InDefaultPoolSize, uint32 InPoolAlignment, uint32 InMaxAllocationSize, FRHIMemoryPool::EFreeListOrder InFreeListOrder, bool InDefragEnabled)
 
virtual RHICORE_API ~FRHIPoolAllocator ()
 
RHICORE_API void Initialize ()
 
RHICORE_API void Destroy ()
 
RHICORE_API void Defrag (FRHIContextArray const &Contexts, uint32 InMaxCopySize, uint32 &CurrentCopySize)
 
RHICORE_API void UpdateMemoryStats (uint32 &IOMemoryAllocated, uint32 &IOMemoryUsed, uint32 &IOMemoryFree, uint32 &IOMemoryEndFree, uint32 &IOAlignmentWaste, uint32 &IOAllocatedPageCount, uint32 &IOFullPageCount)
 
- Public Member Functions inherited from FD3D12DeviceChild
 FD3D12DeviceChild (FD3D12Device *InParent=nullptr)
 
FORCEINLINE FD3D12DeviceGetParentDevice () const
 
FD3D12DeviceGetParentDevice_Unsafe () const
 
- Public Member Functions inherited from FD3D12MultiNodeGPUObject
 FD3D12MultiNodeGPUObject (FRHIGPUMask NodeMask, FRHIGPUMask VisibiltyMask)
 
- Public Member Functions inherited from FD3D12GPUObject
 FD3D12GPUObject (FRHIGPUMask InGPUMask, FRHIGPUMask InVisibiltyMask)
 
SGPU_CONSTEXPR FRHIGPUMask GetGPUMask () const
 
SGPU_CONSTEXPR FRHIGPUMask GetVisibilityMask () const
 
- Public Member Functions inherited from ID3D12ResourceAllocator
void AllocateTexture (uint32 GPUIndex, D3D12_HEAP_TYPE InHeapType, const FD3D12ResourceDesc &InDesc, EPixelFormat InUEFormat, ED3D12Access InInitialD3D12Access, ED3D12ResourceStateMode InResourceStateMode, ED3D12Access InDefaultD3D12Access, const D3D12_CLEAR_VALUE *InClearValue, const TCHAR *InName, FD3D12ResourceLocation &ResourceLocation)
 

Static Public Member Functions

static FD3D12ResourceInitConfig GetResourceAllocatorInitConfig (D3D12_HEAP_TYPE InHeapType, D3D12_RESOURCE_FLAGS InResourceFlags, EBufferUsageFlags InBufferUsage)
 
static EResourceAllocationStrategy GetResourceAllocationStrategy (D3D12_RESOURCE_FLAGS InResourceFlags, ED3D12ResourceStateMode InResourceStateMode, uint32 Alignment)
 

Protected Types

enum class  EAllocationType { Allocate , DefragFree , Free }
 

Protected Member Functions

virtual FRHIMemoryPoolCreateNewPool (int16 InPoolIndex, uint32 InMinimumAllocationSize, ERHIPoolResourceTypes InAllocationResourceType) override
 
virtual bool HandleDefragRequest (FRHIContextArray const &Contexts, FRHIPoolAllocationData *InSourceBlock, FRHIPoolAllocationData &InTmpTargetBlock) override
 
virtual FD3D12ResourceCreatePlacedResource (const FRHIPoolAllocationData &InAllocationData, const FD3D12ResourceDesc &InDesc, ED3D12Access InInitialD3D12Access, ED3D12ResourceStateMode InResourceStateMode, ED3D12Access InDefaultD3D12Access, const D3D12_CLEAR_VALUE *InClearValue, const TCHAR *InName)
 
virtual void UpdateAllocationTracking (FD3D12ResourceLocation &InAllocation, EAllocationType InAllocationType)
 
- Protected Member Functions inherited from FRHIPoolAllocator
RHICORE_API bool TryAllocateInternal (uint32 InSizeInBytes, uint32 InAllocationAlignment, ERHIPoolResourceTypes InAllocationResourceType, FRHIPoolAllocationData &AllocationData)
 
RHICORE_API void DeallocateInternal (FRHIPoolAllocationData &AllocationData)
 
RHICORE_API void SortPools ()
 

Protected Attributes

const FD3D12ResourceInitConfig InitConfig
 
const FString Name
 
EResourceAllocationStrategy AllocationStrategy
 
TArray< FrameFencedAllocationDataFrameFencedOperations
 
uint64 PendingDeleteRequestSize = 0
 
TArray< FD3D12VRAMCopyOperationPendingCopyOps
 
TArray< FRHIPoolAllocationData * > AllocationDataPool
 
- Protected Attributes inherited from FRHIPoolAllocator
const uint64 DefaultPoolSize
 
const uint32 PoolAlignment
 
const uint64 MaxAllocationSize
 
const FRHIMemoryPool::EFreeListOrder FreeListOrder
 
const bool bDefragEnabled
 
FCriticalSection CS
 
TArray< FRHIMemoryPool * > Pools
 
int32 LastDefragPoolIndex
 
TArray< uint32PoolAllocationOrder
 
uint32 TotalAllocatedBlocks
 
- Protected Attributes inherited from FD3D12DeviceChild
FD3D12DeviceParent
 

Detailed Description

D3D12 specific implementation of the FRHIPoolAllocator.

Member Enumeration Documentation

◆ EAllocationType

Enumerator
Allocate 
DefragFree 
Free 

Constructor & Destructor Documentation

◆ FD3D12PoolAllocator()

FD3D12PoolAllocator::FD3D12PoolAllocator ( FD3D12Device ParentDevice,
FRHIGPUMask  VisibleNodes,
const FD3D12ResourceInitConfig InInitConfig,
const FString &  InName,
EResourceAllocationStrategy  InAllocationStrategy,
uint64  InDefaultPoolSize,
uint32  InPoolAlignment,
uint32  InMaxAllocationSize,
FRHIMemoryPool::EFreeListOrder  InFreeListOrder,
bool  bInDefragEnabled,
HeapId  InTraceParentHeapId 
)

◆ ~FD3D12PoolAllocator()

FD3D12PoolAllocator::~FD3D12PoolAllocator ( )

Member Function Documentation

◆ AllocateResource()

void FD3D12PoolAllocator::AllocateResource ( uint32  GPUIndex,
D3D12_HEAP_TYPE  InHeapType,
const FD3D12ResourceDesc InDesc,
uint64  InSize,
uint32  InAllocationAlignment,
ED3D12Access  InInitialD3D12Access,
ED3D12ResourceStateMode  InResourceStateMode,
ED3D12Access  InDefaultD3D12Access,
const D3D12_CLEAR_VALUE InClearValue,
const TCHAR InName,
FD3D12ResourceLocation ResourceLocation 
)
overridevirtual

◆ AllocDefaultResource()

void FD3D12PoolAllocator::AllocDefaultResource ( D3D12_HEAP_TYPE  InHeapType,
const FD3D12ResourceDesc InDesc,
EBufferUsageFlags  InBufferUsage,
ED3D12ResourceStateMode  InResourceStateMode,
ED3D12Access  InCreateD3D12Access,
uint32  InAlignment,
const TCHAR InName,
FD3D12ResourceLocation ResourceLocation 
)

◆ CleanUpAllocations()

void FD3D12PoolAllocator::CleanUpAllocations ( uint64  InFrameLag,
bool  bForceFree = false 
)

◆ CreateNewPool()

FRHIMemoryPool * FD3D12PoolAllocator::CreateNewPool ( int16  InPoolIndex,
uint32  InMinimumAllocationSize,
ERHIPoolResourceTypes  InAllocationResourceType 
)
overrideprotectedvirtual

Implements FRHIPoolAllocator.

◆ CreatePlacedResource()

FD3D12Resource * FD3D12PoolAllocator::CreatePlacedResource ( const FRHIPoolAllocationData InAllocationData,
const FD3D12ResourceDesc InDesc,
ED3D12Access  InInitialD3D12Access,
ED3D12ResourceStateMode  InResourceStateMode,
ED3D12Access  InDefaultD3D12Access,
const D3D12_CLEAR_VALUE InClearValue,
const TCHAR InName 
)
protectedvirtual

◆ DeallocateResource()

void FD3D12PoolAllocator::DeallocateResource ( FD3D12ResourceLocation ResourceLocation,
bool  bDefragFree = false 
)
virtual

◆ FlushPendingCopyOps()

void FD3D12PoolAllocator::FlushPendingCopyOps ( FD3D12CommandContext InCommandContext)

◆ GetAllocationStrategy()

EResourceAllocationStrategy FD3D12PoolAllocator::GetAllocationStrategy ( ) const
inline

◆ GetBackingHeapAndAllocationOffsetInBytes() [1/2]

FD3D12HeapAndOffset FD3D12PoolAllocator::GetBackingHeapAndAllocationOffsetInBytes ( const FRHIPoolAllocationData InAllocationData) const

◆ GetBackingHeapAndAllocationOffsetInBytes() [2/2]

FD3D12HeapAndOffset FD3D12PoolAllocator::GetBackingHeapAndAllocationOffsetInBytes ( FD3D12ResourceLocation InResourceLocation) const

◆ GetBackingResource()

FD3D12Resource * FD3D12PoolAllocator::GetBackingResource ( FD3D12ResourceLocation InResourceLocation) const

◆ GetPendingDeleteRequestSize()

uint64 FD3D12PoolAllocator::GetPendingDeleteRequestSize ( ) const
inline

◆ GetResourceAllocationStrategy()

EResourceAllocationStrategy FD3D12PoolAllocator::GetResourceAllocationStrategy ( D3D12_RESOURCE_FLAGS  InResourceFlags,
ED3D12ResourceStateMode  InResourceStateMode,
uint32  Alignment 
)
static

◆ GetResourceAllocatorInitConfig()

FD3D12ResourceInitConfig FD3D12PoolAllocator::GetResourceAllocatorInitConfig ( D3D12_HEAP_TYPE  InHeapType,
D3D12_RESOURCE_FLAGS  InResourceFlags,
EBufferUsageFlags  InBufferUsage 
)
static

◆ HandleDefragRequest()

bool FD3D12PoolAllocator::HandleDefragRequest ( FRHIContextArray const &  Contexts,
FRHIPoolAllocationData InSourceBlock,
FRHIPoolAllocationData InTmpTargetBlock 
)
overrideprotectedvirtual

Implements FRHIPoolAllocator.

◆ IsOwner()

bool FD3D12PoolAllocator::IsOwner ( FD3D12ResourceLocation ResourceLocation) const
inline

◆ SupportsAllocation()

bool FD3D12PoolAllocator::SupportsAllocation ( D3D12_HEAP_TYPE  InHeapType,
D3D12_RESOURCE_FLAGS  InResourceFlags,
EBufferUsageFlags  InBufferUsage,
ED3D12ResourceStateMode  InResourceStateMode,
uint32  Alignment 
) const

◆ TransferOwnership()

void FD3D12PoolAllocator::TransferOwnership ( FD3D12ResourceLocation InSource,
FD3D12ResourceLocation InDest 
)

◆ UpdateAllocationTracking()

void FD3D12PoolAllocator::UpdateAllocationTracking ( FD3D12ResourceLocation InAllocation,
EAllocationType  InAllocationType 
)
protectedvirtual

Member Data Documentation

◆ AllocationDataPool

TArray<FRHIPoolAllocationData*> FD3D12PoolAllocator::AllocationDataPool
protected

◆ AllocationStrategy

EResourceAllocationStrategy FD3D12PoolAllocator::AllocationStrategy
protected

◆ FrameFencedOperations

TArray<FrameFencedAllocationData> FD3D12PoolAllocator::FrameFencedOperations
protected

◆ InitConfig

const FD3D12ResourceInitConfig FD3D12PoolAllocator::InitConfig
protected

◆ Name

const FString FD3D12PoolAllocator::Name
protected

◆ PendingCopyOps

TArray<FD3D12VRAMCopyOperation> FD3D12PoolAllocator::PendingCopyOps
protected

◆ PendingDeleteRequestSize

uint64 FD3D12PoolAllocator::PendingDeleteRequestSize = 0
protected

The documentation for this class was generated from the following files: