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

#include <MeshPassProcessor.h>

Public Member Functions

 FMeshDrawCommand ()
 
 FMeshDrawCommand (FMeshDrawCommand &&Other)=default
 
 FMeshDrawCommand (const FMeshDrawCommand &Other)=default
 
FMeshDrawCommandoperator= (const FMeshDrawCommand &Other)=default
 
FMeshDrawCommandoperator= (FMeshDrawCommand &&Other)=default
 
bool MatchesForDynamicInstancing (const FMeshDrawCommand &Rhs) const
 
uint32 GetDynamicInstancingHash () const
 
void InitializeShaderBindings (const FMeshProcessorShaders &Shaders)
 
void SetStencilRef (uint32 InStencilRef)
 
RENDERER_API void SetDrawParametersAndFinalize (const FMeshBatch &MeshBatch, int32 BatchElementIndex, FGraphicsMinimalPipelineStateId PipelineId, const FMeshProcessorShaders *ShadersForDebugging)
 
void Finalize (FGraphicsMinimalPipelineStateId PipelineId, const FMeshProcessorShaders *ShadersForDebugging)
 
uint64 GetPipelineStateSortingKey (FRHICommandList &RHICmdList, const FGraphicsPipelineRenderTargetsInfo &RenderTargetsInfo) const
 
uint64 GetPipelineStateSortingKey (const FGraphicsPipelineRenderTargetsInfo &RenderTargetsInfo) const
 
RENDERER_API void SetDebugData (const FPrimitiveSceneProxy *PrimitiveSceneProxy, const FMaterial *Material, const FMaterialRenderProxy *MaterialRenderProxy, const FMeshProcessorShaders &UntypedShaders, const FVertexFactory *VertexFactory, const FMeshBatch &MeshBatch, int32 PSOCollectorIndex)
 
SIZE_T GetAllocatedSize () const
 
SIZE_T GetDebugDataSize () const
 
void ClearDebugPrimitiveSceneProxy () const
 
const FMeshDrawCommandDebugDataGetDebugData () const
 
void SetStatsData (const FPrimitiveSceneProxy *PrimitiveSceneProxy)
 

Static Public Member Functions

static bool SubmitDrawBegin (const FMeshDrawCommand &RESTRICT MeshDrawCommand, const FGraphicsMinimalPipelineStateSet &GraphicsMinimalPipelineStateSet, const FMeshDrawCommandSceneArgs &SceneArgs, uint32 InstanceFactor, FRHICommandList &RHICmdList, FMeshDrawCommandStateCache &RESTRICT StateCache, bool bAllowSkipDrawCommand)
 
static void SubmitDrawEnd (const FMeshDrawCommand &MeshDrawCommand, const FMeshDrawCommandSceneArgs &SceneArgs, uint32 InstanceFactor, FRHICommandList &RHICmdList)
 
static bool SubmitDrawIndirectBegin (const FMeshDrawCommand &RESTRICT MeshDrawCommand, const FGraphicsMinimalPipelineStateSet &GraphicsMinimalPipelineStateSet, const FMeshDrawCommandSceneArgs &SceneArgs, uint32 InstanceFactor, FRHICommandList &RHICmdList, FMeshDrawCommandStateCache &RESTRICT StateCache, bool bAllowSkipDrawCommand)
 
static void SubmitDrawIndirectEnd (const FMeshDrawCommand &MeshDrawCommand, const FMeshDrawCommandSceneArgs &SceneArgs, uint32 InstanceFactor, FRHICommandList &RHICmdList)
 
static bool SubmitDraw (const FMeshDrawCommand &RESTRICT MeshDrawCommand, const FGraphicsMinimalPipelineStateSet &GraphicsMinimalPipelineStateSet, const FMeshDrawCommandSceneArgs &SceneArgs, uint32 InstanceFactor, FRHICommandList &CommandList, class FMeshDrawCommandStateCache &RESTRICT StateCache)
 

Public Attributes

FMeshDrawShaderBindings ShaderBindings
 
FVertexInputStreamArray VertexStreams
 
FRHIBufferIndexBuffer
 
FGraphicsMinimalPipelineStateId CachedPipelineId
 
uint32 FirstIndex
 
uint32 NumPrimitives
 
uint32 NumInstances
 
union { 
 
   struct { 
 
      uint32   BaseVertexIndex 
 
      uint32   NumVertices 
 
   }   VertexParams 
 
   struct { 
 
      FRHIBuffer *   Buffer 
 
      uint32   Offset 
 
   }   IndirectArgs 
 
};  
 
int8 PrimitiveIdStreamIndex
 
uint8 StencilRef
 
EPrimitiveType PrimitiveType: PT_NumBits
 

Friends

FORCENOINLINE friend uint32 GetTypeHash (const FMeshDrawCommand &Other)
 

Detailed Description

FMeshDrawCommand fully describes a mesh pass draw call, captured just above the RHI.
FMeshDrawCommand should contain only data needed to draw. For InitViews payloads, use FVisibleMeshDrawCommand. FMeshDrawCommands are cached at Primitive AddToScene time for vertex factories that support it (no per-frame or per-view shader binding changes). Dynamic Instancing operates at the FMeshDrawCommand level for robustness.
Adding per-command shader bindings will reduce the efficiency of Dynamic Instancing, but rendering will always be correct. Any resources referenced by a command must be kept alive for the lifetime of the command. FMeshDrawCommand is not responsible for lifetime management of resources. For uniform buffers referenced by cached FMeshDrawCommand's, RHIUpdateUniformBuffer makes it possible to access per-frame data in the shader without changing bindings.

Constructor & Destructor Documentation

◆ FMeshDrawCommand() [1/3]

FMeshDrawCommand::FMeshDrawCommand ( )
inline

◆ FMeshDrawCommand() [2/3]

FMeshDrawCommand::FMeshDrawCommand ( FMeshDrawCommand &&  Other)
default

◆ FMeshDrawCommand() [3/3]

FMeshDrawCommand::FMeshDrawCommand ( const FMeshDrawCommand Other)
default

Member Function Documentation

◆ ClearDebugPrimitiveSceneProxy()

void FMeshDrawCommand::ClearDebugPrimitiveSceneProxy ( ) const
inline

◆ Finalize()

void FMeshDrawCommand::Finalize ( FGraphicsMinimalPipelineStateId  PipelineId,
const FMeshProcessorShaders ShadersForDebugging 
)
inline

◆ GetAllocatedSize()

SIZE_T FMeshDrawCommand::GetAllocatedSize ( ) const
inline

◆ GetDebugData()

const FMeshDrawCommandDebugData & FMeshDrawCommand::GetDebugData ( ) const
inline

◆ GetDebugDataSize()

SIZE_T FMeshDrawCommand::GetDebugDataSize ( ) const
inline

◆ GetDynamicInstancingHash()

uint32 FMeshDrawCommand::GetDynamicInstancingHash ( ) const
inline

◆ GetPipelineStateSortingKey() [1/2]

uint64 FMeshDrawCommand::GetPipelineStateSortingKey ( const FGraphicsPipelineRenderTargetsInfo RenderTargetsInfo) const

Returns the pipeline state sort key, which can be used for sorting material draws to reduce context switches. This variant will not attempt to create a PSO if it doesn't exist yet and will just return the fallback.

◆ GetPipelineStateSortingKey() [2/2]

uint64 FMeshDrawCommand::GetPipelineStateSortingKey ( FRHICommandList RHICmdList,
const FGraphicsPipelineRenderTargetsInfo RenderTargetsInfo 
) const

Returns the pipeline state sort key, which can be used for sorting material draws to reduce context switches.

◆ InitializeShaderBindings()

void FMeshDrawCommand::InitializeShaderBindings ( const FMeshProcessorShaders Shaders)
inline

Allocates room for the shader bindings.

◆ MatchesForDynamicInstancing()

bool FMeshDrawCommand::MatchesForDynamicInstancing ( const FMeshDrawCommand Rhs) const
inline

◆ operator=() [1/2]

FMeshDrawCommand & FMeshDrawCommand::operator= ( const FMeshDrawCommand Other)
default

◆ operator=() [2/2]

FMeshDrawCommand & FMeshDrawCommand::operator= ( FMeshDrawCommand &&  Other)
default

◆ SetDebugData()

RENDERER_API void FMeshDrawCommand::SetDebugData ( const FPrimitiveSceneProxy PrimitiveSceneProxy,
const FMaterial Material,
const FMaterialRenderProxy MaterialRenderProxy,
const FMeshProcessorShaders UntypedShaders,
const FVertexFactory VertexFactory,
const FMeshBatch MeshBatch,
int32  PSOCollectorIndex 
)

◆ SetDrawParametersAndFinalize()

void FMeshDrawCommand::SetDrawParametersAndFinalize ( const FMeshBatch MeshBatch,
int32  BatchElementIndex,
FGraphicsMinimalPipelineStateId  PipelineId,
const FMeshProcessorShaders ShadersForDebugging 
)

Called when the mesh draw command is complete.

◆ SetStatsData()

void FMeshDrawCommand::SetStatsData ( const FPrimitiveSceneProxy PrimitiveSceneProxy)
inline

◆ SetStencilRef()

void FMeshDrawCommand::SetStencilRef ( uint32  InStencilRef)
inline

◆ SubmitDraw()

bool FMeshDrawCommand::SubmitDraw ( const FMeshDrawCommand &RESTRICT  MeshDrawCommand,
const FGraphicsMinimalPipelineStateSet GraphicsMinimalPipelineStateSet,
const FMeshDrawCommandSceneArgs SceneArgs,
uint32  InstanceFactor,
FRHICommandList CommandList,
class FMeshDrawCommandStateCache &RESTRICT  StateCache 
)
static

Submits commands to the RHI Commandlist to draw the MeshDrawCommand.

◆ SubmitDrawBegin()

bool FMeshDrawCommand::SubmitDrawBegin ( const FMeshDrawCommand &RESTRICT  MeshDrawCommand,
const FGraphicsMinimalPipelineStateSet GraphicsMinimalPipelineStateSet,
const FMeshDrawCommandSceneArgs SceneArgs,
uint32  InstanceFactor,
FRHICommandList RHICmdList,
FMeshDrawCommandStateCache &RESTRICT  StateCache,
bool  bAllowSkipDrawCommand 
)
static

Submits the state and shader bindings to the RHI command list, but does not invoke the draw.
If function returns false, then draw can be skipped because the PSO used by the draw command is not compiled yet (still precaching)

◆ SubmitDrawEnd()

void FMeshDrawCommand::SubmitDrawEnd ( const FMeshDrawCommand MeshDrawCommand,
const FMeshDrawCommandSceneArgs SceneArgs,
uint32  InstanceFactor,
FRHICommandList RHICmdList 
)
static

Submits just the draw primitive portion of the draw command.

◆ SubmitDrawIndirectBegin()

bool FMeshDrawCommand::SubmitDrawIndirectBegin ( const FMeshDrawCommand &RESTRICT  MeshDrawCommand,
const FGraphicsMinimalPipelineStateSet GraphicsMinimalPipelineStateSet,
const FMeshDrawCommandSceneArgs SceneArgs,
uint32  InstanceFactor,
FRHICommandList RHICmdList,
FMeshDrawCommandStateCache &RESTRICT  StateCache,
bool  bAllowSkipDrawCommand 
)
static

Submits the state and shader bindings to the RHI command list, but does not invoke the draw indirect. If function returns false, then draw will be skipped because PSO used by the draw command is not compiled yet (still precaching)

◆ SubmitDrawIndirectEnd()

void FMeshDrawCommand::SubmitDrawIndirectEnd ( const FMeshDrawCommand MeshDrawCommand,
const FMeshDrawCommandSceneArgs SceneArgs,
uint32  InstanceFactor,
FRHICommandList RHICmdList 
)
static

Submits just the draw indirect primitive portion of the draw command.

Friends And Related Symbol Documentation

◆ GetTypeHash

FORCENOINLINE friend uint32 GetTypeHash ( const FMeshDrawCommand Other)
friend

Member Data Documentation

◆ [union]

union { ... } FMeshDrawCommand

◆ BaseVertexIndex

uint32 FMeshDrawCommand::BaseVertexIndex

◆ Buffer

FRHIBuffer* FMeshDrawCommand::Buffer

◆ CachedPipelineId

FGraphicsMinimalPipelineStateId FMeshDrawCommand::CachedPipelineId

PSO

◆ FirstIndex

uint32 FMeshDrawCommand::FirstIndex

Draw command parameters

◆ IndexBuffer

FRHIBuffer* FMeshDrawCommand::IndexBuffer

◆ [struct]

struct { ... } FMeshDrawCommand::IndirectArgs

◆ NumInstances

uint32 FMeshDrawCommand::NumInstances

◆ NumPrimitives

uint32 FMeshDrawCommand::NumPrimitives

◆ NumVertices

uint32 FMeshDrawCommand::NumVertices

◆ Offset

uint32 FMeshDrawCommand::Offset

◆ PrimitiveIdStreamIndex

int8 FMeshDrawCommand::PrimitiveIdStreamIndex

◆ PrimitiveType

EPrimitiveType FMeshDrawCommand::PrimitiveType

Redundant as already present in CachedPipelineId, but need access for dynamic instancing on GPU.

◆ ShaderBindings

FMeshDrawShaderBindings FMeshDrawCommand::ShaderBindings

Resource bindings

◆ StencilRef

uint8 FMeshDrawCommand::StencilRef

Non-pipeline state

◆ [struct]

struct { ... } FMeshDrawCommand::VertexParams

◆ VertexStreams

FVertexInputStreamArray FMeshDrawCommand::VertexStreams

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