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

#include <TexturePagePool.h>

Public Member Functions

 FTexturePagePool ()
 
 ~FTexturePagePool ()
 
void Initialize (uint32 InNumPages)
 
FCriticalSectionGetLock ()
 
uint32 GetNumPages () const
 
uint32 GetNumLockedPages () const
 
uint32 GetNumMappedPages () const
 
uint32 GetNumAllocatedPages () const
 
void EvictAllPages (FVirtualTextureSystem *System)
 
void EvictPages (FVirtualTextureSystem *System, const FVirtualTextureProducerHandle &ProducerHandle)
 
void EvictPages (FVirtualTextureSystem *System, FVirtualTextureProducerHandle const &ProducerHandle, FVTProducerDescription const &Desc, FIntRect const &TextureRegion, uint32 MaxLevelToEvict, uint32 MinFrameToKeepMapped, EVTInvalidatePriority InvalidatePriority, TSet< union FVirtualTextureLocalTileRequest > &OutDirtyMapped)
 
void UnmapAllPagesForSpace (FVirtualTextureSystem *System, uint8 SpaceID, uint32 vAddress, uint32 Width, uint32 Height, uint32 MaxLevel)
 
void RemapPages (FVirtualTextureSystem *System, uint8 SpaceID, FVirtualTexturePhysicalSpace *PhysicalSpace, FVirtualTextureProducerHandle const &ProducerHandleOld, uint32 OldVirtualAddress, FVirtualTextureProducerHandle const &ProducerHandleNew, uint32 NewVirtualAddress, int32 vLevelBias, uint32 Frame)
 
void GetAllLockedPages (FVirtualTextureSystem *System, TSet< union FVirtualTextureLocalTile > &OutPages)
 
FVirtualTextureLocalTile GetLocalTileFromPhysicalAddress (uint16 pAddress)
 
uint8 GetLocalLevelForAddress (uint16 pAddress) const
 
bool AnyFreeAvailable (uint32 Frame, uint32 FreeThreshold) const
 
uint32 FindPageAddress (const FVirtualTextureProducerHandle &ProducerHandle, uint8 GroupIndex, uint32 Local_vAddress, uint8 Local_vLevel) const
 
uint32 FindNearestPageAddress (const FVirtualTextureProducerHandle &ProducerHandle, uint8 GroupIndex, uint32 Local_vAddress, uint8 Local_vLevel, uint8 MaxLevel) const
 
uint32 FindNearestPageLevel (const FVirtualTextureProducerHandle &ProducerHandle, uint8 GroupIndex, uint32 Local_vAddress, uint8 Local_vLevel) const
 
uint32 Alloc (FVirtualTextureSystem *System, uint32 Frame, const FVirtualTextureProducerHandle &ProducerHandle, uint8 GroupIndex, uint32 Local_vAddress, uint8 Local_vLevel, bool bLock)
 
void Free (FVirtualTextureSystem *System, uint16 pAddress)
 
void Lock (uint16 pAddress)
 
void Unlock (uint32 Frame, uint16 pAddress)
 
void UpdateUsage (uint32 Frame, uint16 pAddress)
 
uint32 GetNumVisiblePages (uint32 Frame) const
 
void CollectProducerCounts (TMap< uint32, FUintVector2 > &OutProducerCountMap) const
 
void MapPage (FVirtualTextureSpace *Space, FVirtualTexturePhysicalSpace *PhysicalSpace, uint8 PageTableLayerIndex, uint8 MaxLevel, uint8 vLogSize, uint32 vAddress, uint8 Local_vLevel, uint16 pAddress)
 

Detailed Description

Manages a pool of texture pages, backed by a large GPU texture atlas. Pages can be allocated for a particular virtual texture, and mapped into any number of virtual pages tables. FTexturePagePool tracks the VT that owns the allocation for each page, and maintains a list of page table mappings for each allocated page. In order to maintain page table mappings, this class works closely with FTexturePageMap, which tracks mappings for a single layer of a given page table

Constructor & Destructor Documentation

◆ FTexturePagePool()

FTexturePagePool::FTexturePagePool ( )

◆ ~FTexturePagePool()

FTexturePagePool::~FTexturePagePool ( )

Member Function Documentation

◆ Alloc()

uint32 FTexturePagePool::Alloc ( FVirtualTextureSystem System,
uint32  Frame,
const FVirtualTextureProducerHandle ProducerHandle,
uint8  GroupIndex,
uint32  Local_vAddress,
uint8  Local_vLevel,
bool  bLock 
)

Allocate a physical address This allocation will be owned by the given VT producer, and if successful, may be mapped into virtual page tables Assuming the pool is full, the returned physical address will first be unmapped from anything that was previously using it

Parameters
FrameThe current frame, used to manage LRU allocations
ProducerHandleHandle of the VT producer requesting this page
GroupIndexPhysical group in the producer
Local_vAddressVirtual address relative to the given producer
Local_vLevelMip level in the producer
bLockShould the allocation be locked; locked allocations will never be evicted

◆ AnyFreeAvailable()

bool FTexturePagePool::AnyFreeAvailable ( uint32  Frame,
uint32  FreeThreshold 
) const

Check if there are any free pages available at the moment.

◆ CollectProducerCounts()

void FTexturePagePool::CollectProducerCounts ( TMap< uint32, FUintVector2 > &  OutProducerCountMap) const

Returns a map between producer handle and a uint2 containing number of tiles and number of locked tils that the producer uses in the pool.

◆ EvictAllPages()

void FTexturePagePool::EvictAllPages ( FVirtualTextureSystem System)

Reset the page pool. This can be used to flush any caches. Mainly useful for debug and testing purposes.

◆ EvictPages() [1/2]

void FTexturePagePool::EvictPages ( FVirtualTextureSystem System,
const FVirtualTextureProducerHandle ProducerHandle 
)

Unmap/remove any pages that were allocated by the given producer

◆ EvictPages() [2/2]

void FTexturePagePool::EvictPages ( FVirtualTextureSystem System,
FVirtualTextureProducerHandle const &  ProducerHandle,
FVTProducerDescription const &  Desc,
FIntRect const &  TextureRegion,
uint32  MaxLevelToEvict,
uint32  MinFrameToKeepMapped,
EVTInvalidatePriority  InvalidatePriority,
TSet< union FVirtualTextureLocalTileRequest > &  OutDirtyMapped 
)

Unmap/remove any pages that were allocated by the given producer and are inside the TextureRegion. Outputs the locked pages that can't be unmapped to the OutLocked array.

◆ FindNearestPageAddress()

uint32 FTexturePagePool::FindNearestPageAddress ( const FVirtualTextureProducerHandle ProducerHandle,
uint8  GroupIndex,
uint32  Local_vAddress,
uint8  Local_vLevel,
uint8  MaxLevel 
) const

Find the physical address of the allocated page that's closest to the given page, or ~0 if not found

◆ FindNearestPageLevel()

uint32 FTexturePagePool::FindNearestPageLevel ( const FVirtualTextureProducerHandle ProducerHandle,
uint8  GroupIndex,
uint32  Local_vAddress,
uint8  Local_vLevel 
) const

Find the level of the allocated page that's closest to the given page, or ~0 if not found

◆ FindPageAddress()

uint32 FTexturePagePool::FindPageAddress ( const FVirtualTextureProducerHandle ProducerHandle,
uint8  GroupIndex,
uint32  Local_vAddress,
uint8  Local_vLevel 
) const

Find physical address of the page allocated for the given VT address, or ~0 if not allocated

◆ Free()

void FTexturePagePool::Free ( FVirtualTextureSystem System,
uint16  pAddress 
)

Marks the given physical address as free, will be unlocked if needed, moved to top of LRU list, no longer associated with any producer

◆ GetAllLockedPages()

void FTexturePagePool::GetAllLockedPages ( FVirtualTextureSystem System,
TSet< union FVirtualTextureLocalTile > &  OutPages 
)

Get descriptions of the locked pages in this pool

◆ GetLocalLevelForAddress()

uint8 FTexturePagePool::GetLocalLevelForAddress ( uint16  pAddress) const
inline

Get the local vLevel of the page allocated at the given physical address

◆ GetLocalTileFromPhysicalAddress()

FVirtualTextureLocalTile FTexturePagePool::GetLocalTileFromPhysicalAddress ( uint16  pAddress)

◆ GetLock()

FCriticalSection & FTexturePagePool::GetLock ( )
inline

◆ GetNumAllocatedPages()

uint32 FTexturePagePool::GetNumAllocatedPages ( ) const
inline

◆ GetNumLockedPages()

uint32 FTexturePagePool::GetNumLockedPages ( ) const
inline

◆ GetNumMappedPages()

uint32 FTexturePagePool::GetNumMappedPages ( ) const
inline

◆ GetNumPages()

uint32 FTexturePagePool::GetNumPages ( ) const
inline

◆ GetNumVisiblePages()

uint32 FTexturePagePool::GetNumVisiblePages ( uint32  Frame) const

Returns the number of pages marked as used since a given frame.

◆ Initialize()

void FTexturePagePool::Initialize ( uint32  InNumPages)

◆ Lock()

void FTexturePagePool::Lock ( uint16  pAddress)

Mark a physical address as locked, so it will not be evicted.

◆ MapPage()

void FTexturePagePool::MapPage ( FVirtualTextureSpace Space,
FVirtualTexturePhysicalSpace PhysicalSpace,
uint8  PageTableLayerIndex,
uint8  MaxLevel,
uint8  vLogSize,
uint32  vAddress,
uint8  Local_vLevel,
uint16  pAddress 
)

Map the physical address to a specific virtual address.

◆ RemapPages()

void FTexturePagePool::RemapPages ( FVirtualTextureSystem System,
uint8  SpaceID,
FVirtualTexturePhysicalSpace PhysicalSpace,
FVirtualTextureProducerHandle const &  ProducerHandleOld,
uint32  OldVirtualAddress,
FVirtualTextureProducerHandle const &  ProducerHandleNew,
uint32  NewVirtualAddress,
int32  vLevelBias,
uint32  Frame 
)

Remap physical pages from one producer to another.

◆ Unlock()

void FTexturePagePool::Unlock ( uint32  Frame,
uint16  pAddress 
)

Unlock the given physical address

◆ UnmapAllPagesForSpace()

void FTexturePagePool::UnmapAllPagesForSpace ( FVirtualTextureSystem System,
uint8  SpaceID,
uint32  vAddress,
uint32  Width,
uint32  Height,
uint32  MaxLevel 
)

Unmap all pages from the given address range in a space. Pages will remain resident in the pool, but no longer by mapped to any page table.

◆ UpdateUsage()

void FTexturePagePool::UpdateUsage ( uint32  Frame,
uint16  pAddress 
)

Marks the given physical address as used on this frame. This means it's guaranteed not to be evicted later on this frame, and less likely to be evicted on future frames (LRU pages are evicted first)


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