pub struct OidnDevice { /* private fields */ }Expand description
Implementations§
Source§impl OidnDevice
impl OidnDevice
Sourcepub fn new() -> Result<Self, Error>
pub fn new() -> Result<Self, Error>
Creates a device using the default backend (auto-selects CPU or GPU when available).
§Errors
Returns Error::DeviceCreationFailed if no backend is available. Use take_global_error()
to retrieve the underlying OIDN message.
Sourcepub fn cuda() -> Result<Self, Error>
pub fn cuda() -> Result<Self, Error>
Creates a CUDA device for NVIDIA GPU-accelerated denoising.
Requires OIDN built with CUDA support; returns DeviceCreationFailed otherwise.
Sourcepub fn sycl() -> Result<Self, Error>
pub fn sycl() -> Result<Self, Error>
Creates a SYCL device (Intel GPU/CPU via oneAPI). Requires OIDN built with SYCL.
Sourcepub fn hip() -> Result<Self, Error>
pub fn hip() -> Result<Self, Error>
Creates a HIP device (AMD GPU). Requires OIDN built with HIP.
Sourcepub fn metal() -> Result<Self, Error>
pub fn metal() -> Result<Self, Error>
Creates a Metal device (Apple GPU). Requires OIDN built with Metal.
Sourcepub fn with_type(device_type: OidnDeviceType) -> Result<Self, Error>
pub fn with_type(device_type: OidnDeviceType) -> Result<Self, Error>
Creates a device of the given type.
Sourcepub fn new_by_id(physical_device_id: i32) -> Result<Self, Error>
pub fn new_by_id(physical_device_id: i32) -> Result<Self, Error>
Creates a device from a physical device ID (0 to num_physical_devices() - 1).
Sourcepub fn new_by_uuid(uuid: &[u8; 16]) -> Result<Self, Error>
pub fn new_by_uuid(uuid: &[u8; 16]) -> Result<Self, Error>
Creates a device from a physical device UUID (16 bytes; see crate::OIDN_UUID_SIZE).
Sourcepub fn new_by_luid(luid: &[u8; 8]) -> Result<Self, Error>
pub fn new_by_luid(luid: &[u8; 8]) -> Result<Self, Error>
Creates a device from a physical device LUID (8 bytes; see crate::OIDN_LUID_SIZE).
Sourcepub fn new_by_pci_address(
pci_domain: i32,
pci_bus: i32,
pci_device: i32,
pci_function: i32,
) -> Result<Self, Error>
pub fn new_by_pci_address( pci_domain: i32, pci_bus: i32, pci_device: i32, pci_function: i32, ) -> Result<Self, Error>
Creates a device from a PCI address (domain, bus, device, function).
Sourcepub unsafe fn new_cuda_device(
device_id: i32,
stream: Option<*mut c_void>,
) -> Result<Self, Error>
pub unsafe fn new_cuda_device( device_id: i32, stream: Option<*mut c_void>, ) -> Result<Self, Error>
Creates a CUDA device for the given device ID and optional stream.
stream: None = default stream; otherwise a valid cudaStream_t (e.g. from rust CUDA bindings).
Currently only one (device_id, stream) pair is supported.
Sourcepub unsafe fn new_hip_device(
device_id: i32,
stream: Option<*mut c_void>,
) -> Result<Self, Error>
pub unsafe fn new_hip_device( device_id: i32, stream: Option<*mut c_void>, ) -> Result<Self, Error>
Creates a HIP device for the given device ID and optional stream.
stream: None = default stream. Currently only one pair is supported.
Sourcepub unsafe fn new_metal_device(
command_queues: &[*mut c_void],
) -> Result<Self, Error>
pub unsafe fn new_metal_device( command_queues: &[*mut c_void], ) -> Result<Self, Error>
Creates a Metal device from an array of Metal command queues (MTLCommandQueue). Currently only one queue is supported. Pass a single pointer.
Sourcepub fn set_bool(&self, name: &str, value: bool)
pub fn set_bool(&self, name: &str, value: bool)
Sets a boolean device parameter. Must call commit() before first use if you change parameters.
Sourcepub fn get_uint(&self, name: &str) -> u32
pub fn get_uint(&self, name: &str) -> u32
Gets an unsigned integer device parameter (OIDN exposes this as cast of get_int).
Sourcepub fn commit(&self)
pub fn commit(&self)
Commits all previous device parameter changes. Must be called before first filter creation.
Sourcepub unsafe fn set_error_function_raw(
&self,
func: Option<unsafe extern "C" fn(user_ptr: *mut c_void, code: OIDNError, message: *const c_char)>,
user_ptr: *mut c_void,
)
pub unsafe fn set_error_function_raw( &self, func: Option<unsafe extern "C" fn(user_ptr: *mut c_void, code: OIDNError, message: *const c_char)>, user_ptr: *mut c_void, )
Sets the error callback. The callback is invoked from OIDN; it must not panic.
user_ptr is passed to the callback. Must remain valid until device is released or callback is cleared.
Sourcepub fn take_error(&self) -> Option<Error>
pub fn take_error(&self) -> Option<Error>
Returns the first unqueried error and clears it.
Trait Implementations§
Source§impl Clone for OidnDevice
impl Clone for OidnDevice
Source§fn clone(&self) -> OidnDevice
fn clone(&self) -> OidnDevice
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more