pub unsafe trait MTL4CommandEncoder: NSObjectProtocol {
// Provided methods
fn label(&self) -> Option<Retained<NSString>>
where Self: Sized + Message { ... }
fn setLabel(&self, label: Option<&NSString>)
where Self: Sized + Message { ... }
fn commandBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTL4CommandBuffer>>>
where Self: Sized + Message { ... }
fn barrierAfterQueueStages_beforeStages_visibilityOptions(
&self,
after_queue_stages: MTLStages,
before_stages: MTLStages,
visibility_options: MTL4VisibilityOptions,
)
where Self: Sized + Message { ... }
fn barrierAfterStages_beforeQueueStages_visibilityOptions(
&self,
after_stages: MTLStages,
before_queue_stages: MTLStages,
visibility_options: MTL4VisibilityOptions,
)
where Self: Sized + Message { ... }
fn barrierAfterEncoderStages_beforeEncoderStages_visibilityOptions(
&self,
after_encoder_stages: MTLStages,
before_encoder_stages: MTLStages,
visibility_options: MTL4VisibilityOptions,
)
where Self: Sized + Message { ... }
fn updateFence_afterEncoderStages(
&self,
fence: &ProtocolObject<dyn MTLFence>,
after_encoder_stages: MTLStages,
)
where Self: Sized + Message { ... }
fn waitForFence_beforeEncoderStages(
&self,
fence: &ProtocolObject<dyn MTLFence>,
before_encoder_stages: MTLStages,
)
where Self: Sized + Message { ... }
fn insertDebugSignpost(&self, string: &NSString)
where Self: Sized + Message { ... }
fn pushDebugGroup(&self, string: &NSString)
where Self: Sized + Message { ... }
fn popDebugGroup(&self)
where Self: Sized + Message { ... }
fn endEncoding(&self)
where Self: Sized + Message { ... }
}MTL4CommandEncoder only.Expand description
An encoder that writes GPU commands into a command buffer.
See also Apple’s documentation
Provided Methods§
Sourcefn label(&self) -> Option<Retained<NSString>>
fn label(&self) -> Option<Retained<NSString>>
Provides an optional label to assign to the command encoder for debug purposes.
Sourcefn commandBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTL4CommandBuffer>>>
Available on crate feature MTL4CommandBuffer only.
fn commandBuffer( &self, ) -> Option<Retained<ProtocolObject<dyn MTL4CommandBuffer>>>
MTL4CommandBuffer only.Returns the command buffer that is currently encoding commands.
This property may return undefined results if you call it after calling endEncoding.
Sourcefn barrierAfterQueueStages_beforeStages_visibilityOptions(
&self,
after_queue_stages: MTLStages,
before_stages: MTLStages,
visibility_options: MTL4VisibilityOptions,
)
Available on crate feature MTLCommandEncoder only.
fn barrierAfterQueueStages_beforeStages_visibilityOptions( &self, after_queue_stages: MTLStages, before_stages: MTLStages, visibility_options: MTL4VisibilityOptions, )
MTLCommandEncoder only.Encodes a consumer barrier on work you commit to the same command queue.
Encode a barrier that guarantees that any subsequent work you encode in the current command encoder that corresponds
to the beforeStages stages doesn’t proceed until Metal completes all work prior to the current command encoder
corresponding to the afterQueueStages stages, completes.
Metal can reorder the exact point where it applies the barrier, so encode the barrier as close to the command that consumes the resource as possible. Don’t use this method for synchronizing resource access within the same pass.
If you need to synchronize work within a pass that you encode with an instance of a subclass of MTLCommandEncoder,
use memory barriers instead. For subclasses of MTL4CommandEncoder, use encoder barriers.
You can specify afterQueueStages and beforeStages that contain MTLStages unrelated to the current command
encoder.
- Parameters:
- afterQueueStages:
MTLStagesmask that represents the stages of work to wait for. This argument applies to work corresponding to these stages you encode in prior command encoders, and not for the current encoder. - beforeStages:
MTLStagesmask that represents the stages of work that wait. This argument applies to work you encode in the current command encoder. - visibilityOptions:
MTL4VisibilityOptionsof the barrier.
Sourcefn barrierAfterStages_beforeQueueStages_visibilityOptions(
&self,
after_stages: MTLStages,
before_queue_stages: MTLStages,
visibility_options: MTL4VisibilityOptions,
)
Available on crate feature MTLCommandEncoder only.
fn barrierAfterStages_beforeQueueStages_visibilityOptions( &self, after_stages: MTLStages, before_queue_stages: MTLStages, visibility_options: MTL4VisibilityOptions, )
MTLCommandEncoder only.Encodes a producer barrier on work committed to the same command queue.
This method encodes a barrier that guarantees that any work you encode using subsequent command encoders,
corresponding to beforeQueueStages, don’t begin until all commands you previously encode in the current
encoder (and prior encoders), corresponding to afterStages, complete.
When calling this method, you can pass any MTLStages to parameters afterStages and beforeQueueStages,
even stages that don’t relate to the current or prior command encoders.
- Parameters:
- afterStages:
MTLStagesmask that represents the stages of work to wait for. This argument applies to work corresponding to these stages you encode in the current command encoder prior to this barrier command. - beforeQueueStages:
MTLStagesmask that represents the stages of work that need to wait. This argument applies to subsequent encoders and not to work in the current command encoder. - visibilityOptions:
MTL4VisibilityOptionsof the barrier, controlling cache flush behavior.
Sourcefn barrierAfterEncoderStages_beforeEncoderStages_visibilityOptions(
&self,
after_encoder_stages: MTLStages,
before_encoder_stages: MTLStages,
visibility_options: MTL4VisibilityOptions,
)
Available on crate feature MTLCommandEncoder only.
fn barrierAfterEncoderStages_beforeEncoderStages_visibilityOptions( &self, after_encoder_stages: MTLStages, before_encoder_stages: MTLStages, visibility_options: MTL4VisibilityOptions, )
MTLCommandEncoder only.Encodes an intra-pass barrier.
Encode a barrier that guarantees that any subsequent work you encode in the current command encoder,
corresponding to beforeEncoderStages, doesn’t begin until all prior commands in this command encoder,
corresponding to afterEncoderStages, completes.
When calling this method, it’s your responsibility to ensure parameters afterEncoderStages and beforeEncoderStages
contain a combination of MTLStages for which this encoder can encode commands. For example, for a
MTL4ComputeCommandEncoder instance, you can provide any combination of MTLStages/MTLStageDispatch,
MTLStages/MTLStageBlit and MTLStages/MTLStageAccelerationStructure.
- Parameters:
- afterEncoderStages:
MTLStagesmask that represents the stages of work to wait for. This argument only applies to subsequent work you encode in the current command encoder. - beforeEncoderStages:
MTLStagesmask that represents the stages of work that wait. This argument only applies to work you encode in the current command encoder prior to this barrier. - visibilityOptions:
MTL4VisibilityOptionsof the barrier, controlling cache flush behavior.
Sourcefn updateFence_afterEncoderStages(
&self,
fence: &ProtocolObject<dyn MTLFence>,
after_encoder_stages: MTLStages,
)
Available on crate features MTLCommandEncoder and MTLFence only.
fn updateFence_afterEncoderStages( &self, fence: &ProtocolObject<dyn MTLFence>, after_encoder_stages: MTLStages, )
MTLCommandEncoder and MTLFence only.Encodes a command to update a GPU fence.
This method encodes a command that updates a MTLFence instance after all previously-encoded commands in the
current command encoder, corresponding to afterEncoderStages, complete.
Use parameter afterEncoderStages to pass in a combination of MTLStages for which this encoder can encode work.
For example, for a MTL4ComputeCommandEncoder you can provide any combination of MTLStages/MTLStageDispatch,
MTLStages/MTLStageBlit and MTLStages/MTLStageAccelerationStructure.
- Parameters:
- fence:
MTLFenceinstance to update. - afterEncoderStages:
MTLStagesvalue that represents the stages of work to wait for. This argument only applies to work encoded in the current command encoder.
Sourcefn waitForFence_beforeEncoderStages(
&self,
fence: &ProtocolObject<dyn MTLFence>,
before_encoder_stages: MTLStages,
)
Available on crate features MTLCommandEncoder and MTLFence only.
fn waitForFence_beforeEncoderStages( &self, fence: &ProtocolObject<dyn MTLFence>, before_encoder_stages: MTLStages, )
MTLCommandEncoder and MTLFence only.Encodes a command to wait on a GPU fence.
Encode a command that guarantees that any subsequent work you encode via this current command encoder,
corresponding to beforeEncoderStages, doesn’t begin until all prior updates to the fence is complete.
To successfully wait for a fence update, schedule update and wait operations on the same command queue.
Use parameter beforeEncoderStages to pass in a combination of MTLStages for which this encoder can encode
work. For example, for a MTL4ComputeCommandEncoder you can provide any combination of
MTLStages/MTLStageDispatch, MTLStages/MTLStageBlit and MTLStages/MTLStageAccelerationStructure.
- Parameters:
- fence:
MTLFenceinstance to wait for. - beforeEncoderStages:
MTLStagesvalue that represents the stages of work that wait. This argument only applies to work you encode in the current command encoder.
Sourcefn insertDebugSignpost(&self, string: &NSString)
fn insertDebugSignpost(&self, string: &NSString)
Inserts a debug string into the frame data to aid debugging.
Calling this method doesn’t change any behaviors, but can be useful for debugging purposes.
- Parameter string: The debug string to insert as a signpost.
Sourcefn pushDebugGroup(&self, string: &NSString)
fn pushDebugGroup(&self, string: &NSString)
Pushes a string onto this encoder’s stack of debug groups.
- Parameter string: The debug string to push.
Sourcefn popDebugGroup(&self)
fn popDebugGroup(&self)
Pops the latest debug group string from this encoder’s stack of debug groups.
Sourcefn endEncoding(&self)
fn endEncoding(&self)
Declares that all command generation from this encoder is complete.