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

#include <VulkanMemory.h>

Classes

struct  FUBPendingFree
 

Public Member Functions

 FMemoryManager (FVulkanDevice &InDevice)
 
 ~FMemoryManager ()
 
void Init ()
 
void Deinit ()
 
FVulkanDeviceGetDevice ()
 
void FreeVulkanAllocation (FVulkanAllocation &Allocation, EVulkanFreeFlags FreeFlags=EVulkanFreeFlag_None)
 
void FreeVulkanAllocationPooledBuffer (FVulkanAllocation &Allocation)
 
void FreeVulkanAllocationBuffer (FVulkanAllocation &Allocation)
 
void FreeVulkanAllocationImage (FVulkanAllocation &Allocation)
 
void FreeVulkanAllocationImageDedicated (FVulkanAllocation &Allocation)
 
bool AllocateBufferPooled (FVulkanAllocation &Allocation, FVulkanEvictable *AllocationOwner, uint32 Size, uint32 MinAlignment, VkBufferUsageFlags BufferUsageFlags, VkMemoryPropertyFlags MemoryPropertyFlags, EVulkanAllocationMetaType MetaType, const char *File, uint32 Line)
 
bool AllocateImageMemory (FVulkanAllocation &Allocation, FVulkanEvictable *AllocationOwner, const VkMemoryRequirements &MemoryReqs, VkMemoryPropertyFlags MemoryPropertyFlags, EVulkanAllocationMetaType MetaType, bool bExternal, const char *File, uint32 Line)
 
bool AllocateDedicatedImageMemory (FVulkanAllocation &Allocation, FVulkanEvictable *AllocationOwner, VkImage Image, const VkMemoryRequirements &MemoryReqs, VkMemoryPropertyFlags MemoryPropertyFlags, EVulkanAllocationMetaType MetaType, bool bExternal, const char *File, uint32 Line)
 
bool AllocateBufferMemory (FVulkanAllocation &OutAllocation, VkBuffer InBuffer, EVulkanAllocationFlags InAllocFlags, const TCHAR *InDebugName, uint32 InForceMinAlignment=1)
 
void RegisterSubresourceAllocator (FVulkanSubresourceAllocator *SubresourceAllocator)
 
void UnregisterSubresourceAllocator (FVulkanSubresourceAllocator *SubresourceAllocator)
 
bool ReleaseSubresourceAllocator (FVulkanSubresourceAllocator *SubresourceAllocator)
 
void ReleaseFreedPages (const FVulkanContextArray &Contexts)
 
void DumpMemory (bool bFullDump=true)
 
void AllocUniformBuffer (FVulkanAllocation &OutAllocation, uint32 Size)
 
void FreeUniformBuffer (FVulkanAllocation &InAllocation)
 
void HandleOOM (bool bCanResume=false, VkResult Result=VK_SUCCESS, uint64 AllocationSize=0, uint32 MemoryTypeIndex=0)
 
bool UpdateEvictThreshold (bool bLog)
 

Static Public Member Functions

static uint32 CalculateBufferAlignment (FVulkanDevice &InDevice, EBufferUsageFlags InUEUsage, bool bZeroSize)
 
static float CalculateBufferPriority (const VkBufferUsageFlags BufferUsageFlags)
 

Protected Types

enum  { BufferAllocationSize = 1 * 1024 * 1024 , UniformBufferAllocationSize = 2 * 1024 * 1024 }
 
enum class  EPoolSizes : uint8 {
  E128 , E256 , E512 , E1k ,
  E2k , E8k , E16k , SizesCount
}
 

Protected Member Functions

EPoolSizes GetPoolTypeForAlloc (uint32 Size, uint32 Alignment)
 
FVulkanSubresourceAllocatorGetSubresourceAllocator (const uint32 AllocatorIndex)
 
void ReleaseFreedResources (bool bImmediately)
 
void DestroyResourceAllocations ()
 
void ProcessPendingUBFreesNoLock (bool bForce)
 
void ProcessPendingUBFrees (bool bForce)
 

Protected Attributes

FVulkanDeviceDevice
 
FDeviceMemoryManagerDeviceMemoryManager
 
TArray< FVulkanResourceHeap * > ResourceTypeHeaps
 
FCriticalSection UsedFreeBufferAllocationsLock
 
TArray< FVulkanSubresourceAllocator * > UsedBufferAllocations [(int32) EPoolSizes::SizesCount+1]
 
TArray< FVulkanSubresourceAllocator * > FreeBufferAllocations [(int32) EPoolSizes::SizesCount+1]
 
FRWLock AllBufferAllocationsLock
 
TArray< FVulkanSubresourceAllocator * > AllBufferAllocations
 
PTRINT AllBufferAllocationsFreeListHead = (PTRINT)-1
 
uint64 PendingEvictBytes = 0
 
bool bIsEvicting = false
 
bool bWantEviction = false
 
struct { 
 
   FCriticalSection   CS 
 
   TArray< FUBPendingFree >   PendingFree 
 
   uint32   Peak = 0 
 
UBAllocations 
 

Static Protected Attributes

static constexpr uint32 PoolSizes [(int32) EPoolSizes::SizesCount]
 
static constexpr uint32 BufferSizes [(int32) EPoolSizes::SizesCount+1]
 

Friends

class FVulkanAllocation
 
class FVulkanResourceHeap
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
BufferAllocationSize 
UniformBufferAllocationSize 

◆ EPoolSizes

Enumerator
E128 
E256 
E512 
E1k 
E2k 
E8k 
E16k 
SizesCount 

Constructor & Destructor Documentation

◆ FMemoryManager()

VulkanRHI::FMemoryManager::FMemoryManager ( FVulkanDevice InDevice)

◆ ~FMemoryManager()

VulkanRHI::FMemoryManager::~FMemoryManager ( )

Member Function Documentation

◆ AllocateBufferMemory()

bool VulkanRHI::FMemoryManager::AllocateBufferMemory ( FVulkanAllocation OutAllocation,
VkBuffer  InBuffer,
EVulkanAllocationFlags  InAllocFlags,
const TCHAR InDebugName,
uint32  InForceMinAlignment = 1 
)

◆ AllocateBufferPooled()

bool VulkanRHI::FMemoryManager::AllocateBufferPooled ( FVulkanAllocation Allocation,
FVulkanEvictable AllocationOwner,
uint32  Size,
uint32  MinAlignment,
VkBufferUsageFlags  BufferUsageFlags,
VkMemoryPropertyFlags  MemoryPropertyFlags,
EVulkanAllocationMetaType  MetaType,
const char File,
uint32  Line 
)

◆ AllocateDedicatedImageMemory()

bool VulkanRHI::FMemoryManager::AllocateDedicatedImageMemory ( FVulkanAllocation Allocation,
FVulkanEvictable AllocationOwner,
VkImage  Image,
const VkMemoryRequirements MemoryReqs,
VkMemoryPropertyFlags  MemoryPropertyFlags,
EVulkanAllocationMetaType  MetaType,
bool  bExternal,
const char File,
uint32  Line 
)

◆ AllocateImageMemory()

bool VulkanRHI::FMemoryManager::AllocateImageMemory ( FVulkanAllocation Allocation,
FVulkanEvictable AllocationOwner,
const VkMemoryRequirements MemoryReqs,
VkMemoryPropertyFlags  MemoryPropertyFlags,
EVulkanAllocationMetaType  MetaType,
bool  bExternal,
const char File,
uint32  Line 
)

◆ AllocUniformBuffer()

void VulkanRHI::FMemoryManager::AllocUniformBuffer ( FVulkanAllocation OutAllocation,
uint32  Size 
)

◆ CalculateBufferAlignment()

uint32 VulkanRHI::FMemoryManager::CalculateBufferAlignment ( FVulkanDevice InDevice,
EBufferUsageFlags  InUEUsage,
bool  bZeroSize 
)
static

◆ CalculateBufferPriority()

float VulkanRHI::FMemoryManager::CalculateBufferPriority ( const VkBufferUsageFlags  BufferUsageFlags)
static

◆ Deinit()

void VulkanRHI::FMemoryManager::Deinit ( )

◆ DestroyResourceAllocations()

void VulkanRHI::FMemoryManager::DestroyResourceAllocations ( )
protected

◆ DumpMemory()

void VulkanRHI::FMemoryManager::DumpMemory ( bool  bFullDump = true)

◆ FreeUniformBuffer()

void VulkanRHI::FMemoryManager::FreeUniformBuffer ( FVulkanAllocation InAllocation)

◆ FreeVulkanAllocation()

void VulkanRHI::FMemoryManager::FreeVulkanAllocation ( FVulkanAllocation Allocation,
EVulkanFreeFlags  FreeFlags = EVulkanFreeFlag_None 
)

◆ FreeVulkanAllocationBuffer()

void VulkanRHI::FMemoryManager::FreeVulkanAllocationBuffer ( FVulkanAllocation Allocation)

◆ FreeVulkanAllocationImage()

void VulkanRHI::FMemoryManager::FreeVulkanAllocationImage ( FVulkanAllocation Allocation)

◆ FreeVulkanAllocationImageDedicated()

void VulkanRHI::FMemoryManager::FreeVulkanAllocationImageDedicated ( FVulkanAllocation Allocation)

◆ FreeVulkanAllocationPooledBuffer()

void VulkanRHI::FMemoryManager::FreeVulkanAllocationPooledBuffer ( FVulkanAllocation Allocation)

◆ GetDevice()

FVulkanDevice & VulkanRHI::FMemoryManager::GetDevice ( )
inline

◆ GetPoolTypeForAlloc()

EPoolSizes VulkanRHI::FMemoryManager::GetPoolTypeForAlloc ( uint32  Size,
uint32  Alignment 
)
inlineprotected

◆ GetSubresourceAllocator()

FVulkanSubresourceAllocator * VulkanRHI::FMemoryManager::GetSubresourceAllocator ( const uint32  AllocatorIndex)
inlineprotected

◆ HandleOOM()

void VulkanRHI::FMemoryManager::HandleOOM ( bool  bCanResume = false,
VkResult  Result = VK_SUCCESS,
uint64  AllocationSize = 0,
uint32  MemoryTypeIndex = 0 
)

◆ Init()

void VulkanRHI::FMemoryManager::Init ( )

◆ ProcessPendingUBFrees()

void VulkanRHI::FMemoryManager::ProcessPendingUBFrees ( bool  bForce)
protected

◆ ProcessPendingUBFreesNoLock()

void VulkanRHI::FMemoryManager::ProcessPendingUBFreesNoLock ( bool  bForce)
protected

◆ RegisterSubresourceAllocator()

void VulkanRHI::FMemoryManager::RegisterSubresourceAllocator ( FVulkanSubresourceAllocator SubresourceAllocator)

◆ ReleaseFreedPages()

void VulkanRHI::FMemoryManager::ReleaseFreedPages ( const FVulkanContextArray Contexts)

◆ ReleaseFreedResources()

void VulkanRHI::FMemoryManager::ReleaseFreedResources ( bool  bImmediately)
protected

◆ ReleaseSubresourceAllocator()

bool VulkanRHI::FMemoryManager::ReleaseSubresourceAllocator ( FVulkanSubresourceAllocator SubresourceAllocator)

◆ UnregisterSubresourceAllocator()

void VulkanRHI::FMemoryManager::UnregisterSubresourceAllocator ( FVulkanSubresourceAllocator SubresourceAllocator)

◆ UpdateEvictThreshold()

bool VulkanRHI::FMemoryManager::UpdateEvictThreshold ( bool  bLog)

Friends And Related Symbol Documentation

◆ FVulkanAllocation

friend class FVulkanAllocation
friend

◆ FVulkanResourceHeap

Member Data Documentation

◆ AllBufferAllocations

TArray<FVulkanSubresourceAllocator*> VulkanRHI::FMemoryManager::AllBufferAllocations
protected

◆ AllBufferAllocationsFreeListHead

PTRINT VulkanRHI::FMemoryManager::AllBufferAllocationsFreeListHead = (PTRINT)-1
protected

◆ AllBufferAllocationsLock

FRWLock VulkanRHI::FMemoryManager::AllBufferAllocationsLock
protected

◆ bIsEvicting

bool VulkanRHI::FMemoryManager::bIsEvicting = false
protected

◆ BufferSizes

constexpr uint32 VulkanRHI::FMemoryManager::BufferSizes
staticconstexprprotected
Initial value:
=
{
128 * 1024,
128 * 1024,
256 * 1024,
256 * 1024,
512 * 1024,
512 * 1024,
1024 * 1024,
1 * 1024 * 1024,
}

◆ bWantEviction

bool VulkanRHI::FMemoryManager::bWantEviction = false
protected

◆ CS

FCriticalSection VulkanRHI::FMemoryManager::CS

◆ Device

FVulkanDevice& VulkanRHI::FMemoryManager::Device
protected

◆ DeviceMemoryManager

FDeviceMemoryManager* VulkanRHI::FMemoryManager::DeviceMemoryManager
protected

◆ FreeBufferAllocations

TArray<FVulkanSubresourceAllocator*> VulkanRHI::FMemoryManager::FreeBufferAllocations[(int32) EPoolSizes::SizesCount+1]
protected

◆ Peak

uint32 VulkanRHI::FMemoryManager::Peak = 0

◆ PendingEvictBytes

uint64 VulkanRHI::FMemoryManager::PendingEvictBytes = 0
protected

◆ PendingFree

TArray<FUBPendingFree> VulkanRHI::FMemoryManager::PendingFree

◆ PoolSizes

constexpr uint32 VulkanRHI::FMemoryManager::PoolSizes
staticconstexprprotected
Initial value:
=
{
128,
256,
512,
1024,
2048,
8192,
}

◆ ResourceTypeHeaps

TArray<FVulkanResourceHeap*> VulkanRHI::FMemoryManager::ResourceTypeHeaps
protected

◆ [struct]

struct { ... } VulkanRHI::FMemoryManager::UBAllocations

◆ UsedBufferAllocations

TArray<FVulkanSubresourceAllocator*> VulkanRHI::FMemoryManager::UsedBufferAllocations[(int32) EPoolSizes::SizesCount+1]
protected

◆ UsedFreeBufferAllocationsLock

FCriticalSection VulkanRHI::FMemoryManager::UsedFreeBufferAllocationsLock
protected

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