pub struct RenderContext {
pub device: Device,
pub queue: Queue,
/* private fields */
}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 fn init_blocking() -> Result<Self, RenderError>
pub fn init_blocking() -> Result<Self, RenderError>
Blocking wrapper over init for synchronous callers.
The preview runner and the export path are synchronous, so the block-on executor is kept here in the GPU crate; callers stay executor-agnostic.
§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.