use crate::{arc, define_mtl, define_obj_type, mtl, ns, objc};
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[repr(usize)]
pub enum IntersectionFnSignature {
None = 0,
Instancing = (1 << 0),
TriangleData = (1 << 1),
WorldSpaceData = (1 << 2),
InstanceMotion = (1 << 3),
PrimitiveMotion = (1 << 4),
ExtendedLimits = (1 << 5),
}
define_obj_type!(pub Desc(ns::Id), MTL_INTERSECTION_FUNCTION_TABLE_DESCRIPTOR);
impl Desc {
#[objc::msg_send(functionCount)]
pub fn fn_count(&self) -> usize;
#[objc::msg_send(setFunctionCount:)]
pub fn set_fn_count(&mut self, val: usize);
}
define_obj_type!(pub IntersectionFnTable(mtl::Res));
impl IntersectionFnTable {
define_mtl!(gpu_res_id);
#[objc::msg_send(setBuffer:atIndex:)]
pub fn set_buf_at(&mut self, buf: Option<&mtl::Buf>, index: usize);
#[objc::msg_send(setBuffers:offsets:withRange:)]
pub fn set_bufs(
&mut self,
buffers: *const Option<&mtl::Buf>,
offsets: *const usize,
range: ns::Range,
);
#[objc::msg_send(setFunction:atIndex:)]
pub fn set_fn_at<H: mtl::FnHandle>(&mut self, function: Option<&H>, index: usize);
#[objc::msg_send(setFunctions:withRange:)]
pub fn set_fns_with_range<H: mtl::FnHandle>(
&mut self,
functions: *const Option<&H>,
range: ns::Range,
);
#[objc::msg_send(setOpaqueTriangleIntersectionFunctionWithSignature:atIndex:)]
pub fn set_opaque_triangle_intersection_fn_with_signature(
&mut self,
signature: mtl::IntersectionFnSignature,
index: usize,
);
#[objc::msg_send(setOpaqueTriangleIntersectionFunctionWithSignature:withRange:)]
pub fn set_opaque_triangle_intersection_fn_with_signature_with_range(
&mut self,
signature: mtl::IntersectionFnSignature,
range: ns::Range,
);
#[objc::msg_send(setVisibleFunctionTable:atBufferIndex:)]
pub fn set_visible_fn_table(
&mut self,
function_table: Option<&mtl::VisibleFnTable>,
buffer_index: usize,
);
#[objc::msg_send(setVisibleFunctionTables:withBufferRange:)]
pub fn set_visible_fn_tables(
&mut self,
function_tables: *const Option<&mtl::VisibleFnTable>,
buffer_range: ns::Range,
);
}
#[link(name = "mtl", kind = "static")]
unsafe extern "C" {
static MTL_INTERSECTION_FUNCTION_TABLE_DESCRIPTOR: &'static objc::Class<Desc>;
}