pub struct RenderContext {
pub device: Device,
pub queue: Queue,
}Expand description
Owns the wgpu device and queue used by the render pipeline.
Share via Arc<RenderContext> when multiple components (graph, sink, etc.)
need access to the same GPU device.
Fields§
§device: Device§queue: QueueImplementations§
Source§impl RenderContext
impl RenderContext
Sourcepub fn new(device: Device, queue: Queue) -> Self
pub fn new(device: Device, queue: Queue) -> Self
Wrap an existing wgpu device (e.g. shared with the window renderer).
Sourcepub async fn init() -> Result<Self, RenderError>
pub async fn init() -> Result<Self, RenderError>
Initialise wgpu using the default (best available) backend.
Backend priority: Metal → Vulkan → DX12 → WebGPU → OpenGL.
§Errors
Returns RenderError::DeviceCreation if no suitable adapter is found or
the device request fails.
Sourcepub async fn init_with_backend(backends: Backends) -> Result<Self, RenderError>
pub async fn init_with_backend(backends: Backends) -> Result<Self, RenderError>
Initialise wgpu with an explicit backend set.
Useful in CI where only wgpu::Backends::GL may be available.
§Errors
Returns RenderError::DeviceCreation if no suitable adapter is found or
the device request fails.
Auto Trait Implementations§
impl !RefUnwindSafe for RenderContext
impl !UnwindSafe for RenderContext
impl Freeze for RenderContext
impl Send for RenderContext
impl Sync for RenderContext
impl Unpin for RenderContext
impl UnsafeUnpin for RenderContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more