Skip to content

Commit

Permalink
Merge pull request #26 from float3/master
Browse files Browse the repository at this point in the history
Add metal() function to Device struct in device.rs
  • Loading branch information
Twinklebear authored Apr 21, 2024
2 parents faecded + fc24557 commit 543d53e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ impl Device {
Some(Self(handle))
}

pub fn metal() -> Option<Self> {
let handle = unsafe { oidnNewDevice(OIDNDeviceType_OIDN_DEVICE_TYPE_METAL) };
if handle.is_null() {
return None;
}
unsafe {
oidnCommitDevice(handle);
}
Some(Self(handle))
}

pub fn get_error(&self) -> Result<(), (Error, String)> {
let mut err_msg = ptr::null();
let err = unsafe { oidnGetDeviceError(self.0, &mut err_msg as *mut *const c_char) };
Expand Down

0 comments on commit 543d53e

Please sign in to comment.