Skip to main content

Crate oidn_wgpu

Crate oidn_wgpu 

Source
Expand description

§oidn-wgpu

Intel Open Image Denoise (OIDN) integration for wgpu. Denoise path-traced or ray-traced images produced on the GPU by copying to CPU, running OIDN, and copying back.

This crate targets OIDN 2.4.x and wgpu 27. It does not depend on oidn-rs.

§Setup

Build and install OIDN 2.4.x (e.g. from https://github.com/OpenImageDenoise/oidn), then either:

  • Set OIDN_DIR to the install directory (containing include/ and lib/), or
  • Use pkg-config (Linux/macOS) with OpenImageDenoise installed.

§Example: denoise a wgpu texture

use oidn_wgpu::{OidnDevice, denoise_texture, DenoiseTextureFormat, DenoiseOptions};

let oidn = OidnDevice::new()?;
let format = DenoiseTextureFormat::Rgba16Float;
denoise_texture(
    &oidn,
    &wgpu_device,
    &wgpu_queue,
    &input_texture,
    &output_texture,
    format,
    &DenoiseOptions::default(), // or set quality, hdr, srgb, input_scale
)?;

§Example: denoise CPU buffers (no wgpu)

use oidn_wgpu::{OidnDevice, RtFilter};

let device = OidnDevice::new()?;
let mut filter = RtFilter::new(&device)?;
filter.set_dimensions(width, height).set_hdr(true);
filter.execute_in_place(&mut color_rgb_f32)?;

Re-exports§

pub use buffer::BufferStorage;
pub use buffer::ExternalMemoryTypeFlag;
pub use buffer::OidnBuffer;
pub use device::get_physical_device_bool;
pub use device::get_physical_device_data;
pub use device::get_physical_device_int;
pub use device::get_physical_device_string;
pub use device::is_cpu_device_supported;
pub use device::is_cuda_device_supported;
pub use device::is_hip_device_supported;
pub use device::is_metal_device_supported;
pub use device::num_physical_devices;
pub use device::OidnDevice;
pub use device::OidnDeviceType;
pub use device::take_global_error;
pub use error::Error;
pub use filter::Filter;
pub use filter::ImageFormat;
pub use filter::OIDNFormat;
pub use filter::Quality;
pub use filter::RtFilter;
pub use filter::RtLightmapFilter;
pub use wgpu_integration::denoise_texture;
pub use wgpu_integration::denoise_texture_with_aux;
pub use wgpu_integration::DenoiseOptions;
pub use wgpu_integration::DenoiseTextureFormat;

Modules§

buffer
OIDN buffer (host/device memory, shared/imported). Full buffer API.
device
OIDN logical device (CPU or GPU backend) and physical device queries. Full API: type-based and physical-ID/UUID/LUID/PCI/CUDA/HIP/Metal device creation.
error
Error types for OIDN and wgpu integration.
filter
RT and RTLightmap denoising filters, plus generic filter API (full OIDN filter coverage).
wgpu_integration
Denoise wgpu textures by copying to CPU, running OIDN, and copying back.

Constants§

OIDN_LUID_SIZE
LUID size for physical device (bytes). Use with OidnDevice::new_by_luid.
OIDN_UUID_SIZE
UUID size for physical device (bytes). Use with OidnDevice::new_by_uuid.