Skip to content

Commit

Permalink
Add offsets API for the acceleration structure buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Feb 26, 2023
1 parent 5389548 commit 3e8e812
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/accelerator_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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] }
}
Expand All @@ -126,13 +130,29 @@ 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] }
}

pub fn set_triangle_count(&self, count: NSUInteger) {
unsafe { msg_send![self, setTriangleCount: count] }
}

pub fn set_vertex_format(&self, format: MTLAttributeFormat) {
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 {}
Expand Down Expand Up @@ -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 {}
Expand Down

0 comments on commit 3e8e812

Please sign in to comment.