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
impl RenderCmdEncoder
pub fn use_heap(&mut self, heap: &Heap)
pub fn set_render_ps(&mut self, val: &RenderPipelineState)
pub fn set_vp(&mut self, val: Viewport)
pub fn set_vp_rect<F: Into<f64>>(&mut self, x: F, y: F, width: F, height: F)
pub fn set_vps_count(&mut self, val: *const Viewport, count: usize)
Sourcepub fn set_vps(&mut self, val: &[Viewport])
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.
Sourcepub fn set_scissor_rect(&mut self, val: ScissorRect)
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.
pub fn set_scissor_rects_count(&mut self, val: *const ScissorRect, count: usize)
Sourcepub fn set_scissor_rects(&mut self, val: &[ScissorRect])
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.
pub fn set_triangle_fill_mode(&mut self, val: TriangleFillMode)
pub fn set_ffw(&mut self, val: Winding)
pub fn set_cull_mode(&mut self, val: CullMode)
pub fn set_depth_stencil_state(&mut self, val: Option<&DepthStencilState>)
pub fn set_stencil_reference_value(&mut self, val: u32)
pub fn set_stencil_front_back_reference_values( &mut self, front_reference_val: u32, back_reference_val: u32, )
pub fn set_visibility_result_mode( &mut self, val: VisibilityResultMode, offset: usize, )
pub fn set_color_store_action_at(&mut self, val: StoreAction, index: usize)
pub fn set_depth_store_action(&mut self, val: StoreAction)
pub fn set_stencil_store_action(&mut self, val: StoreAction)
pub fn copy_bytes_to_vertex_at( &mut self, bytes: *const u8, length: UInteger, binding_index: UInteger, )
pub fn copy_slice_to_vertex_at<T>(&mut self, slice: &[T], index: usize)
pub fn copy_to_vertex_at<T>(&mut self, val: &T, index: usize)
pub fn set_vertex_buf_at( &mut self, buf: Option<&Buf>, offset: usize, index: usize, )
pub fn use_resource( &mut self, resources: &Res, usage: ResUsage, stages: RenderStages, )
pub unsafe fn use_resources_count( &mut self, resources: *const &Res, count: usize, usage: ResUsage, stages: RenderStages, )
Sourcepub fn use_resources(
&mut self,
resources: &[&Res],
usage: ResUsage,
stages: RenderStages,
)
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.
Sourcepub fn set_vertex_buf_offset_at(&mut self, offset: usize, index: usize)
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.
pub fn set_vertex_bufs_offsets_with_range( &mut self, bufs: *const &Buf, offsets: *const usize, range: Range, )
pub fn set_vertex_bufs<const N: usize>(&mut self, bufs: &[&Buf; N])
Sourcepub fn set_vertex_sampler_state_at(
&mut self,
sampler: Option<&SamplerState>,
at_index: usize,
)
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.
Sourcepub fn set_fragment_buf_at(
&mut self,
buf: Option<&Buf>,
offset: usize,
at_index: usize,
)
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.
pub fn copy_bytes_to_fragment_at( &mut self, bytes: *const u8, len: usize, at_index: usize, )
pub fn copy_slice_to_fragment_at<T>(&mut self, slice: &[T], at_index: usize)
pub fn copy_to_fragment_at<T>(&mut self, val: &T, index: usize)
Sourcepub fn set_fragment_texture_at(&mut self, val: Option<&Texture>, index: usize)
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.
pub fn set_fragment_textures_with_range( &mut self, ptr: *const Option<&Texture>, range: Range, )
pub fn set_fragment_textures_with_array<const N: usize>( &mut self, arr: &[Option<&Texture>; N], )
pub fn set_fragment_textures_with_slice(&mut self, slice: &[Option<&Texture>])
pub fn draw_primitives( &mut self, primitive_type: Primitive, vertex_start: usize, vertex_count: usize, )
pub fn draw_primitives_instance_count( &mut self, primitive_type: Primitive, vertex_start: usize, vertex_count: usize, instance_count: usize, )
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, )
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, )
pub fn draw_indexed_triangles_u16( &mut self, index_buf: &Buf, index_range: &Range<usize>, inst_range: &Range<usize>, )
pub fn draw_indexed_triangles_u32( &mut self, index_buf: &Buf, index_range: &Range<usize>, instance_range: &Range<usize>, )
pub fn draw_indexed_primitives( &mut self, primitive_type: Primitive, index_count: usize, index_type: IndexType, index_buf: &Buf, index_buf_offset: usize, )
pub fn update_fence_after_stages(&self, fence: &Fence, stages: RenderStages)
pub fn wait_fence_before_stages(&self, fence: &Fence, stages: RenderStages)
pub fn dispatch_threads_per_tile(&self, val: Size)
Sourcepub fn sel_dispatch_threads_per_tile() -> &'static Sel
pub fn sel_dispatch_threads_per_tile() -> &'static Sel
@selector(dispatchThreadsPerTile:) but dynamic
use this function to check if object responds to selector
pub fn tile_width(&self) -> usize
Sourcepub fn sel_tile_width() -> &'static Sel
pub fn sel_tile_width() -> &'static Sel
@selector(tileWidth) but dynamic
use this function to check if object responds to selector
pub fn tile_height(&self) -> usize
Sourcepub fn sel_tile_height() -> &'static Sel
pub fn sel_tile_height() -> &'static Sel
@selector(tileHeight) but dynamic
use this function to check if object responds to selector
Sourcepub fn copy_bytes_to_tile_at(
&mut self,
bytes: *const c_void,
len: UInteger,
at_index: UInteger,
)
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.
Sourcepub fn sel_copy_bytes_to_tile_at() -> &'static Sel
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
Sourcepub fn copy_slice_to_tile_at<T>(&mut self, slice: &[T], index: usize)
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
Sourcepub fn copy_to_tile_at<T>(&mut self, val: &T, index: usize)
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
pub fn set_tile_buf_at( &mut self, buf: Option<&Buf>, offset: usize, index: usize, )
Sourcepub fn sel_set_tile_buf_at() -> &'static Sel
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
pub fn set_tile_texture_at(&mut self, texture: Option<&Texture>, index: usize)
Sourcepub fn sel_set_tile_texture_at() -> &'static Sel
pub fn sel_set_tile_texture_at() -> &'static Sel
@selector(setTileTexture:atIndex:) but dynamic
use this function to check if object responds to selector
pub fn set_tile_textures_with_range( &mut self, ptr: *const Option<&Texture>, range: Range, )
Sourcepub fn sel_set_tile_textures_with_range() -> &'static Sel
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
Sourcepub fn set_tile_textures_with_slice(&mut self, textures: &[Option<&Texture>])
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
Sourcepub fn set_tile_textures_with_array<const N: usize>(
&mut self,
textures: &[Option<&Texture>; N],
)
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
pub fn execute_cmds_in_buf_with_range( &mut self, icb: &IndirectCmdBuf, range: Range, )
Sourcepub fn sel_execute_cmds_in_buf_with_range() -> &'static Sel
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
Sourcepub fn execute_cmds_in_buf(&mut self, icb: &IndirectCmdBuf, range: Range<usize>)
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>§
pub fn retained(&self) -> R<Self>
pub fn set_label(&mut self, val: Option<&String>)
pub fn push_debug_group(&mut self, debug_group: &String)
pub fn pop_debug_group(&mut self)
pub fn device_ar(&self) -> Rar<Device>
pub fn device(&self) -> R<Device>
pub fn label_ar(&self) -> Option<Rar<String>>
pub fn label(&self) -> Option<R<String>>
Sourcepub unsafe fn end_encoding(&mut self)
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
pub fn insert_debug_signpost(&mut self, signpost: &String)
Methods from Deref<Target = Id>§
pub unsafe fn value_for_key_throws_ar(&self, key: &String) -> Option<Rar<Self>>
pub unsafe fn value_for_key_throws(&self, key: &String) -> Option<R<Self>>
pub fn value_for_key<'ear>( &self, key: &String, ) -> ExResult<'ear, Option<R<Self>>>
pub unsafe fn set_value_for_key_throws( &mut self, val: Option<&Self>, key: &String, )
pub fn set_value_for_key<'ear>( &mut self, val: Option<&Self>, key: &String, ) -> ExResult<'ear>
pub unsafe fn value_for_key_path_throws_ar( &self, key_path: &String, ) -> Option<Rar<Self>>
pub unsafe fn value_for_key_path_throws( &self, key_path: &String, ) -> Option<R<Self>>
pub fn value_for_key_path<'ear>( &self, key_path: &String, ) -> ExResult<'ear, Option<R<Self>>>
pub unsafe fn set_value_for_key_path_throws( &mut self, val: Option<&Self>, key_path: &String, )
pub fn set_value_for_key_path<'ear>( &mut self, val: Option<&Self>, key_path: &String, ) -> ExResult<'ear>
pub fn as_type_ref(&self) -> &Type
pub fn as_id_ref(&self) -> &Self
pub fn is_equal(&self, other: &Self) -> bool
pub fn hash(&self) -> UInteger
pub fn as_ptr(&self) -> *const Self
Trait Implementations§
Source§impl AsRef<Id> for RenderCmdEncoder
impl AsRef<Id> for RenderCmdEncoder
Source§impl Debug for RenderCmdEncoder
impl Debug for RenderCmdEncoder
Source§impl Deref for RenderCmdEncoder
impl Deref for RenderCmdEncoder
Source§impl DerefMut for RenderCmdEncoder
impl DerefMut for RenderCmdEncoder
Source§impl Obj for RenderCmdEncoder
impl Obj for RenderCmdEncoder
unsafe fn retain(id: &Self) -> R<Self>
unsafe fn release(id: &mut Self)
fn desc_ar(&self) -> Rar<String>
fn desc(&self) -> R<String>
fn debug_desc_ar(&self) -> Rar<String>
fn debug_desc(&self) -> R<String>
fn responds_to_sel(&self, sel: &Sel) -> bool
fn class(&self) -> &Class<Self>
fn is_kind_of_class<T: Obj>(&self, cls: &Class<T>) -> bool
fn try_cast<T: Obj>(&self, cls: &Class<T>) -> Option<&T>
fn try_cast_mut<T: Obj>(&mut self, cls: &Class<T>) -> Option<&mut T>
fn is_member_of_class<T: Obj>(&self, cls: &Class<T>) -> bool
fn is_tagged_ptr(&self) -> bool
fn as_id_ref(&self) -> &Id
Source§impl PartialEq for RenderCmdEncoder
impl PartialEq for RenderCmdEncoder
Source§fn eq(&self, other: &RenderCmdEncoder) -> bool
fn eq(&self, other: &RenderCmdEncoder) -> bool
self and other values to be equal, and is used by ==.