diff --git a/src/accelerator_structure.rs b/src/accelerator_structure.rs index 5c8ac4d..cc3c8e6 100644 --- a/src/accelerator_structure.rs +++ b/src/accelerator_structure.rs @@ -345,4 +345,37 @@ impl IntersectionFunctionTableRef { pub fn set_function(&self, function: &FunctionHandleRef, index: NSUInteger) { unsafe { msg_send![self, setFunction: function atIndex: index] } } + + pub fn set_functions(&self, functions: &[&FunctionHandleRef], start_index: NSUInteger) { + unsafe { + msg_send![self, setFunctions: functions.as_ptr() withRange: NSRange { location: start_index, length: functions.len() as _ }] + } + } + + pub fn set_buffer(&self, index: NSUInteger, buffer: Option<&BufferRef>, offset: NSUInteger) { + unsafe { msg_send![self, setBuffer:buffer offset:offset atIndex:index] } + } + + pub fn set_buffers( + &self, + start_index: NSUInteger, + data: &[Option<&BufferRef>], + offsets: &[NSUInteger], + ) { + debug_assert_eq!(offsets.len(), data.len()); + unsafe { + msg_send![self, + setBuffers: data.as_ptr() + offsets: offsets.as_ptr() + withRange: NSRange { + location: start_index, + length: data.len() as _, + } + ] + } + } + + pub fn gpu_resource_id(&self) -> MTLResourceID { + unsafe { msg_send![self, gpuResourceID] } + } } diff --git a/src/pipeline/render.rs b/src/pipeline/render.rs index 5c06546..35af8c6 100644 --- a/src/pipeline/render.rs +++ b/src/pipeline/render.rs @@ -664,6 +664,16 @@ impl RenderPipelineDescriptorRef { unsafe { msg_send![self, setBinaryArchives: ns_array] } } + /// API_AVAILABLE(macos(11.0), ios(14.0)); + pub fn fragment_linked_functions(&self) -> &LinkedFunctionsRef { + unsafe { msg_send![self, fragmentLinkedFunctions] } + } + + /// API_AVAILABLE(macos(11.0), ios(14.0)); + pub fn set_fragment_linked_functions(&self, functions: &LinkedFunctionsRef) { + unsafe { msg_send![self, setFragmentLinkedFunctions: functions] } + } + pub fn reset(&self) { unsafe { msg_send![self, reset] } } @@ -688,6 +698,30 @@ impl RenderPipelineStateRef { crate::nsstring_as_str(label) } } + + /// Only available on (macos(11.0), ios(14.0)) + pub fn new_intersection_function_table_with_descriptor( + &self, + descriptor: &IntersectionFunctionTableDescriptorRef, + stage: MTLRenderStages, + ) -> IntersectionFunctionTable { + unsafe { + msg_send![self, newIntersectionFunctionTableWithDescriptor: descriptor + stage:stage] + } + } + + /// Only available on (macos(11.0), ios(14.0)) + pub fn function_handle_with_function( + &self, + function: &FunctionRef, + stage: MTLRenderStages, + ) -> Option<&FunctionHandleRef> { + unsafe { + msg_send![self, functionHandleWithFunction: function + stage:stage] + } + } } /// See