Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions wgpu/src/api/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ impl Device {
}
}

#[cfg(custom)]
/// Convert Device into custom implementation.
///
/// This is useful for wrapping the an existing device implementation to
/// implement a new custom device interface
pub fn into_custom(self) -> crate::dispatch::DispatchDevice {
self.inner
}

/// Constructs a stub device for testing using [`Backend::Noop`].
///
/// This is a convenience function which avoids the configuration, `async`, and fallibility
Expand Down
9 changes: 9 additions & 0 deletions wgpu/src/api/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ impl Instance {
}
}

#[cfg(custom)]
/// Convert Instance into custom implementation.
///
/// This is useful for wrapping the an existing instance implementation to
/// implement a new custom instance interface
pub fn into_custom(self) -> crate::dispatch::DispatchInstance {
self.inner
}

#[cfg(custom)]
/// Returns custom implementation of Instance (if custom backend and is internally T)
pub fn as_custom<T: custom::InstanceInterface>(&self) -> Option<&T> {
Expand Down
9 changes: 9 additions & 0 deletions wgpu/src/api/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ impl Queue {
inner: dispatch::DispatchQueue::custom(queue),
}
}

#[cfg(custom)]
/// Convert Queue into custom implementation.
///
/// This is useful for wrapping the an existing queue implementation to
/// implement a new custom queue interface
pub fn into_custom(self) -> crate::dispatch::DispatchQueue {
self.inner
}
}

/// Identifier for a particular call to [`Queue::submit`]. Can be used
Expand Down
Loading