From c1094cec9844dd0fb37c8ebebb8ded494b1b808e Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Sat, 25 Feb 2023 00:19:50 -0800 Subject: [PATCH] Add offsets API for the acceleration structure buffers --- src/accelerator_structure.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/accelerator_structure.rs b/src/accelerator_structure.rs index ed1c5ef..b08d674 100644 --- a/src/accelerator_structure.rs +++ b/src/accelerator_structure.rs @@ -118,6 +118,10 @@ impl AccelerationStructureTriangleGeometryDescriptorRef { unsafe { msg_send![self, setIndexBuffer: buffer] } } + pub fn set_index_buffer_offset(&self, offset: NSUInteger) { + unsafe { msg_send![self, setIndexBufferOffset: offset] } + } + pub fn set_index_type(&self, t: MTLIndexType) { unsafe { msg_send![self, setIndexType: t] } } @@ -126,6 +130,10 @@ impl AccelerationStructureTriangleGeometryDescriptorRef { unsafe { msg_send![self, setVertexBuffer: buffer] } } + pub fn set_vertex_buffer_offset(&self, offset: NSUInteger) { + unsafe { msg_send![self, setVertexBufferOffset: offset] } + } + pub fn set_vertex_stride(&self, stride: NSUInteger) { unsafe { msg_send![self, setVertexStride: stride] } } @@ -133,6 +141,18 @@ impl AccelerationStructureTriangleGeometryDescriptorRef { pub fn set_triangle_count(&self, count: NSUInteger) { unsafe { msg_send![self, setTriangleCount: count] } } + + pub fn set_vertex_format(&self, format: MTLVertexFormat) { + unsafe { msg_send![self, setVertexFormat: format] } + } + + pub fn set_transformation_matrix_buffer(&self, buffer: Option<&BufferRef>) { + unsafe { msg_send![self, setTransformationMatrixBuffer: buffer] } + } + + pub fn set_transformation_matrix_buffer_offset(&self, offset: NSUInteger) { + unsafe { msg_send![self, setTransformationMatrixBufferOffset: offset] } + } } pub enum MTLAccelerationStructureBoundingBoxGeometryDescriptor {} @@ -194,6 +214,10 @@ impl InstanceAccelerationStructureDescriptorRef { pub fn set_instance_descriptor_buffer(&self, buffer: &BufferRef) { unsafe { msg_send![self, setInstanceDescriptorBuffer: buffer] } } + + pub fn set_instance_descriptor_buffer_offset(&self, offset: NSUInteger) { + unsafe { msg_send![self, setInstanceDescriptorBufferOffset: offset] } + } } pub enum MTLAccelerationStructureCommandEncoder {}