From b84e8824b80a8d6aaae7b2c81a83645e0f71c1f4 Mon Sep 17 00:00:00 2001 From: Birh Burh Date: Thu, 19 Sep 2024 15:26:37 +0200 Subject: [PATCH] Using primitive_type in metal also now --- src/graphics/metal.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/graphics/metal.rs b/src/graphics/metal.rs index 7d2b851b..f3657b6f 100644 --- a/src/graphics/metal.rs +++ b/src/graphics/metal.rs @@ -233,7 +233,7 @@ struct PipelineInternal { //layout: Vec, //attributes: Vec, _shader: ShaderId, - //params: PipelineParams, + params: PipelineParams, } #[derive(Clone, Copy)] @@ -1018,7 +1018,7 @@ impl RenderingBackend for MetalContext { //layout: buffer_layout.to_vec(), //attributes: vertex_layout, _shader: shader, - //params, + params, }; self.pipelines.push(pipeline); @@ -1232,10 +1232,12 @@ impl RenderingBackend for MetalContext { let render_encoder = self.render_encoder.unwrap(); assert!(self.index_buffer.is_some()); let index_buffer = self.index_buffer.unwrap(); + let pip = &self.pipelines[self.current_pipeline.unwrap().0]; + let primitive_type: MTLPrimitiveType = pip.params.primitive_type.into(); assert!(base_element == 0); // TODO: figure indexBufferOffset/baseVertex unsafe { - msg_send_![render_encoder, drawIndexedPrimitives:MTLPrimitiveType::Triangle + msg_send_![render_encoder, drawIndexedPrimitives:primitive_type indexCount:num_elements as u64 indexType:MTLIndexType::UInt16 indexBuffer:index_buffer