oidn-rs icon indicating copy to clipboard operation
oidn-rs copied to clipboard

Should oidn expose the OIDNBuffer in a safe way?

Open Vecvec opened this issue 8 months ago • 1 comments

Currently oidn provides OIDNBuffer, but we do not expose this, instead only providing vectors to interact with the api. It could be useful to expose a wrapper around these (and provide a similar api that took these instead). This could have the previous functions emulated (by directly writing to the buffer like done now).

If as_raw and from_raw functions are also added, users would be able to use the interoperability with graphical apis or these oidn functions could be provided (though I'm not sure safety could be guaranteed, so they would have to be unsafe)

The changes could look something like

pub fn albedo(&mut self, albedo: &[f32])

to

// different name so the other function can still exist
pub fn set_albedo_buffer(&mut self, albedo: &Buffer)

where the buffer is something like

pub struct Buffer(pub(crate) OIDNBuffer, pub(crate) usize);

Vecvec avatar Jun 08 '24 04:06 Vecvec