pub struct RenderCommandEncoder(/* private fields */);Expand description
MTL4 render command encoder.
C++ equivalent: MTL4::RenderCommandEncoder
RenderCommandEncoder encodes render commands including draw calls, state changes, and resource bindings.
Implementations§
Source§impl RenderCommandEncoder
impl RenderCommandEncoder
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Create a RenderCommandEncoder from a raw pointer.
Sourcepub fn device(&self) -> Option<Device>
pub fn device(&self) -> Option<Device>
Get the device.
C++ equivalent: MTL::Device* device() const
Sourcepub fn set_label(&self, label: &str)
pub fn set_label(&self, label: &str)
Set the label.
C++ equivalent: void setLabel(const NS::String*)
Sourcepub fn set_render_pipeline_state(&self, pipeline: &RenderPipelineState)
pub fn set_render_pipeline_state(&self, pipeline: &RenderPipelineState)
Set the render pipeline state.
C++ equivalent: void setRenderPipelineState(const MTL::RenderPipelineState*)
Sourcepub fn set_vertex_argument_table(&self, table: *const c_void, index: UInteger)
pub fn set_vertex_argument_table(&self, table: *const c_void, index: UInteger)
Set vertex argument table at index.
C++ equivalent: void setVertexArgumentTable(const MTL4::ArgumentTable*, NS::UInteger)
Sourcepub fn set_fragment_argument_table(&self, table: *const c_void, index: UInteger)
pub fn set_fragment_argument_table(&self, table: *const c_void, index: UInteger)
Set fragment argument table at index.
C++ equivalent: void setFragmentArgumentTable(const MTL4::ArgumentTable*, NS::UInteger)
Sourcepub fn set_tile_argument_table(&self, table: *const c_void, index: UInteger)
pub fn set_tile_argument_table(&self, table: *const c_void, index: UInteger)
Set tile argument table at index.
C++ equivalent: void setTileArgumentTable(const MTL4::ArgumentTable*, NS::UInteger)
Sourcepub fn set_object_argument_table(&self, table: *const c_void, index: UInteger)
pub fn set_object_argument_table(&self, table: *const c_void, index: UInteger)
Set object argument table at index.
C++ equivalent: void setObjectArgumentTable(const MTL4::ArgumentTable*, NS::UInteger)
Sourcepub fn set_mesh_argument_table(&self, table: *const c_void, index: UInteger)
pub fn set_mesh_argument_table(&self, table: *const c_void, index: UInteger)
Set mesh argument table at index.
C++ equivalent: void setMeshArgumentTable(const MTL4::ArgumentTable*, NS::UInteger)
Sourcepub fn set_vertex_buffer(
&self,
buffer: *const c_void,
offset: UInteger,
index: UInteger,
)
pub fn set_vertex_buffer( &self, buffer: *const c_void, offset: UInteger, index: UInteger, )
Set vertex buffer at index.
C++ equivalent: void setVertexBuffer(const MTL::Buffer*, NS::UInteger, NS::UInteger)
Sourcepub fn set_vertex_bytes(
&self,
bytes: *const c_void,
length: UInteger,
index: UInteger,
)
pub fn set_vertex_bytes( &self, bytes: *const c_void, length: UInteger, index: UInteger, )
Set vertex bytes at index.
C++ equivalent: void setVertexBytes(const void*, NS::UInteger, NS::UInteger)
Sourcepub fn set_vertex_texture(&self, texture: *const c_void, index: UInteger)
pub fn set_vertex_texture(&self, texture: *const c_void, index: UInteger)
Set vertex texture at index.
C++ equivalent: void setVertexTexture(const MTL::Texture*, NS::UInteger)
Sourcepub fn set_vertex_sampler_state(&self, sampler: *const c_void, index: UInteger)
pub fn set_vertex_sampler_state(&self, sampler: *const c_void, index: UInteger)
Set vertex sampler state at index.
C++ equivalent: void setVertexSamplerState(const MTL::SamplerState*, NS::UInteger)
Sourcepub fn set_fragment_buffer(
&self,
buffer: *const c_void,
offset: UInteger,
index: UInteger,
)
pub fn set_fragment_buffer( &self, buffer: *const c_void, offset: UInteger, index: UInteger, )
Set fragment buffer at index.
C++ equivalent: void setFragmentBuffer(const MTL::Buffer*, NS::UInteger, NS::UInteger)
Sourcepub fn set_fragment_bytes(
&self,
bytes: *const c_void,
length: UInteger,
index: UInteger,
)
pub fn set_fragment_bytes( &self, bytes: *const c_void, length: UInteger, index: UInteger, )
Set fragment bytes at index.
C++ equivalent: void setFragmentBytes(const void*, NS::UInteger, NS::UInteger)
Sourcepub fn set_fragment_texture(&self, texture: *const c_void, index: UInteger)
pub fn set_fragment_texture(&self, texture: *const c_void, index: UInteger)
Set fragment texture at index.
C++ equivalent: void setFragmentTexture(const MTL::Texture*, NS::UInteger)
Sourcepub fn set_fragment_sampler_state(
&self,
sampler: *const c_void,
index: UInteger,
)
pub fn set_fragment_sampler_state( &self, sampler: *const c_void, index: UInteger, )
Set fragment sampler state at index.
C++ equivalent: void setFragmentSamplerState(const MTL::SamplerState*, NS::UInteger)
Sourcepub fn set_tile_buffer(
&self,
buffer: *const c_void,
offset: UInteger,
index: UInteger,
)
pub fn set_tile_buffer( &self, buffer: *const c_void, offset: UInteger, index: UInteger, )
Set tile buffer at index.
C++ equivalent: void setTileBuffer(const MTL::Buffer*, NS::UInteger, NS::UInteger)
Sourcepub fn set_tile_bytes(
&self,
bytes: *const c_void,
length: UInteger,
index: UInteger,
)
pub fn set_tile_bytes( &self, bytes: *const c_void, length: UInteger, index: UInteger, )
Set tile bytes at index.
C++ equivalent: void setTileBytes(const void*, NS::UInteger, NS::UInteger)
Sourcepub fn set_tile_texture(&self, texture: *const c_void, index: UInteger)
pub fn set_tile_texture(&self, texture: *const c_void, index: UInteger)
Set tile texture at index.
C++ equivalent: void setTileTexture(const MTL::Texture*, NS::UInteger)
Sourcepub fn set_tile_sampler_state(&self, sampler: *const c_void, index: UInteger)
pub fn set_tile_sampler_state(&self, sampler: *const c_void, index: UInteger)
Set tile sampler state at index.
C++ equivalent: void setTileSamplerState(const MTL::SamplerState*, NS::UInteger)
Sourcepub fn set_viewport(&self, viewport: Viewport)
pub fn set_viewport(&self, viewport: Viewport)
Set viewport.
C++ equivalent: void setViewport(MTL::Viewport)
Sourcepub fn set_viewports(&self, viewports: *const Viewport, count: UInteger)
pub fn set_viewports(&self, viewports: *const Viewport, count: UInteger)
Set multiple viewports.
C++ equivalent: void setViewports(const MTL::Viewport*, NS::UInteger)
Sourcepub fn set_scissor_rect(&self, rect: ScissorRect)
pub fn set_scissor_rect(&self, rect: ScissorRect)
Set scissor rect.
C++ equivalent: void setScissorRect(MTL::ScissorRect)
Sourcepub fn set_scissor_rects(&self, rects: *const ScissorRect, count: UInteger)
pub fn set_scissor_rects(&self, rects: *const ScissorRect, count: UInteger)
Set multiple scissor rects.
C++ equivalent: void setScissorRects(const MTL::ScissorRect*, NS::UInteger)
Sourcepub fn set_front_facing_winding(&self, winding: Winding)
pub fn set_front_facing_winding(&self, winding: Winding)
Set front facing winding.
C++ equivalent: void setFrontFacingWinding(MTL::Winding)
Sourcepub fn set_cull_mode(&self, mode: CullMode)
pub fn set_cull_mode(&self, mode: CullMode)
Set cull mode.
C++ equivalent: void setCullMode(MTL::CullMode)
Sourcepub fn set_triangle_fill_mode(&self, mode: TriangleFillMode)
pub fn set_triangle_fill_mode(&self, mode: TriangleFillMode)
Set triangle fill mode.
C++ equivalent: void setTriangleFillMode(MTL::TriangleFillMode)
Sourcepub fn set_depth_clip_mode(&self, mode: DepthClipMode)
pub fn set_depth_clip_mode(&self, mode: DepthClipMode)
Set depth clip mode.
C++ equivalent: void setDepthClipMode(MTL::DepthClipMode)
Sourcepub fn set_depth_bias(&self, depth_bias: f32, slope_scale: f32, clamp: f32)
pub fn set_depth_bias(&self, depth_bias: f32, slope_scale: f32, clamp: f32)
Set depth bias.
C++ equivalent: void setDepthBias(float, float, float)
Sourcepub fn set_depth_stencil_state(&self, state: &DepthStencilState)
pub fn set_depth_stencil_state(&self, state: &DepthStencilState)
Set depth stencil state.
C++ equivalent: void setDepthStencilState(const MTL::DepthStencilState*)
Sourcepub fn set_stencil_reference_value(&self, value: u32)
pub fn set_stencil_reference_value(&self, value: u32)
Set stencil reference value.
C++ equivalent: void setStencilReferenceValue(uint32_t)
Sourcepub fn set_stencil_reference_values(&self, front: u32, back: u32)
pub fn set_stencil_reference_values(&self, front: u32, back: u32)
Set front and back stencil reference values.
C++ equivalent: void setStencilReferenceValues(uint32_t, uint32_t)
Sourcepub fn set_blend_color(&self, red: f32, green: f32, blue: f32, alpha: f32)
pub fn set_blend_color(&self, red: f32, green: f32, blue: f32, alpha: f32)
Set blend color.
C++ equivalent: void setBlendColor(float, float, float, float)
Sourcepub fn draw_primitives(
&self,
primitive_type: PrimitiveType,
vertex_start: UInteger,
vertex_count: UInteger,
)
pub fn draw_primitives( &self, primitive_type: PrimitiveType, vertex_start: UInteger, vertex_count: UInteger, )
Draw primitives.
C++ equivalent: void drawPrimitives(MTL::PrimitiveType, NS::UInteger, NS::UInteger)
Sourcepub fn draw_primitives_instanced(
&self,
primitive_type: PrimitiveType,
vertex_start: UInteger,
vertex_count: UInteger,
instance_count: UInteger,
)
pub fn draw_primitives_instanced( &self, primitive_type: PrimitiveType, vertex_start: UInteger, vertex_count: UInteger, instance_count: UInteger, )
Draw primitives with instance count.
C++ equivalent: void drawPrimitives(MTL::PrimitiveType, NS::UInteger, NS::UInteger, NS::UInteger)
Sourcepub fn draw_primitives_instanced_base(
&self,
primitive_type: PrimitiveType,
vertex_start: UInteger,
vertex_count: UInteger,
instance_count: UInteger,
base_instance: UInteger,
)
pub fn draw_primitives_instanced_base( &self, primitive_type: PrimitiveType, vertex_start: UInteger, vertex_count: UInteger, instance_count: UInteger, base_instance: UInteger, )
Draw primitives with instance count and base instance.
C++ equivalent: void drawPrimitives(MTL::PrimitiveType, NS::UInteger, NS::UInteger, NS::UInteger, NS::UInteger)
Sourcepub fn draw_indexed_primitives(
&self,
primitive_type: PrimitiveType,
index_count: UInteger,
index_type: UInteger,
index_buffer: *const c_void,
index_buffer_offset: UInteger,
)
pub fn draw_indexed_primitives( &self, primitive_type: PrimitiveType, index_count: UInteger, index_type: UInteger, index_buffer: *const c_void, index_buffer_offset: UInteger, )
Draw indexed primitives.
C++ equivalent: void drawIndexedPrimitives(...)
Sourcepub fn draw_indexed_primitives_indirect(
&self,
primitive_type: PrimitiveType,
index_type: UInteger,
index_buffer: *const c_void,
index_buffer_offset: UInteger,
indirect_buffer: *const c_void,
indirect_buffer_offset: UInteger,
)
pub fn draw_indexed_primitives_indirect( &self, primitive_type: PrimitiveType, index_type: UInteger, index_buffer: *const c_void, index_buffer_offset: UInteger, indirect_buffer: *const c_void, indirect_buffer_offset: UInteger, )
Draw indexed primitives with indirect buffer.
C++ equivalent: void drawIndexedPrimitives(... indirectBuffer ...)
Sourcepub fn draw_mesh_threadgroups(
&self,
threadgroups_per_grid: Size,
threads_per_object_threadgroup: Size,
threads_per_mesh_threadgroup: Size,
)
pub fn draw_mesh_threadgroups( &self, threadgroups_per_grid: Size, threads_per_object_threadgroup: Size, threads_per_mesh_threadgroup: Size, )
Draw mesh threadgroups.
C++ equivalent: void drawMeshThreadgroups(MTL::Size, MTL::Size, MTL::Size)
Sourcepub fn draw_mesh_threadgroups_indirect(
&self,
indirect_buffer: *const c_void,
indirect_buffer_offset: UInteger,
threads_per_object_threadgroup: Size,
threads_per_mesh_threadgroup: Size,
)
pub fn draw_mesh_threadgroups_indirect( &self, indirect_buffer: *const c_void, indirect_buffer_offset: UInteger, threads_per_object_threadgroup: Size, threads_per_mesh_threadgroup: Size, )
Draw mesh threadgroups with indirect buffer.
C++ equivalent: void drawMeshThreadgroups(const MTL::Buffer*, NS::UInteger, MTL::Size, MTL::Size)
Sourcepub fn draw_mesh_threads(
&self,
threads_per_grid: Size,
threads_per_object_threadgroup: Size,
threads_per_mesh_threadgroup: Size,
)
pub fn draw_mesh_threads( &self, threads_per_grid: Size, threads_per_object_threadgroup: Size, threads_per_mesh_threadgroup: Size, )
Draw mesh threads.
C++ equivalent: void drawMeshThreads(MTL::Size, MTL::Size, MTL::Size)
Sourcepub fn barrier_buffer(
&self,
buffer: *const c_void,
visibility: VisibilityOptions,
)
pub fn barrier_buffer( &self, buffer: *const c_void, visibility: VisibilityOptions, )
Insert a barrier for a buffer.
C++ equivalent: void barrier(const MTL::Buffer*, MTL4::VisibilityOptions)
Sourcepub fn barrier_texture(
&self,
texture: *const c_void,
visibility: VisibilityOptions,
)
pub fn barrier_texture( &self, texture: *const c_void, visibility: VisibilityOptions, )
Insert a barrier for a texture.
C++ equivalent: void barrier(const MTL::Texture*, MTL4::VisibilityOptions)
Sourcepub fn update_fence(&self, fence: *const c_void)
pub fn update_fence(&self, fence: *const c_void)
Update a fence.
C++ equivalent: void updateFence(const MTL::Fence*)
Sourcepub fn wait_for_fence(&self, fence: *const c_void)
pub fn wait_for_fence(&self, fence: *const c_void)
Wait for a fence.
C++ equivalent: void waitForFence(const MTL::Fence*)
Sourcepub fn use_resource(&self, resource: *const c_void, usage: UInteger)
pub fn use_resource(&self, resource: *const c_void, usage: UInteger)
Use resource.
C++ equivalent: void useResource(const MTL::Resource*, MTL::ResourceUsage)
Sourcepub fn use_heap(&self, heap: *const c_void, usage: UInteger)
pub fn use_heap(&self, heap: *const c_void, usage: UInteger)
Use heap.
C++ equivalent: void useHeap(const MTL::Heap*, MTL::ResourceUsage)
Sourcepub fn push_debug_group(&self, name: &str)
pub fn push_debug_group(&self, name: &str)
Push a debug group.
C++ equivalent: void pushDebugGroup(const NS::String*)
Sourcepub fn pop_debug_group(&self)
pub fn pop_debug_group(&self)
Pop a debug group.
C++ equivalent: void popDebugGroup()
Sourcepub fn insert_debug_signpost(&self, name: &str)
pub fn insert_debug_signpost(&self, name: &str)
Insert a debug signpost.
C++ equivalent: void insertDebugSignpost(const NS::String*)
Sourcepub fn write_timestamp(
&self,
granularity: TimestampGranularity,
stage: RenderStages,
counter_heap: *const c_void,
index: UInteger,
)
pub fn write_timestamp( &self, granularity: TimestampGranularity, stage: RenderStages, counter_heap: *const c_void, index: UInteger, )
Write a timestamp to a counter heap.
C++ equivalent: void writeTimestamp(MTL4::TimestampGranularity, MTL::RenderStages, const MTL4::CounterHeap*, NS::UInteger)
Sourcepub fn end_encoding(&self)
pub fn end_encoding(&self)
End encoding.
C++ equivalent: void endEncoding()