graphics-core 0.1.0

Shared low-level, host-agnostic WGPU graphics substrate for offscreen rendering, readback, 2D/camera math, and overlay/preview pipelines.
Documentation
use graphics_core::GpuContext;
use std::sync::OnceLock;

static SHARED_GPU: OnceLock<Option<GpuContext>> = OnceLock::new();

pub fn try_shared_gpu() -> Option<&'static GpuContext> {
    SHARED_GPU
        .get_or_init(|| {
            pollster::block_on(GpuContext::new_headless_for_platform(
                wgpu::PowerPreference::LowPower,
            ))
            .ok()
        })
        .as_ref()
}

pub fn shared_gpu() -> &'static GpuContext {
    try_shared_gpu().expect("headless WGPU adapter required for graphics-core integration tests")
}

mod depth_peeling;
mod pipelines;
mod targets_readback;