1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! # oidn-wgpu
//!
//! [Intel Open Image Denoise](https://www.openimagedenoise.org) (OIDN) integration for [wgpu](https://docs.rs/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
//!
//! ```ignore
//! # use std::error::Error;
//! # fn main() -> Result<(), Box<dyn Error>> {
//! 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
//! )?;
//! # Ok(())
//! # }
//! ```
//!
//! ## Example: denoise CPU buffers (no wgpu)
//!
//! ```ignore
//! # use std::error::Error;
//! # fn main() -> Result<(), Box<dyn Error>> {
//! 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)?;
//! # Ok(())
//! # }
//! ```
/// UUID size for physical device (bytes). Use with [`OidnDevice::new_by_uuid`].
pub const OIDN_UUID_SIZE: usize = 16;
/// LUID size for physical device (bytes). Use with [`OidnDevice::new_by_luid`].
pub const OIDN_LUID_SIZE: usize = 8;
pub use ;
pub use ;
pub use Error;
pub use ;
pub use ;