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

#include <GPUSortManager.h>

+ Inheritance diagram for FGPUSortManager:

Classes

struct  FAllocationInfo
 
struct  FKeyGenInfo
 

Public Member Functions

ENGINE_API FGPUSortManager (ERHIFeatureLevel::Type InFeatureLevel)
 
ENGINE_API ~FGPUSortManager ()
 
ENGINE_API void Register (const FGPUSortKeyGenDelegate &CallbackDelegate, EGPUSortFlags UsedFlags, const FName &InName)
 
ENGINE_API bool AddTask (FRHICommandListBase &RHICmdList, FAllocationInfo &OutInfo, int32 ValueCount, EGPUSortFlags TaskFlags)
 
ENGINE_API void OnPreRender (class FRDGBuilder &GraphBuilder)
 
ENGINE_API void OnPostRenderOpaque (class FRDGBuilder &GraphBuilder)
 
 DECLARE_EVENT_OneParam (FGPUSortManager, FPostPreRenderEvent, FRHICommandListImmediate &)
 
 DECLARE_EVENT_OneParam (FGPUSortManager, FPostPostRenderEvent, FRHICommandListImmediate &)
 
- Public Member Functions inherited from FRefCountedObject
 FRefCountedObject ()
 
virtual ~FRefCountedObject ()
 
 FRefCountedObject (const FRefCountedObject &Rhs)=delete
 
FRefCountedObjectoperator= (const FRefCountedObject &Rhs)=delete
 
FReturnedRefCountValue AddRef () const
 
uint32 Release () const
 
uint32 GetRefCount () const
 

Public Attributes

FPostPreRenderEvent PostPreRenderEvent
 
FPostPreRenderEvent PostPostRenderEvent
 

Detailed Description

A manager that handles different GPU sort tasks. Each task has different constraints about when the data can be generated and when the sorted results need to be available. The usecase involes registering a sort task through AddTask() and then initializing the sort data through the KeyGen callback. The sort manager can be enabled or disabled through "fx.AllowGPUSorting"

Constructor & Destructor Documentation

◆ FGPUSortManager()

FGPUSortManager::FGPUSortManager ( ERHIFeatureLevel::Type  InFeatureLevel)

Creates the sort manager, this is when the settings are configured.

◆ ~FGPUSortManager()

FGPUSortManager::~FGPUSortManager ( )

Member Function Documentation

◆ AddTask()

bool FGPUSortManager::AddTask ( FRHICommandListBase RHICmdList,
FAllocationInfo OutInfo,
int32  ValueCount,
EGPUSortFlags  TaskFlags 
)

Add a GPU sort task to process this frame. Tasks are expected to be created before OnPreRender() gets called.

Parameters
OutInfo- The details about the allocation bindings, if success.
IndexCount- The number of values that need to be sorted by this task.
SortFlags- The sort task requirements.

Return true if the task was added to a batch, false otherwise, could be because GPU sorting is disabled.

◆ DECLARE_EVENT_OneParam() [1/2]

FGPUSortManager::DECLARE_EVENT_OneParam ( FGPUSortManager  ,
FPostPostRenderEvent  ,
FRHICommandListImmediate  
)

Event to register and receive post-postrender notification.

◆ DECLARE_EVENT_OneParam() [2/2]

FGPUSortManager::DECLARE_EVENT_OneParam ( FGPUSortManager  ,
FPostPreRenderEvent  ,
FRHICommandListImmediate  
)

Event to register and receive post-prerender notification.

◆ OnPostRenderOpaque()

void FGPUSortManager::OnPostRenderOpaque ( class FRDGBuilder GraphBuilder)

Callback that needs to be called in the rendering loop, after calls to FFXSystemInterface::PostRenderOpaque() are issued. Tasks with EGPUSortFlags::KeyGenAfterPostRenderOpaque get their client callbacks issued to set the initial keys and values. After this any sort task that hasn't been processed yet, in OnPreRender(), gets processed now.

Parameters
RHICmdList- The command list to be used.

◆ OnPreRender()

void FGPUSortManager::OnPreRender ( class FRDGBuilder GraphBuilder)

Callback that needs to be called in the rendering loop, after calls to FFXSystemInterface::PreRender() are issued. At this point, no other GPU sort tasks are allowed to be created through AddTask() as the sort batches get finalized. At this point, any task with the EGPUSortFlags::SortAfterPreRender will possibly be done, unless it also had the EGPUSortFlags::SortAfterPostRenderOpaque flag. Tasks with EGPUSortFlags::KeyGenAfterPreRender get their client callbacks issued to set the initial keys and values.

Parameters
RHICmdList- The command list to be used.

◆ Register()

void FGPUSortManager::Register ( const FGPUSortKeyGenDelegate CallbackDelegate,
EGPUSortFlags  UsedFlags,
const FName InName 
)

Register a client system into the sort manager. Client systems are systems that will call AddTask(). Those systems need to register a callback, the possible used flags for their tasks and a name. The callback is required because the initial content to perform GPU sorts is only configured long after AddTask() gets called in the rendering loop.

Parameters
CallbackDelegate- The callback that will be used to set the initial keys and values for each batch elements.
UsedFlags- The possibly used flags for each of the client system tasks, used to perform some optimizations.
InName- A name defining this client system, used for GPU markers.

Member Data Documentation

◆ PostPostRenderEvent

FPostPreRenderEvent FGPUSortManager::PostPostRenderEvent

◆ PostPreRenderEvent

FPostPreRenderEvent FGPUSortManager::PostPreRenderEvent

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