![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <MetalCommandEncoder.h>
Public Member Functions | |
| FMetalCommandEncoder (FMetalDevice &Device, FMetalCommandList &CmdList) | |
| void | Release (void) |
| void | Reset (void) |
| void | ResetLive (void) |
| void | StartCommandBuffer (void) |
| void | EndCommandBuffer (FMetalRHICommandContext *Context) |
| FMetalCommandBuffer * | GetCommandBuffer () |
| uint32 | GetCommandBufferIndex () const |
| bool | IsParallelRenderCommandEncoderActive (void) const |
| bool | IsRenderCommandEncoderActive (void) const |
| bool | IsComputeCommandEncoderActive (void) const |
| bool | IsBlitCommandEncoderActive (void) const |
| bool | IsAnyCommandEncoderActive (void) const |
| bool | IsParallelEncoding () |
| bool | IsRenderPassDescriptorValid (void) const |
| const MTL::RenderPassDescriptor * | GetRenderPassDescriptor (void) const |
| MTL::RenderCommandEncoder * | GetRenderCommandEncoder (void) |
| MTL::ComputeCommandEncoder * | GetComputeCommandEncoder (void) |
| MTL::BlitCommandEncoder * | GetBlitCommandEncoder (void) |
| TRefCountPtr< FMetalFence > const & | GetEncoderFence (void) const |
| uint32 | NumEncodedPasses (void) const |
| MTLParallelRenderCommandEncoderPtr | BeginParallelRenderCommandEncoding (FMetalCounterSampler *Sampler) |
| void | BeginRenderCommandEncoding (FMetalCounterSampler *Sampler) |
| void | BeginRenderCommandEncoding (MTL::RenderPassDescriptor *RenderPassDesc, MTLParallelRenderCommandEncoderPtr ParallelEncoder) |
| void | BeginComputeCommandEncoding (MTL::DispatchType Type=MTL::DispatchTypeSerial, FMetalCounterSampler *Sampler=nullptr) |
| void | BeginBlitCommandEncoding (FMetalCounterSampler *Sampler) |
| TRefCountPtr< FMetalFence > | EndEncoding () |
| void | UpdateFence (FMetalFence *Fence) |
| void | WaitForFence (FMetalFence *Fence) |
| void | SignalEvent (MTLEventPtr Event, uint32_t SignalCount) |
| void | WaitForEvent (MTLEventPtr Event, uint32_t SignalCount) |
| void | InsertDebugSignpost (NS::String *String) |
| void | PushDebugGroup (NS::String *String) |
| void | PopDebugGroup (void) |
| void | SetRenderPassDescriptor (MTL::RenderPassDescriptor *RenderPass) |
| void | SetRenderPassStoreActions (MTL::StoreAction const *const ColorStore, MTL::StoreAction const DepthStore, MTL::StoreAction const StencilStore) |
| void | SetRenderPipelineState (FMetalShaderPipeline *const PipelineState) |
| void | SetViewport (MTL::Viewport const Viewport[], uint32 NumActive) |
| void | SetFrontFacingWinding (MTL::Winding const FrontFacingWinding) |
| void | SetCullMode (MTL::CullMode const CullMode) |
| void | SetDepthBias (float const DepthBias, float const SlopeScale, float const Clamp) |
| void | SetScissorRect (MTL::ScissorRect const Rect[], uint32 NumActive) |
| void | SetTriangleFillMode (MTL::TriangleFillMode const FillMode) |
| void | SetDepthClipMode (MTL::DepthClipMode DepthClipMode) |
| void | SetBlendColor (float const Red, float const Green, float const Blue, float const Alpha) |
| void | SetDepthStencilState (MTL::DepthStencilState *DepthStencilState) |
| void | SetStencilReferenceValue (uint32 const ReferenceValue) |
| void | SetVisibilityResultMode (MTL::VisibilityResultMode const Mode, NS::UInteger const Offset) |
| void | SetShaderBuffer (MTL::FunctionType const FunctionType, FMetalBufferPtr Buffer, NS::UInteger const Offset, NS::UInteger const Length, NS::UInteger const Index, MTL::ResourceUsage const Usage, EPixelFormat const Format=PF_Unknown, NS::UInteger const ElementRowPitch=0, TArray< TTuple< MTL::Resource *, MTL::ResourceUsage > > ReferencedResources={}) |
| void | SetShaderData (MTL::FunctionType const FunctionType, FMetalBufferData *Data, NS::UInteger const Offset, NS::UInteger const Index, EPixelFormat const Format=PF_Unknown, NS::UInteger const ElementRowPitch=0) |
| void | SetShaderBytes (MTL::FunctionType const FunctionType, uint8 const *Bytes, NS::UInteger const Length, NS::UInteger const Index) |
| void | SetShaderTexture (MTL::FunctionType const FunctionType, MTL::Texture *Texture, NS::UInteger const Index, MTL::ResourceUsage const Usage) |
| void | SetShaderSamplerState (MTL::FunctionType const FunctionType, MTL::SamplerState *Sampler, NS::UInteger const Index) |
| void | SetShaderSideTable (MTL::FunctionType const FunctionType, NS::UInteger const Index) |
| void | UseIndirectArgumentResource (MTL::Texture *Texture, MTL::ResourceUsage const Usage) |
| void | UseIndirectArgumentResource (FMetalBufferPtr Buffer, MTL::ResourceUsage const Usage) |
| void | TransitionResources (MTL::Resource *Resource) |
| void | SetComputePipelineState (FMetalShaderPipelinePtr State) |
| FMetalSubBufferRing & | GetRingBuffer (void) |
| void | UseResource (MTL::Resource *Resource, MTL::ResourceUsage const Usage) |
| void | UseResources (TArray< MTL::Resource * > const &Resources, MTL::ResourceUsage const Usage, MTL::RenderStages RenderStages=0) |
| void | UseHeaps (TArray< MTL::Heap * > const &Heaps, const MTL::FunctionType Function) |
FMetalCommandEncoder: Wraps the details of switching between different command encoders on the command-buffer, allowing for restoration of the render encoder if needed. UnrealEngine expects the API to serialise commands in-order, but Metal expects applications to work with command-buffers directly so we need to implement the RHI semantics by switching between encoder types. This class hides the ugly details. Eventually it might be possible to move some of the operations into pre- & post- command-buffers so that we avoid encoder switches but that will take changes to the RHI and high-level code too, so it won't happen soon.
| FMetalCommandEncoder::FMetalCommandEncoder | ( | FMetalDevice & | Device, |
| FMetalCommandList & | CmdList | ||
| ) |
Default constructor
| void FMetalCommandEncoder::BeginBlitCommandEncoding | ( | FMetalCounterSampler * | Sampler | ) |
Begins encoding blit commands into the current command buffer. No other encoder may be active.
| void FMetalCommandEncoder::BeginComputeCommandEncoding | ( | MTL::DispatchType | Type = MTL::DispatchTypeSerial, |
| FMetalCounterSampler * | Sampler = nullptr |
||
| ) |
Begins encoding compute commands into the current command buffer. No other encoder may be active.
| MTLParallelRenderCommandEncoderPtr FMetalCommandEncoder::BeginParallelRenderCommandEncoding | ( | FMetalCounterSampler * | Sampler | ) |
Begins encoding for parallel rendering commands into the current command buffer. No other encoder may be active
| void FMetalCommandEncoder::BeginRenderCommandEncoding | ( | FMetalCounterSampler * | Sampler | ) |
Begins encoding rendering commands into the current command buffer. No other encoder may be active
| void FMetalCommandEncoder::BeginRenderCommandEncoding | ( | MTL::RenderPassDescriptor * | RenderPassDesc, |
| MTLParallelRenderCommandEncoderPtr | ParallelEncoder | ||
| ) |
Begins encoding rendering commands into the parallel render encoder (no command buffer required)
| void FMetalCommandEncoder::EndCommandBuffer | ( | FMetalRHICommandContext * | Context | ) |
Will deprecate in 5.6, splits the command buffer into chunks, required for profiling until we switch to encoder counter buffers
| TRefCountPtr< FMetalFence > FMetalCommandEncoder::EndEncoding | ( | ) |
Declare that all command generation from this encoder is complete, and detach from the MTLCommandBuffer if there is an encoder active or does nothing if there isn't.
| MTL::BlitCommandEncoder * FMetalCommandEncoder::GetBlitCommandEncoder | ( | void | ) |
|
inline |
|
inline |
| MTL::ComputeCommandEncoder * FMetalCommandEncoder::GetComputeCommandEncoder | ( | void | ) |
| TRefCountPtr< FMetalFence > const & FMetalCommandEncoder::GetEncoderFence | ( | void | ) | const |
| MTL::RenderCommandEncoder * FMetalCommandEncoder::GetRenderCommandEncoder | ( | void | ) |
| const MTL::RenderPassDescriptor * FMetalCommandEncoder::GetRenderPassDescriptor | ( | void | ) | const |
| FMetalSubBufferRing & FMetalCommandEncoder::GetRingBuffer | ( | void | ) |
| void FMetalCommandEncoder::InsertDebugSignpost | ( | NS::String * | String | ) |
|
inline |
| void FMetalCommandEncoder::PushDebugGroup | ( | NS::String * | String | ) |
| void FMetalCommandEncoder::SetBlendColor | ( | float const | Red, |
| float const | Green, | ||
| float const | Blue, | ||
| float const | Alpha | ||
| ) |
| void FMetalCommandEncoder::SetComputePipelineState | ( | FMetalShaderPipelinePtr | State | ) |
| void FMetalCommandEncoder::SetCullMode | ( | MTL::CullMode const | CullMode | ) |
| void FMetalCommandEncoder::SetDepthBias | ( | float const | DepthBias, |
| float const | SlopeScale, | ||
| float const | Clamp | ||
| ) |
| void FMetalCommandEncoder::SetDepthClipMode | ( | MTL::DepthClipMode | DepthClipMode | ) |
| void FMetalCommandEncoder::SetDepthStencilState | ( | MTL::DepthStencilState * | DepthStencilState | ) |
| void FMetalCommandEncoder::SetFrontFacingWinding | ( | MTL::Winding const | FrontFacingWinding | ) |
| void FMetalCommandEncoder::SetRenderPassDescriptor | ( | MTL::RenderPassDescriptor * | RenderPass | ) |
Set the render pass descriptor - no encoder may be active when this function is called.
| RenderPass | The render pass descriptor to set. May be nullptr. |
| void FMetalCommandEncoder::SetRenderPassStoreActions | ( | MTL::StoreAction const *const | ColorStore, |
| MTL::StoreAction const | DepthStore, | ||
| MTL::StoreAction const | StencilStore | ||
| ) |
Set the render pass store actions, call after SetRenderPassDescriptor but before EndEncoding.
| ColorStore | The store actions for color targets. |
| DepthStore | The store actions for the depth buffer - use MTL::StoreActionUnknown if no depth-buffer bound. |
| StencilStore | The store actions for the stencil buffer - use MTL::StoreActionUnknown if no stencil-buffer bound. |
| void FMetalCommandEncoder::SetRenderPipelineState | ( | FMetalShaderPipeline *const | PipelineState | ) |
| void FMetalCommandEncoder::SetShaderBuffer | ( | MTL::FunctionType const | FunctionType, |
| FMetalBufferPtr | Buffer, | ||
| NS::UInteger const | Offset, | ||
| NS::UInteger const | Length, | ||
| NS::UInteger const | Index, | ||
| MTL::ResourceUsage const | Usage, | ||
| EPixelFormat const | Format = PF_Unknown, |
||
| NS::UInteger const | ElementRowPitch = 0, |
||
| TArray< TTuple< MTL::Resource *, MTL::ResourceUsage > > | ReferencedResources = {} |
||
| ) |
| void FMetalCommandEncoder::SetShaderBytes | ( | MTL::FunctionType const | FunctionType, |
| uint8 const * | Bytes, | ||
| NS::UInteger const | Length, | ||
| NS::UInteger const | Index | ||
| ) |
| void FMetalCommandEncoder::SetShaderData | ( | MTL::FunctionType const | FunctionType, |
| FMetalBufferData * | Data, | ||
| NS::UInteger const | Offset, | ||
| NS::UInteger const | Index, | ||
| EPixelFormat const | Format = PF_Unknown, |
||
| NS::UInteger const | ElementRowPitch = 0 |
||
| ) |
| void FMetalCommandEncoder::SetShaderSamplerState | ( | MTL::FunctionType const | FunctionType, |
| MTL::SamplerState * | Sampler, | ||
| NS::UInteger const | Index | ||
| ) |
| void FMetalCommandEncoder::SetShaderSideTable | ( | MTL::FunctionType const | FunctionType, |
| NS::UInteger const | Index | ||
| ) |
| void FMetalCommandEncoder::SetShaderTexture | ( | MTL::FunctionType const | FunctionType, |
| MTL::Texture * | Texture, | ||
| NS::UInteger const | Index, | ||
| MTL::ResourceUsage const | Usage | ||
| ) |
| void FMetalCommandEncoder::SetTriangleFillMode | ( | MTL::TriangleFillMode const | FillMode | ) |
| void FMetalCommandEncoder::SetVisibilityResultMode | ( | MTL::VisibilityResultMode const | Mode, |
| NS::UInteger const | Offset | ||
| ) |
| void FMetalCommandEncoder::SignalEvent | ( | MTLEventPtr | Event, |
| uint32_t | SignalCount | ||
| ) |
Update the event to capture all GPU work so far enqueued by this encoder.
Start encoding to CommandBuffer. It is an error to call this with any outstanding command encoders or current command buffer. Instead call EndEncoding & CommitCommandBuffer before calling this.
| void FMetalCommandEncoder::TransitionResources | ( | MTL::Resource * | Resource | ) |
| void FMetalCommandEncoder::UpdateFence | ( | FMetalFence * | Fence | ) |
Update the event to capture all GPU work so far enqueued by this encoder.
| void FMetalCommandEncoder::UseHeaps | ( | TArray< MTL::Heap * > const & | Heaps, |
| const MTL::FunctionType | Function | ||
| ) |
| void FMetalCommandEncoder::UseIndirectArgumentResource | ( | FMetalBufferPtr | Buffer, |
| MTL::ResourceUsage const | Usage | ||
| ) |
| void FMetalCommandEncoder::UseIndirectArgumentResource | ( | MTL::Texture * | Texture, |
| MTL::ResourceUsage const | Usage | ||
| ) |
| void FMetalCommandEncoder::UseResource | ( | MTL::Resource * | Resource, |
| MTL::ResourceUsage const | Usage | ||
| ) |
| void FMetalCommandEncoder::UseResources | ( | TArray< MTL::Resource * > const & | Resources, |
| MTL::ResourceUsage const | Usage, | ||
| MTL::RenderStages | RenderStages = 0 |
||
| ) |
| void FMetalCommandEncoder::WaitForEvent | ( | MTLEventPtr | Event, |
| uint32_t | SignalCount | ||
| ) |
Prevent further GPU work until the event is reached.
| void FMetalCommandEncoder::WaitForFence | ( | FMetalFence * | Fence | ) |
Prevent further GPU work until the event is reached.