UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FTextureMipAllocator Class Referenceabstract

#include <TextureMipAllocator.h>

+ Inheritance diagram for FTextureMipAllocator:

Public Types

enum class  ETickState : uint32 { AllocateMips , UploadMips , Done }
 
enum class  ETickThread : uint32 { Async , Render , None }
 

Public Member Functions

 FTextureMipAllocator (UTexture *Texture, ETickState InTickState, ETickThread InTickThread)
 
 FTextureMipAllocator (const FTextureMipAllocator &)
 
 FTextureMipAllocator (FTextureMipAllocator &&)
 
virtual ~FTextureMipAllocator ()
 
FORCEINLINE ETickState GetNextTickState () const
 
FORCEINLINE ETickThread GetNextTickThread () const
 
virtual bool AllocateMips (const FTextureUpdateContext &Context, FTextureMipInfoArray &OutMipInfos, const FTextureUpdateSyncOptions &SyncOptions)=0
 
virtual bool UploadMips (const FTextureUpdateContext &Context, const FTextureUpdateSyncOptions &SyncOptions)=0
 
bool FinalizeMips (const FTextureUpdateContext &Context, const FTextureUpdateSyncOptions &SyncOptions)
 
void ExecuteCancel (const FTextureUpdateSyncOptions &SyncOptions)
 
ETickThread ExecuteGetCancelThread () const
 
const FTextureRHIRefGetIntermediateTextureRHI () const
 

Protected Member Functions

virtual void Cancel (const FTextureUpdateSyncOptions &SyncOptions)=0
 
virtual ETickThread GetCancelThread () const =0
 
FORCEINLINE void AdvanceTo (ETickState InState, ETickThread InThread)
 

Protected Attributes

const FStreamableRenderResourceState ResourceState
 
const int32 CurrentFirstLODIdx = INDEX_NONE
 
const int32 PendingFirstLODIdx = INDEX_NONE
 
FTextureRHIRef IntermediateTextureRHI
 

Detailed Description

FTextureMipAllocator defines the update steps and interface to implement the mip allocation strategy used in FTextureStreamIn. It allows to decouples the texture creation steps from the texture update. Typical implementations are using RHIAsyncCreateTexture2D, RHIAsyncReallocateTexture2D or virtual textures.

Member Enumeration Documentation

◆ ETickState

Enumerator
AllocateMips 
UploadMips 
Done 

◆ ETickThread

Enumerator
Async 
Render 
None 

Constructor & Destructor Documentation

◆ FTextureMipAllocator() [1/3]

FTextureMipAllocator::FTextureMipAllocator ( UTexture Texture,
ETickState  InTickState,
ETickThread  InTickThread 
)

◆ FTextureMipAllocator() [2/3]

FTextureMipAllocator::FTextureMipAllocator ( const FTextureMipAllocator )
default

◆ FTextureMipAllocator() [3/3]

FTextureMipAllocator::FTextureMipAllocator ( FTextureMipAllocator &&  )
default

◆ ~FTextureMipAllocator()

FTextureMipAllocator::~FTextureMipAllocator ( )
virtualdefault

Member Function Documentation

◆ AdvanceTo()

FORCEINLINE void FTextureMipAllocator::AdvanceTo ( ETickState  InState,
ETickThread  InThread 
)
inlineprotected

◆ AllocateMips()

virtual bool FTextureMipAllocator::AllocateMips ( const FTextureUpdateContext Context,
FTextureMipInfoArray OutMipInfos,
const FTextureUpdateSyncOptions SyncOptions 
)
pure virtual

Allocate the FTextureMipInfoArray and configure the entries for the new (streamed in) mips. In particular, the FTextureMipAllocator must set valid FTextureMipInfo::DestData so that the mip data provider can write the mip data to.

Parameters
Context- An update context constant throughout the FTextureStreamIn update. Gives things like which texture asset is updated and what mips are streamed in.
OutMipInfos- The array of FTextureMipInfo that must be correctly configured so that FTextureMipDataProvider know what is being requested and where to write data to.
SyncOptions- Different sync options to control when the next tick of FTextureStreamIn can be scheduled.

Return true unless the texture update needs to be aborted because of invalid data or setup.

Implemented in FTexture2DArrayMipAllocator_Reallocate, FTexture2DMipAllocator_AsyncCreate, FTexture2DMipAllocator_AsyncReallocate, FTexture2DMipAllocator_Virtual, and FVolumeTextureMipAllocator_Reallocate.

◆ Cancel()

virtual void FTextureMipAllocator::Cancel ( const FTextureUpdateSyncOptions SyncOptions)
protectedpure virtual

Cancel the progression and release any temporary resources. Called within the FTextureStreamIn update when the stream in request is aborted or cannot complete correctly The Cancel() function is called on the thread returned by GetCancelThread().

Parameters
SyncOptions- Different sync options to control when the next tick of FTextureStreamIn can be scheduled.

Implemented in FTexture2DArrayMipAllocator_Reallocate, FTexture2DMipAllocator_AsyncCreate, FTexture2DMipAllocator_AsyncReallocate, FTexture2DMipAllocator_Virtual, and FVolumeTextureMipAllocator_Reallocate.

◆ ExecuteCancel()

void FTextureMipAllocator::ExecuteCancel ( const FTextureUpdateSyncOptions SyncOptions)

◆ ExecuteGetCancelThread()

FTextureMipAllocator::ETickThread FTextureMipAllocator::ExecuteGetCancelThread ( ) const

◆ FinalizeMips()

bool FTextureMipAllocator::FinalizeMips ( const FTextureUpdateContext Context,
const FTextureUpdateSyncOptions SyncOptions 
)

Update the texture resource with the new RHI texture. Update is completed after this step and can not be canceled afterward..

Parameters
Context- An update context constant throughout the FTextureStreamIn update. Gives things like which texture asset is updated and what mips are streamed in.
SyncOptions- Different sync options to control when the next tick of FTextureStreamIn can be scheduled.

Return true unless the texture update needs to be aborted because of invalid data or setup.

◆ GetCancelThread()

◆ GetIntermediateTextureRHI()

const FTextureRHIRef & FTextureMipAllocator::GetIntermediateTextureRHI ( ) const
inline

◆ GetNextTickState()

FORCEINLINE ETickState FTextureMipAllocator::GetNextTickState ( ) const
inline

◆ GetNextTickThread()

FORCEINLINE ETickThread FTextureMipAllocator::GetNextTickThread ( ) const
inline

◆ UploadMips()

virtual bool FTextureMipAllocator::UploadMips ( const FTextureUpdateContext Context,
const FTextureUpdateSyncOptions SyncOptions 
)
pure virtual

Upload the new mip data to the GPU. The

Parameters
Context- An update context constant throughout the FTextureStreamIn update. Gives things like which texture asset is updated and what mips are streamed in.
SyncOptions- Different sync options to control when the next tick of FTextureStreamIn can be scheduled.

Return true unless the texture update needs to be aborted because of invalid data or setup.

Implemented in FTexture2DArrayMipAllocator_Reallocate, FTexture2DMipAllocator_AsyncCreate, FTexture2DMipAllocator_AsyncReallocate, FTexture2DMipAllocator_Virtual, and FVolumeTextureMipAllocator_Reallocate.

Member Data Documentation

◆ CurrentFirstLODIdx

const int32 FTextureMipAllocator::CurrentFirstLODIdx = INDEX_NONE
protected

◆ IntermediateTextureRHI

FTextureRHIRef FTextureMipAllocator::IntermediateTextureRHI
protected

The intermediate texture async created in the update process.

◆ PendingFirstLODIdx

const int32 FTextureMipAllocator::PendingFirstLODIdx = INDEX_NONE
protected

◆ ResourceState

const FStreamableRenderResourceState FTextureMipAllocator::ResourceState
protected

The streamable state requested.


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