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

#include <DynamicBufferAllocator.h>

+ Inheritance diagram for FGlobalDynamicReadBuffer:

Classes

struct  FAllocation
 

Public Member Functions

RENDERCORE_API FGlobalDynamicReadBuffer ()
 
RENDERCORE_API ~FGlobalDynamicReadBuffer ()
 
RENDERCORE_API FAllocation AllocateHalf (uint32 Num)
 
RENDERCORE_API FAllocation AllocateFloat (uint32 Num)
 
RENDERCORE_API FAllocation AllocateInt32 (uint32 Num)
 
RENDERCORE_API FAllocation AllocateUInt32 (uint32 Num)
 
RENDERCORE_API void Commit (FRHICommandListImmediate &RHICmdList)
 
void Commit ()
 
RENDERCORE_API bool IsRenderAlarmLoggingEnabled () const
 
- Public Member Functions inherited from FRenderResource
RENDERCORE_API FRenderResource ()
 
RENDERCORE_API FRenderResource (ERHIFeatureLevel::Type InFeatureLevel)
 
RENDERCORE_API FRenderResource (const FRenderResource &)
 
RENDERCORE_API FRenderResource (FRenderResource &&)
 
RENDERCORE_API FRenderResourceoperator= (const FRenderResource &Other)
 
RENDERCORE_API FRenderResourceoperator= (FRenderResource &&Other)
 
virtual RENDERCORE_API ~FRenderResource ()
 
virtual RENDERCORE_API void InitResource (FRHICommandListBase &RHICmdList)
 
virtual RENDERCORE_API void ReleaseResource ()
 
RENDERCORE_API void UpdateRHI (FRHICommandListBase &RHICmdList)
 
virtual FString GetFriendlyName () const
 
bool IsInitialized () const
 
int32 GetListIndex () const
 
EInitPhase GetInitPhase () const
 
void SetOwnerName (FName InOwnerName)
 
FName GetOwnerName () const
 
void SetResourceName (FName InResourceName)
 
FName GetResourceName () const
 

Protected Member Functions

virtual RENDERCORE_API void InitRHI (FRHICommandListBase &RHICmdList) override
 
virtual RENDERCORE_API void ReleaseRHI () override
 
RENDERCORE_API void Cleanup ()
 
RENDERCORE_API void IncrementTotalAllocations (uint32 Num)
 
template<EPixelFormat Format, typename Type >
FAllocation AllocateInternal (FDynamicReadBufferPool *BufferPool, uint32 Num)
 
- Protected Member Functions inherited from FRenderResource
void SetFeatureLevel (const FStaticFeatureLevel InFeatureLevel)
 
const FStaticFeatureLevel GetFeatureLevel () const
 
bool HasValidFeatureLevel () const
 
template<typename T >
FBufferRHIRef CreateRHIBuffer (FRHICommandListBase &RHICmdList, T &InOutResourceObject, uint32 ResourceCount, EBufferUsageFlags InBufferUsageFlags, const TCHAR *InDebugName)
 
void SetInitPhase (EInitPhase InInitPhase)
 

Protected Attributes

UE::FMutex Mutex
 
FRHICommandListBaseRHICmdList = nullptr
 
FDynamicReadBufferPoolHalfBufferPool
 
FDynamicReadBufferPoolFloatBufferPool
 
FDynamicReadBufferPoolInt32BufferPool
 
FDynamicReadBufferPoolUInt32BufferPool
 
size_t TotalAllocatedSinceLastCommit
 

Additional Inherited Members

- Public Types inherited from FRenderResource
enum class  EInitPhase : uint8 { Pre , Default , MAX }
 
- Static Public Member Functions inherited from FRenderResource
static RENDERCORE_API void ReleaseRHIForAllResources ()
 
static RENDERCORE_API void InitPreRHIResources ()
 
static RENDERCORE_API void ChangeFeatureLevel (ERHIFeatureLevel::Type NewFeatureLevel)
 
static RENDERCORE_API FName SetScopeName (FName Name)
 
- Public Attributes inherited from FRenderResource
ERenderResourceState ResourceState = ERenderResourceState::Default
 
- Static Protected Member Functions inherited from FRenderResource
static RENDERCORE_API FRHICommandListBaseGetImmediateCommandList ()
 

Detailed Description

A system for dynamically allocating GPU memory for rendering. Note that this must derive from FRenderResource so that we can safely free the shader resource views for OpenGL and other platforms. If we wait until the module is shutdown, the renderer RHI will have already been destroyed and we can execute code on invalid data. By making ourself a render resource, we clean up immediately before the renderer dies.

Constructor & Destructor Documentation

◆ FGlobalDynamicReadBuffer()

FGlobalDynamicReadBuffer::FGlobalDynamicReadBuffer ( )

◆ ~FGlobalDynamicReadBuffer()

FGlobalDynamicReadBuffer::~FGlobalDynamicReadBuffer ( )

Member Function Documentation

◆ AllocateFloat()

FGlobalDynamicReadBuffer::FAllocation FGlobalDynamicReadBuffer::AllocateFloat ( uint32  Num)

◆ AllocateHalf()

FGlobalDynamicReadBuffer::FAllocation FGlobalDynamicReadBuffer::AllocateHalf ( uint32  Num)

◆ AllocateInt32()

FGlobalDynamicReadBuffer::FAllocation FGlobalDynamicReadBuffer::AllocateInt32 ( uint32  Num)

◆ AllocateInternal()

template<EPixelFormat Format, typename Type >
FGlobalDynamicReadBuffer::FAllocation FGlobalDynamicReadBuffer::AllocateInternal ( FDynamicReadBufferPool BufferPool,
uint32  Num 
)
protected

◆ AllocateUInt32()

FGlobalDynamicReadBuffer::FAllocation FGlobalDynamicReadBuffer::AllocateUInt32 ( uint32  Num)

◆ Cleanup()

void FGlobalDynamicReadBuffer::Cleanup ( )
protected

◆ Commit() [1/2]

void FGlobalDynamicReadBuffer::Commit ( )
inline

◆ Commit() [2/2]

void FGlobalDynamicReadBuffer::Commit ( FRHICommandListImmediate RHICmdList)

Commits allocated memory to the GPU. WARNING: Once this buffer has been committed to the GPU, allocations remain valid only until the next call to Allocate!

◆ IncrementTotalAllocations()

void FGlobalDynamicReadBuffer::IncrementTotalAllocations ( uint32  Num)
protected

◆ InitRHI()

void FGlobalDynamicReadBuffer::InitRHI ( FRHICommandListBase RHICmdList)
overrideprotectedvirtual

Initializes the RHI resources used by this resource. Called when entering the state where both the resource and the RHI have been initialized. This is only called by the rendering thread.

Reimplemented from FRenderResource.

◆ IsRenderAlarmLoggingEnabled()

bool FGlobalDynamicReadBuffer::IsRenderAlarmLoggingEnabled ( ) const

Returns true if log statements should be made because we exceeded GMaxVertexBytesAllocatedPerFrame

◆ ReleaseRHI()

void FGlobalDynamicReadBuffer::ReleaseRHI ( )
overrideprotectedvirtual

Releases the RHI resources used by this resource. Called when leaving the state where both the resource and the RHI have been initialized. This is only called by the rendering thread.

Reimplemented from FRenderResource.

Member Data Documentation

◆ FloatBufferPool

FDynamicReadBufferPool* FGlobalDynamicReadBuffer::FloatBufferPool
protected

◆ HalfBufferPool

FDynamicReadBufferPool* FGlobalDynamicReadBuffer::HalfBufferPool
protected

The pools of read buffers from which allocations are made.

◆ Int32BufferPool

FDynamicReadBufferPool* FGlobalDynamicReadBuffer::Int32BufferPool
protected

◆ Mutex

UE::FMutex FGlobalDynamicReadBuffer::Mutex
protected

◆ RHICmdList

FRHICommandListBase* FGlobalDynamicReadBuffer::RHICmdList = nullptr
protected

◆ TotalAllocatedSinceLastCommit

size_t FGlobalDynamicReadBuffer::TotalAllocatedSinceLastCommit
protected

A total of all allocations made since the last commit. Used to alert about spikes in memory usage.

◆ UInt32BufferPool

FDynamicReadBufferPool* FGlobalDynamicReadBuffer::UInt32BufferPool
protected

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