cp_drawable_render_context

Struct cp_drawable_render_context 

Source
pub struct cp_drawable_render_context { /* private fields */ }
Available on crate feature drawable_render_context only.
Expand description

Implementations§

Source§

impl cp_drawable_render_context

Source

pub unsafe fn draw_mask_on_stencil_attachment( render_context: cp_drawable_render_context_t, command_encoder: &ProtocolObject<dyn MTLRenderCommandEncoder>, value: u8, )

Available on crate feature objc2-metal only.

Store the value parameter in the stencil texture in the pixels that Compositor will display on the screen.

  • Parameters:

  • render_context: The render context to use to present the drawable.

  • command_encoder: The command encoder to use to render the Compositor effects and present the drawable.

  • value: The value to use when updating the stencil texture in the command_encoder.

  • Note: In Full and Mixed immersion style, this will be the full texture.

  • Note: The command encoder used in the render context has the following constraints:

  • stencil texture: should have the same pixel format as cp_layer_renderer_configuration_get_drawable_render_context_stencil_format

  • renderTargetArrayLength: should be the same as the number of views in the drawable.

  • rasterizationRateMap: should be the one provided by the drawable.

  • layer renderer layout: Dedicated and Shared layout is not supported.

  • Note: If the render encoder has multiple color attachments then set supportColorAttachmentMapping to true to avoid Metal API validation errors. This API is not available on simulator; as a workaround, either disable API validation or separate the rendering into multiple render encoders for other color attachments.

  • Note: This function will modify the depth stencil state, the viewports, the vertex amplification count and some of the texture bindings in the render command encoder passed to the function. Make sure to set those values again to the ones expected in your application.

§Safety

render_context must be a valid pointer.

Source

pub unsafe fn end_encoding( render_context: cp_drawable_render_context_t, command_encoder: &ProtocolObject<dyn MTLRenderCommandEncoder>, )

Available on crate feature objc2-metal only.

Finish encoding the render context.

  • Parameters:

  • render_context: The render context to use to present the drawable.

  • command_encoder: The command encoder to use to render the Compositor effects and present the drawable.

  • Note: The ownership of the command encoder is passed to the drawable render context, which will call endEncoding on the command encoder.

  • Note: The command encoder used in the render context has the following constraints:

  • color texture: colorAttachment[0] should contain the color texture provided by the drawable.

  • depth texture: depthAttachment should contain the depth texture provided by the drawable.

  • renderTargetArrayLength: should be the same as the number of views in the drawable.

  • rasterizationRateMap: should be the one provided by the drawable.

  • layer renderer layout: Dedicated and Shared layout is not supported.

  • Note: If the render encoder has multiple color attachments then set supportColorAttachmentMapping to true to avoid Metal API validation errors. This API is not available on simulator; as a workaround, either disable API validation or separate the rendering into multiple render encoders for other color attachments.

§Safety

render_context must be a valid pointer.

Source

pub unsafe fn mtl4_draw_mask_on_stencil_attachment( render_context: cp_drawable_render_context_t, command_encoder: &ProtocolObject<dyn MTL4RenderCommandEncoder>, value: u8, )

Available on crate feature objc2-metal only.

Store the value parameter in the stencil texture in the pixels that Compositor will display on the screen.

  • Parameters:

  • render_context: The render context to use to present the drawable.

  • command_encoder: The command encoder to use to render the Compositor effects and present the drawable.

  • value: The value to use when updating the stencil texture in the command_encoder.

  • Note: In Full and Mixed immersion style, this will be the full texture.

  • Note: The command encoder used in the render context has the following constraints:

  • stencil texture: should have the same pixel format as cp_layer_renderer_configuration_get_drawable_render_context_stencil_format

  • renderTargetArrayLength: should be the same as the number of views in the drawable.

  • rasterizationRateMap: should be the one provided by the drawable.

  • layer renderer layout: Dedicated and Shared layout is not supported.

  • Note: If the render encoder has multiple color attachments then set supportColorAttachmentMapping to true to avoid Metal API validation errors. This API is not available on simulator; as a workaround, either disable API validation or separate the rendering into multiple render encoders for other color attachments.

  • Note: This function will modify the depth stencil state, the viewports, the vertex amplification count and some of the texture bindings in the render command encoder passed to the function. Make sure to set those values again to the ones expected in your application.

§Safety

render_context must be a valid pointer.

Source

pub unsafe fn mtl4_end_encoding( render_context: cp_drawable_render_context_t, command_encoder: &ProtocolObject<dyn MTL4RenderCommandEncoder>, )

Available on crate feature objc2-metal only.

Finish encoding the render context.

  • Parameters:

  • render_context: The render context to use to present the drawable.

  • command_encoder: The command encoder to use to render the Compositor effects and present the drawable.

  • Note: The ownership of the command encoder is passed to the drawable render context, which will call endEncoding on the command encoder.

  • Note: The command encoder used in the render context has the following constraints:

  • color texture: colorAttachment[0] should contain the color texture provided by the drawable.

  • depth texture: depthAttachment should contain the depth texture provided by the drawable.

  • renderTargetArrayLength: should be the same as the number of views in the drawable.

  • rasterizationRateMap: should be the one provided by the drawable.

  • layer renderer layout: Dedicated and Shared layout is not supported.

  • Note: If the render encoder has multiple color attachments then set supportColorAttachmentMapping to true to avoid Metal API validation errors. This API is not available on simulator; as a workaround, either disable API validation or separate the rendering into multiple render encoders for other color attachments.

§Safety

render_context must be a valid pointer.

Trait Implementations§

Source§

impl Debug for cp_drawable_render_context

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl RefEncode for cp_drawable_render_context

Source§

const ENCODING_REF: Encoding

The Objective-C type-encoding for a reference of this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,