diff --git a/src/acceleration_structure.rs b/src/acceleration_structure.rs index 1aa534b..2580fe2 100644 --- a/src/acceleration_structure.rs +++ b/src/acceleration_structure.rs @@ -7,6 +7,16 @@ use super::*; +bitflags::bitflags! { + #[derive(Copy, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] + pub struct MTLAccelerationStructureUsage: usize { + const None = 0; + const Refit = (1 << 0); + const PreferFastBuild = (1 << 1); + const ExtendedLimits = (1 << 2); + } +} + bitflags::bitflags! { #[derive(Copy, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct MTLAccelerationStructureInstanceOptions: u32 { @@ -69,6 +79,12 @@ foreign_obj_type! { type ParentType = NsObject; } +impl AccelerationStructureDescriptorRef { + pub fn set_usage(&self, usage: MTLAccelerationStructureUsage) { + unsafe { msg_send![self, setUsage: usage] } + } +} + pub enum MTLPrimitiveAccelerationStructureDescriptor {} foreign_obj_type! { @@ -123,6 +139,11 @@ impl AccelerationStructureGeometryDescriptorRef { pub fn set_opaque(&self, opaque: bool) { unsafe { msg_send![self, setOpaque: opaque] } } + + pub fn set_allow_duplicate_intersection_function_invocation(&self, allow: bool) { + unsafe { msg_send![self, setAllowDuplicateIntersectionFunctionInvocation: allow] } + } + pub fn set_primitive_data_buffer(&self, buffer: Option<&BufferRef>) { unsafe { msg_send![self, setPrimitiveDataBuffer: buffer] } } diff --git a/src/device.rs b/src/device.rs index 9b97e32..e44a8e6 100644 --- a/src/device.rs +++ b/src/device.rs @@ -1609,6 +1609,11 @@ impl DeviceRef { unsafe { msg_send_bool![self, supportsRaytracing] } } + /// Only available on (macos(12.0), ios(15.0)) + pub fn supports_raytracing_from_render(&self) -> bool { + unsafe { msg_send_bool![self, supportsRaytracingFromRender] } + } + pub fn has_unified_memory(&self) -> bool { unsafe { msg_send![self, hasUnifiedMemory] } }