Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FlannyH committed May 3, 2024
1 parent aa864ed commit 932b3bb
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ impl IRCompilerFactory {
///
/// [the Metal shader converter documentation]: https://developer.apple.com/metal/shader-converter/
pub struct IRCompiler {
funcs: Arc<bindings::metal_irconverter>,
me: *mut bindings::IRCompiler,
funcs: Arc<bindings::metal_irconverter>,
}

impl Drop for IRCompiler {
Expand Down Expand Up @@ -309,21 +309,31 @@ impl IRCompiler {

pub fn synthesize_indirect_intersection_function(
&mut self,
target_metallib: &mut IRMetalLibBinary,
) -> bool {
unsafe {
) -> Result<IRMetalLibBinary, String> {
let target_metallib = IRMetalLibBinary::new(&self).unwrap();
if unsafe {
self.funcs
.IRMetalLibSynthesizeIndirectIntersectionFunction(self.me, target_metallib.me)
} {
return Ok(target_metallib);
}
{
Err("Failed to synthezize indirect intersection function".to_string())
}
}

pub fn synthesize_indirect_ray_dispatch_function(
&mut self,
target_metallib: &mut IRMetalLibBinary,
) -> bool {
unsafe {
) -> Result<IRMetalLibBinary, String> {
let target_metallib = IRMetalLibBinary::new(&self).unwrap();
if unsafe {
self.funcs
.IRMetalLibSynthesizeIndirectRayDispatchFunction(self.me, target_metallib.me)
} {
return Ok(target_metallib);
}
{
Err("Failed to synthezize indirect intersection function".to_string())
}
}

Expand Down

0 comments on commit 932b3bb

Please sign in to comment.