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

#include <GPUDefragAllocator.h>

Public Member Functions

 FMemoryChunk (uint8 *InBase, int64 InSize, FGPUDefragAllocator &InBestFitAllocator, FMemoryChunk *&ChunkToInsertAfter, TStatId InStat)
 
 ~FMemoryChunk ()
 
bool IsLocked () const
 
void Link (FMemoryChunk *&ChunkToInsertAfter)
 
void LinkFree (FMemoryChunk *FirstFreeChunkToSearch)
 
void Unlink ()
 
void UnlinkFree ()
 
bool IsRelocating () const
 
int64 GetAvailableSize () const
 
int64 GetFinalSize () const
 
void SetSyncIndex (uint32 InSyncIndex, int64 InSyncSize)
 
uint32 GetSyncIndex () const
 

Static Public Member Functions

static uint64 Compare (const FMemoryChunk *A, const FMemoryChunk *B)
 

Public Attributes

uint8Base
 
int64 Size
 
int64 OrigSize
 
bool bIsAvailable
 
int32 LockCount
 
uint16 DefragCounter
 
FGPUDefragAllocatorBestFitAllocator
 
FMemoryChunkPreviousChunk
 
FMemoryChunkNextChunk
 
FMemoryChunkPreviousFreeChunk
 
FMemoryChunkNextFreeChunk
 
uint32 SyncIndex
 
int64 SyncSize
 
voidUserPayload
 
TStatId Stat
 
bool bTail
 

Detailed Description

Contains information of a single allocation or free block.

Constructor & Destructor Documentation

◆ FMemoryChunk()

FGPUDefragAllocator::FMemoryChunk::FMemoryChunk ( uint8 InBase,
int64  InSize,
FGPUDefragAllocator InBestFitAllocator,
FMemoryChunk *&  ChunkToInsertAfter,
TStatId  InStat 
)
inline

Private constructor.

Parameters
InBasePointer to base of chunk
InSizeSize of chunk
ChunkToInsertAfterChunk to insert this after.
FirstFreeChunkReference to first free chunk Pointer.

◆ ~FMemoryChunk()

FGPUDefragAllocator::FMemoryChunk::~FMemoryChunk ( )
inline

Unlinks/ removes the chunk from the linked lists it belongs to.

Member Function Documentation

◆ Compare()

static uint64 FGPUDefragAllocator::FMemoryChunk::Compare ( const FMemoryChunk A,
const FMemoryChunk B 
)
inlinestatic

Comparison function for Sort(), etc, based on increasing base address.

◆ GetAvailableSize()

int64 FGPUDefragAllocator::FMemoryChunk::GetAvailableSize ( ) const
inline

Returns the number of uint8s that can be allocated from this chunk.

◆ GetFinalSize()

int64 FGPUDefragAllocator::FMemoryChunk::GetFinalSize ( ) const
inline

Returns the current size (in uint8s), or the final size if it has a reallocating request.

◆ GetSyncIndex()

uint32 FGPUDefragAllocator::FMemoryChunk::GetSyncIndex ( ) const
inline

Returns the relocation sync index.

◆ IsLocked()

bool FGPUDefragAllocator::FMemoryChunk::IsLocked ( ) const
inline

◆ IsRelocating()

bool FGPUDefragAllocator::FMemoryChunk::IsRelocating ( ) const
inline

Returns true if the Chunk is being asynchronously relocated due to reallocation or defrag.

◆ Link()

void FGPUDefragAllocator::FMemoryChunk::Link ( FMemoryChunk *&  ChunkToInsertAfter)
inline

Inserts this chunk after the passed in one.

Parameters
ChunkToInsertAfterChunk to insert after

◆ LinkFree()

void FGPUDefragAllocator::FMemoryChunk::LinkFree ( FMemoryChunk FirstFreeChunkToSearch)

Inserts this chunk at the head of the free chunk list.

Inserts this chunk at the head of the free chunk list. If bMaintainSortOrder is true, insert-sort this chunk into the free chunk list.

◆ SetSyncIndex()

void FGPUDefragAllocator::FMemoryChunk::SetSyncIndex ( uint32  InSyncIndex,
int64  InSyncSize 
)
inline

Sets the relocation sync index.

Parameters
InSyncIndexGPU synchronization identifier that can be compared with BestFitAllocator::CompletedSyncIndex
InSyncSizeNumber of uint8s that require GPU synchronization (starting from the beginning of the chunk)

◆ Unlink()

void FGPUDefragAllocator::FMemoryChunk::Unlink ( )
inline

Removes itself for linked list.

◆ UnlinkFree()

void FGPUDefragAllocator::FMemoryChunk::UnlinkFree ( )
inline

Removes itself for linked "free" list. Maint32ains the free-list order.

Member Data Documentation

◆ Base

uint8* FGPUDefragAllocator::FMemoryChunk::Base

Base of chunk.

◆ BestFitAllocator

FGPUDefragAllocator& FGPUDefragAllocator::FMemoryChunk::BestFitAllocator

Allows access to FBestFitAllocator members such as FirstChunk, FirstFreeChunk and LastChunk.

◆ bIsAvailable

bool FGPUDefragAllocator::FMemoryChunk::bIsAvailable

Whether the chunk is available.

◆ bTail

bool FGPUDefragAllocator::FMemoryChunk::bTail

◆ DefragCounter

uint16 FGPUDefragAllocator::FMemoryChunk::DefragCounter

Defrag counter. If this chunk failed to defrag, it won't try it again until the counter is 0.

◆ LockCount

int32 FGPUDefragAllocator::FMemoryChunk::LockCount

Whether the chunk has been locked.

◆ NextChunk

FMemoryChunk* FGPUDefragAllocator::FMemoryChunk::NextChunk

Pointer to next chunk.

◆ NextFreeChunk

FMemoryChunk* FGPUDefragAllocator::FMemoryChunk::NextFreeChunk

Pointer to next free chunk.

◆ OrigSize

int64 FGPUDefragAllocator::FMemoryChunk::OrigSize

◆ PreviousChunk

FMemoryChunk* FGPUDefragAllocator::FMemoryChunk::PreviousChunk

Pointer to previous chunk.

◆ PreviousFreeChunk

FMemoryChunk* FGPUDefragAllocator::FMemoryChunk::PreviousFreeChunk

Pointer to previous free chunk.

◆ Size

int64 FGPUDefragAllocator::FMemoryChunk::Size

Size of chunk.

◆ Stat

TStatId FGPUDefragAllocator::FMemoryChunk::Stat

◆ SyncIndex

uint32 FGPUDefragAllocator::FMemoryChunk::SyncIndex

SyncIndex that must be exceeded before accessing the data within this chunk.

◆ SyncSize

int64 FGPUDefragAllocator::FMemoryChunk::SyncSize

Number of uint8s covered by the SyncIndex (starting from the beginning of the chunk).

◆ UserPayload

void* FGPUDefragAllocator::FMemoryChunk::UserPayload

User payload, e.g. platform-specific texture Pointer. Only chunks with payload can be relocated.


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