MTL4CommandEncoder

Trait MTL4CommandEncoder 

Source
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 { ... }
}
Available on crate feature MTL4CommandEncoder only.
Expand description

An encoder that writes GPU commands into a command buffer.

See also Apple’s documentation

Provided Methods§

Source

fn label(&self) -> Option<Retained<NSString>>
where Self: Sized + Message,

Provides an optional label to assign to the command encoder for debug purposes.

Source

fn setLabel(&self, label: Option<&NSString>)
where Self: Sized + Message,

Setter for label.

This is copied when set.

Source

fn commandBuffer( &self, ) -> Option<Retained<ProtocolObject<dyn MTL4CommandBuffer>>>
where Self: Sized + Message,

Available on crate feature MTL4CommandBuffer only.

Returns the command buffer that is currently encoding commands.

This property may return undefined results if you call it after calling endEncoding.

Source

fn barrierAfterQueueStages_beforeStages_visibilityOptions( &self, after_queue_stages: MTLStages, before_stages: MTLStages, visibility_options: MTL4VisibilityOptions, )
where Self: Sized + Message,

Available on crate feature 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: MTLStages mask 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: MTLStages mask that represents the stages of work that wait. This argument applies to work you encode in the current command encoder.
  • visibilityOptions: MTL4VisibilityOptions of the barrier.
Source

fn barrierAfterStages_beforeQueueStages_visibilityOptions( &self, after_stages: MTLStages, before_queue_stages: MTLStages, visibility_options: MTL4VisibilityOptions, )
where Self: Sized + Message,

Available on crate feature 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: MTLStages mask 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: MTLStages mask 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: MTL4VisibilityOptions of the barrier, controlling cache flush behavior.
Source

fn barrierAfterEncoderStages_beforeEncoderStages_visibilityOptions( &self, after_encoder_stages: MTLStages, before_encoder_stages: MTLStages, visibility_options: MTL4VisibilityOptions, )
where Self: Sized + Message,

Available on crate feature 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: MTLStages mask that represents the stages of work to wait for. This argument only applies to subsequent work you encode in the current command encoder.
  • beforeEncoderStages: MTLStages mask 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: MTL4VisibilityOptions of the barrier, controlling cache flush behavior.
Source

fn updateFence_afterEncoderStages( &self, fence: &ProtocolObject<dyn MTLFence>, after_encoder_stages: MTLStages, )
where Self: Sized + Message,

Available on crate features 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: MTLFence instance to update.
  • afterEncoderStages: MTLStages value that represents the stages of work to wait for. This argument only applies to work encoded in the current command encoder.
Source

fn waitForFence_beforeEncoderStages( &self, fence: &ProtocolObject<dyn MTLFence>, before_encoder_stages: MTLStages, )
where Self: Sized + Message,

Available on crate features 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: MTLFence instance to wait for.
  • beforeEncoderStages:MTLStages value that represents the stages of work that wait. This argument only applies to work you encode in the current command encoder.
Source

fn insertDebugSignpost(&self, string: &NSString)
where Self: Sized + Message,

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.
Source

fn pushDebugGroup(&self, string: &NSString)
where Self: Sized + Message,

Pushes a string onto this encoder’s stack of debug groups.

  • Parameter string: The debug string to push.
Source

fn popDebugGroup(&self)
where Self: Sized + Message,

Pops the latest debug group string from this encoder’s stack of debug groups.

Source

fn endEncoding(&self)
where Self: Sized + Message,

Declares that all command generation from this encoder is complete.

Trait Implementations§

Source§

impl ProtocolType for dyn MTL4CommandEncoder

Source§

const NAME: &'static str = "MTL4CommandEncoder"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn MTL4CommandEncoder

Implementations on Foreign Types§

Source§

impl<T> MTL4CommandEncoder for ProtocolObject<T>

Implementors§