pub struct GpuContext {
pub device: Arc<Device>,
pub queue: Arc<Queue>,
pub adapter_info: Option<AdapterInfo>,
}Expand description
Shared GPU context wrapping wgpu::Device and wgpu::Queue.
Can either own a standalone headless device or adopt external Device/Queue handles provided by host engines such as native GUI shells or embedded C/C++ plugins.
Fields§
§device: Arc<Device>§queue: Arc<Queue>§adapter_info: Option<AdapterInfo>Implementations§
Source§impl GpuContext
impl GpuContext
Creates a GpuContext by adopting existing Device and Queue handles from a host.
Sourcepub fn platform_backends() -> Backends
pub fn platform_backends() -> Backends
Returns the preferred native WGPU backend flags for the current host OS.
Sourcepub async fn new_headless_for_platform(
power_preference: PowerPreference,
) -> Result<Self, GpuInitError>
pub async fn new_headless_for_platform( power_preference: PowerPreference, ) -> Result<Self, GpuInitError>
Initializes a standalone headless GPU context using the host platform’s preferred backends.
Sourcepub async fn new_headless_with_backends(
backends: Backends,
power_preference: PowerPreference,
) -> Result<Self, GpuInitError>
pub async fn new_headless_with_backends( backends: Backends, power_preference: PowerPreference, ) -> Result<Self, GpuInitError>
Initializes a standalone headless GPU context using explicit WGPU backends, falling back to a software/CPU adapter if hardware adapter selection fails.
Sourcepub async fn new_headless(
power_preference: PowerPreference,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn new_headless( power_preference: PowerPreference, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Initializes a standalone headless GPU context for offscreen rendering.
Sourcepub fn is_software_fallback(&self) -> bool
pub fn is_software_fallback(&self) -> bool
Returns true when the active adapter is a CPU/software fallback device.