Skip to main content

Module context

Module context 

Source
Expand description

Shared plotting context registry for zero-copy rendering.

This module tracks the GPU device/queue exported by the active acceleration provider so plotting backends (native GUI or wasm/web) can reuse the same wgpu::Device without creating duplicate adapters. Call ensure_context_from_provider or install_wgpu_context once a provider is initialized; subsequent callers can query shared_wgpu_context to determine whether zero-copy rendering is possible.

Functionsยง

ensure_context_from_provider
Ensure the shared context is populated by calling back into the acceleration provider. Returns the cached context when available.
install_wgpu_context
Install a shared context that was exported out-of-band (e.g. from a host application that already called export_context).
shared_wgpu_context
Returns the cached shared WGPU context, if one has been installed.