UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GPUSortManager.cpp File Reference
#include "GPUSortManager.h"
#include "GPUSort.h"
#include "GlobalShader.h"
#include "Math/Float16.h"
#include "ShaderParameterUtils.h"
#include "FXSystem.h"
#include "RenderGraphUtils.h"

Classes

class  FGPUSortDummyUAV
 
class  FCopyUIntBufferCS
 

Macros

#define COPYUINTCS_BUFFER_COUNT   3
 
#define COPYUINTCS_THREAD_COUNT   64
 

Functions

 DECLARE_GPU_STAT_NAMED (GPUKeyGenAndSort, TEXT("GPU KeyGen & Sort"))
 
 IMPLEMENT_SHADER_TYPE (, FCopyUIntBufferCS, TEXT("/Engine/Private/CopyUIntBuffer.usf"), TEXT("MainCS"), SF_Compute)
 
void CopyUIntBufferToTargets (FRHICommandList &RHICmdList, ERHIFeatureLevel::Type FeatureLevel, FRHIShaderResourceView *SourceSRV, FRHIUnorderedAccessView *const *TargetUAVs, int32 *TargetSizes, int32 StartingOffset, int32 NumTargets)
 

Variables

int32 GGPUSortFrameCountBeforeBufferShrinking = 100
 
int32 GGPUSortMinBufferSize = 8192
 
float GGPUSortBufferSlack = 2.f
 
int32 GGPUSortStressTest = 0
 

Macro Definition Documentation

◆ COPYUINTCS_BUFFER_COUNT

#define COPYUINTCS_BUFFER_COUNT   3

◆ COPYUINTCS_THREAD_COUNT

#define COPYUINTCS_THREAD_COUNT   64

Function Documentation

◆ CopyUIntBufferToTargets()

void CopyUIntBufferToTargets ( FRHICommandList RHICmdList,
ERHIFeatureLevel::Type  FeatureLevel,
FRHIShaderResourceView SourceSRV,
FRHIUnorderedAccessView *const *  TargetUAVs,
int32 TargetSizes,
int32  StartingOffset,
int32  NumTargets 
)

Copy one uint buffer into several overlapping targets. Each target is expected to be bigger than the previous one, so that copy resumes where it left. Ex : (ABCDEFGHIJK) -> (ABC–, —DEFGHI-, ------—JK—) This is essentially used to manage growable buffers in cases the binding needs to be set before the final size required is known. In this scenario, the smaller buffers are temporary and only the final (biggest) buffer becomes persistent, this is why it has apparently unused space at the beginning but it will be used the next frame to hold all of the data. Note that required calls to RHICmdList.Transition need to be handled before and after this function.

Parameters
RHICmdList- The command list used to issue the dispatch.
FeatureLevel- The current feature level, used to access the global shadermap.
SourceSRV- The source uint buffer to be copied into the others.
TargetUAVs- The destination overlapping uint buffers.
TargetSizes- The copy size of each of the buffers. Once a buffer size is reached, the copy targets the next buffer.
StartingOffset- The starting position at which the copy starts. Applies for both the source and targets.
NumTargets- The number of elements in TargetUAVs and TargetSizes.

◆ DECLARE_GPU_STAT_NAMED()

DECLARE_GPU_STAT_NAMED ( GPUKeyGenAndSort  ,
TEXT("GPU KeyGen & Sort"  
)

◆ IMPLEMENT_SHADER_TYPE()

IMPLEMENT_SHADER_TYPE ( FCopyUIntBufferCS  ,
TEXT("/Engine/Private/CopyUIntBuffer.usf" ,
TEXT("MainCS")  ,
SF_Compute   
)

Variable Documentation

◆ GGPUSortBufferSlack

float GGPUSortBufferSlack = 2.f

◆ GGPUSortFrameCountBeforeBufferShrinking

int32 GGPUSortFrameCountBeforeBufferShrinking = 100

◆ GGPUSortMinBufferSize

int32 GGPUSortMinBufferSize = 8192

◆ GGPUSortStressTest

int32 GGPUSortStressTest = 0