Skip to main content

RenderCmdEncoder

Struct RenderCmdEncoder 

Source
pub struct RenderCmdEncoder(/* private fields */);
Expand description

An interface that encodes a render pass into a command buffer, including all its draw calls and configuration.

Implementations§

Source§

impl RenderCmdEncoder

Source

pub fn retained(&self) -> R<Self>

Source§

impl RenderCmdEncoder

Source

pub fn use_heap(&mut self, heap: &Heap)

Source

pub fn set_render_ps(&mut self, val: &RenderPipelineState)

Source

pub fn set_vp(&mut self, val: Viewport)

Source

pub fn set_vp_rect<F: Into<f64>>(&mut self, x: F, y: F, width: F, height: F)

Source

pub fn set_vps_count(&mut self, val: *const Viewport, count: usize)

Source

pub fn set_vps(&mut self, val: &[Viewport])

Specifies an array of viewports, which are used to transform vertices from normalized device coordinates to window coordinates based on [[ viewport_array_index ]] value specified in the vertex shader.

Source

pub fn set_scissor_rect(&mut self, val: ScissorRect)

An mtl::ScissorRect instance that represents a rectangle that needs to lie completely within the current render attachment.

Specifies a rectangle for a fragment scissor test. All fragments outside of this rectangle are discarded.

Source

pub fn set_scissor_rects_count(&mut self, val: *const ScissorRect, count: usize)

Source

pub fn set_scissor_rects(&mut self, val: &[ScissorRect])

Specifies an array of rectangles for a fragment scissor test. The specific rectangle used is based on the [[ viewport_array_index ]] value output by the vertex shader. Fragments that lie outside the scissor rectangle are discarded.

Source

pub fn set_triangle_fill_mode(&mut self, val: TriangleFillMode)

Source

pub fn set_ffw(&mut self, val: Winding)

Source

pub fn set_cull_mode(&mut self, val: CullMode)

Source

pub fn set_depth_stencil_state(&mut self, val: Option<&DepthStencilState>)

Source

pub fn set_stencil_reference_value(&mut self, val: u32)

Source

pub fn set_stencil_front_back_reference_values( &mut self, front_reference_val: u32, back_reference_val: u32, )

Source

pub fn set_visibility_result_mode( &mut self, val: VisibilityResultMode, offset: usize, )

Source

pub fn set_color_store_action_at(&mut self, val: StoreAction, index: usize)

Source

pub fn set_depth_store_action(&mut self, val: StoreAction)

Source

pub fn set_stencil_store_action(&mut self, val: StoreAction)

Source

pub fn copy_bytes_to_vertex_at( &mut self, bytes: *const u8, length: UInteger, binding_index: UInteger, )

Source

pub fn copy_slice_to_vertex_at<T>(&mut self, slice: &[T], index: usize)

Source

pub fn copy_to_vertex_at<T>(&mut self, val: &T, index: usize)

Source

pub fn set_vertex_buf_at( &mut self, buf: Option<&Buf>, offset: usize, index: usize, )

Source

pub fn use_resource( &mut self, resources: &Res, usage: ResUsage, stages: RenderStages, )

Source

pub unsafe fn use_resources_count( &mut self, resources: *const &Res, count: usize, usage: ResUsage, stages: RenderStages, )

Source

pub fn use_resources( &mut self, resources: &[&Res], usage: ResUsage, stages: RenderStages, )

Declare that an array of resources may be accessed through an argument buffer by the render pass

For hazard tracked resources, this method protects against data hazards. This method must be called before encoding any draw commands which may access the resources through an argument buffer. However, this method may cause color attachments to become decompressed. Therefore, this method should be called until as late as possible within a render command encoder. Declaring a minimal usage (i.e. read-only) may prevent color attachments from becoming decompressed on some devices.

Note that calling use_resources() does not retain the resources. It is the responsiblity of the user to retain the resources until the command buffer has been executed.

Source

pub fn set_vertex_buf_offset_at(&mut self, offset: usize, index: usize)

Set the offset within the current global buffer for all vertex shaders at the given bind point index.

Call this method to change the offset you specified when binding a single buffer with the set_vertex_buf_at method or multiple buffers with the setVertexBuffers:offsets:withRange: method. You can also use this method to specify a data offset after binding data directly to the vertex shader with the setVertexBytes:length:atIndex: method. Don’t rebind a buffer or block of data if you’re only updating its offset.

For buffers in the device address space, align the offset to the data type consumed by the vertex shader (which is always less than or equal to 16 bytes).

For buffers in the constant address space, align the offset to 256 bytes in macOS. In iOS, align the offset to the maximum of either the data type consumed by the vertex shader, or 4 bytes. A 16-byte alignment is safe in iOS if you don’t need to consider the data type.

§Arguments:
  • offset - Where the data begins, in bytes, from the start of the buffer.
  • index - The index in the buffer argument table.
Source

pub fn set_vertex_bufs_offsets_with_range( &mut self, bufs: *const &Buf, offsets: *const usize, range: Range, )

Source

pub fn set_vertex_bufs<const N: usize>(&mut self, bufs: &[&Buf; N])

Source

pub fn set_vertex_sampler_state_at( &mut self, sampler: Option<&SamplerState>, at_index: usize, )

Set a global sampler for all vertex shaders at the given bind point index.

Source

pub fn set_fragment_buf_at( &mut self, buf: Option<&Buf>, offset: usize, at_index: usize, )

Set a global buffer for all fragment shaders at the given bind point index.

Source

pub fn copy_bytes_to_fragment_at( &mut self, bytes: *const u8, len: usize, at_index: usize, )

Source

pub fn copy_slice_to_fragment_at<T>(&mut self, slice: &[T], at_index: usize)

Source

pub fn copy_to_fragment_at<T>(&mut self, val: &T, index: usize)

Source

pub fn set_fragment_texture_at(&mut self, val: Option<&Texture>, index: usize)

Set a global texture for all fragment shaders at the given bind point index.

Source

pub fn set_fragment_textures_with_range( &mut self, ptr: *const Option<&Texture>, range: Range, )

Source

pub fn set_fragment_textures_with_array<const N: usize>( &mut self, arr: &[Option<&Texture>; N], )

Source

pub fn set_fragment_textures_with_slice(&mut self, slice: &[Option<&Texture>])

Source

pub fn draw_primitives( &mut self, primitive_type: Primitive, vertex_start: usize, vertex_count: usize, )

Source

pub fn draw_primitives_instance_count( &mut self, primitive_type: Primitive, vertex_start: usize, vertex_count: usize, instance_count: usize, )

Source

pub fn draw_indexed_primitives_instance_count( &mut self, primitive_type: Primitive, index_count: usize, index_type: IndexType, index_buffer: &Buf, index_buffer_offset: usize, instance_count: usize, )

Source

pub fn draw_indexed_primitives_index_type_index_count_instance_count( &mut self, primitive_type: Primitive, index_count: usize, index_type: IndexType, index_buf: &Buf, index_buf_offset: usize, inst_count: usize, base_vertex: isize, base_instance: usize, )

Source

pub fn draw_indexed_triangles_u16( &mut self, index_buf: &Buf, index_range: &Range<usize>, inst_range: &Range<usize>, )

Source

pub fn draw_indexed_triangles_u32( &mut self, index_buf: &Buf, index_range: &Range<usize>, instance_range: &Range<usize>, )

Source

pub fn draw_indexed_primitives( &mut self, primitive_type: Primitive, index_count: usize, index_type: IndexType, index_buf: &Buf, index_buf_offset: usize, )

Source

pub fn update_fence_after_stages(&self, fence: &Fence, stages: RenderStages)

Source

pub fn wait_fence_before_stages(&self, fence: &Fence, stages: RenderStages)

Source

pub fn dispatch_threads_per_tile(&self, val: Size)

Source

pub fn sel_dispatch_threads_per_tile() -> &'static Sel

@selector(dispatchThreadsPerTile:) but dynamic use this function to check if object responds to selector

Source

pub fn tile_width(&self) -> usize

Source

pub fn sel_tile_width() -> &'static Sel

@selector(tileWidth) but dynamic use this function to check if object responds to selector

Source

pub fn tile_height(&self) -> usize

Source

pub fn sel_tile_height() -> &'static Sel

@selector(tileHeight) but dynamic use this function to check if object responds to selector

Source

pub fn copy_bytes_to_tile_at( &mut self, bytes: *const c_void, len: UInteger, at_index: UInteger, )

Set the data (by copy) for a given tile buffer binding point. This will remove any existing mtl::Buffer from the binding point.

The method is equivalent to creating an mtl::Buffer instance that contains the same data as bytes and calling the set_tile_buf_at method. However, this method avoids the overhead of creating a buffer to store your data; instead, Metal manages the data.

Important:

Only call this method for single-use data that’s smaller than 4 KB.

Source

pub fn sel_copy_bytes_to_tile_at() -> &'static Sel

@selector(setTileBytes:length:atIndex:) but dynamic use this function to check if object responds to selector

Source

pub fn copy_slice_to_tile_at<T>(&mut self, slice: &[T], index: usize)

§Availability

macos_11_0, ios_11_0, tvos_14_5, maccatalyst_14_0

Source

pub fn copy_to_tile_at<T>(&mut self, val: &T, index: usize)

§Availability

macos_11_0, ios_11_0, tvos_14_5, maccatalyst_14_0

Source

pub fn set_tile_buf_at( &mut self, buf: Option<&Buf>, offset: usize, index: usize, )

Source

pub fn sel_set_tile_buf_at() -> &'static Sel

@selector(setTileBuffer:offset:atIndex:) but dynamic use this function to check if object responds to selector

Source

pub fn set_tile_texture_at(&mut self, texture: Option<&Texture>, index: usize)

Source

pub fn sel_set_tile_texture_at() -> &'static Sel

@selector(setTileTexture:atIndex:) but dynamic use this function to check if object responds to selector

Source

pub fn set_tile_textures_with_range( &mut self, ptr: *const Option<&Texture>, range: Range, )

Source

pub fn sel_set_tile_textures_with_range() -> &'static Sel

@selector(setTileTextures:withRange:) but dynamic use this function to check if object responds to selector

Source

pub fn set_tile_textures_with_slice(&mut self, textures: &[Option<&Texture>])

§Availability

macos_11_0, ios_11_0, tvos_14_5, maccatalyst_14_0

Source

pub fn set_tile_textures_with_array<const N: usize>( &mut self, textures: &[Option<&Texture>; N], )

§Availability

macos_11_0, ios_11_0, tvos_14_5, maccatalyst_14_0

Source

pub fn execute_cmds_in_buf_with_range( &mut self, icb: &IndirectCmdBuf, range: Range, )

Source

pub fn sel_execute_cmds_in_buf_with_range() -> &'static Sel

@selector(executeCommandsInBuffer:withRange:) but dynamic use this function to check if object responds to selector

Source

pub fn execute_cmds_in_buf(&mut self, icb: &IndirectCmdBuf, range: Range<usize>)

§Availability

macos_10_14, ios_12_0

Methods from Deref<Target = CmdEncoder>§

Source

pub fn retained(&self) -> R<Self>

Source

pub fn set_label(&mut self, val: Option<&String>)

Source

pub fn push_debug_group(&mut self, debug_group: &String)

Source

pub fn pop_debug_group(&mut self)

Source

pub fn device_ar(&self) -> Rar<Device>

Source

pub fn device(&self) -> R<Device>

Source

pub fn label_ar(&self) -> Option<Rar<String>>

Source

pub fn label(&self) -> Option<R<String>>

Source

pub unsafe fn end_encoding(&mut self)

Declares that all command generation from the encoder is completed.

After endEncoding is called, the command encoder has no further use. You cannot encode any other commands with this encoder.

§Safety

Use end() function instead

Source

pub fn insert_debug_signpost(&mut self, signpost: &String)

Methods from Deref<Target = Id>§

Source

pub unsafe fn value_for_key_throws_ar(&self, key: &String) -> Option<Rar<Self>>

Source

pub unsafe fn value_for_key_throws(&self, key: &String) -> Option<R<Self>>

Source

pub fn value_for_key<'ear>( &self, key: &String, ) -> ExResult<'ear, Option<R<Self>>>

Source

pub unsafe fn set_value_for_key_throws( &mut self, val: Option<&Self>, key: &String, )

Source

pub fn set_value_for_key<'ear>( &mut self, val: Option<&Self>, key: &String, ) -> ExResult<'ear>

Source

pub unsafe fn value_for_key_path_throws_ar( &self, key_path: &String, ) -> Option<Rar<Self>>

Source

pub unsafe fn value_for_key_path_throws( &self, key_path: &String, ) -> Option<R<Self>>

Source

pub fn value_for_key_path<'ear>( &self, key_path: &String, ) -> ExResult<'ear, Option<R<Self>>>

Source

pub unsafe fn set_value_for_key_path_throws( &mut self, val: Option<&Self>, key_path: &String, )

Source

pub fn set_value_for_key_path<'ear>( &mut self, val: Option<&Self>, key_path: &String, ) -> ExResult<'ear>

Source

pub fn as_type_ref(&self) -> &Type

Source

pub fn as_id_ref(&self) -> &Self

Source

pub fn is_equal(&self, other: &Self) -> bool

Source

pub fn hash(&self) -> UInteger

Source

pub fn as_ptr(&self) -> *const Self

Trait Implementations§

Source§

impl AsRef<Id> for RenderCmdEncoder

Source§

fn as_ref(&self) -> &Id

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for RenderCmdEncoder

Source§

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

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

impl Deref for RenderCmdEncoder

Source§

type Target = CmdEncoder

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for RenderCmdEncoder

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Obj for RenderCmdEncoder

Source§

unsafe fn retain(id: &Self) -> R<Self>

Source§

unsafe fn release(id: &mut Self)

Source§

fn desc_ar(&self) -> Rar<String>

Source§

fn desc(&self) -> R<String>

Source§

fn debug_desc_ar(&self) -> Rar<String>

Source§

fn debug_desc(&self) -> R<String>

Source§

fn responds_to_sel(&self, sel: &Sel) -> bool

Source§

fn class(&self) -> &Class<Self>

Source§

fn is_kind_of_class<T: Obj>(&self, cls: &Class<T>) -> bool

Source§

fn try_cast<T: Obj>(&self, cls: &Class<T>) -> Option<&T>

Source§

fn try_cast_mut<T: Obj>(&mut self, cls: &Class<T>) -> Option<&mut T>

Source§

fn is_member_of_class<T: Obj>(&self, cls: &Class<T>) -> bool

Source§

fn is_tagged_ptr(&self) -> bool

Source§

fn as_id_ref(&self) -> &Id

Source§

impl PartialEq for RenderCmdEncoder

Source§

fn eq(&self, other: &RenderCmdEncoder) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Retained<RenderCmdEncoder>> for RenderCmdEncoder

Source§

fn eq(&self, other: &R<RenderCmdEncoder>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RenderCmdEncoder

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Release for T
where T: Obj,

Source§

unsafe fn release(&mut self)

Source§

impl<T> Retain for T
where T: Obj,

Source§

fn retained(&self) -> Retained<T>

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.