vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
//! Concrete wgpu backend type.
//!
//! [`WgpuBackend`] is a zero-sized handle that delegates to the shared global
//! GPU context. Construction is cheap after the first call because the adapter
//! and device are cached.

use super::context::get_gpu;

/// A real wgpu backend for conformance testing.
///
/// This backend dispatches WGSL compute shaders on a real GPU adapter.
/// If no GPU is available, construction returns None.
pub struct WgpuBackend;

impl WgpuBackend {
    /// Create the backend if a GPU adapter is available.
    ///
    /// # Examples
    ///
    /// ```
    /// let backend = vyre_conform::pipeline::backend::wgpu::WgpuBackend::new();
    /// ```
    ///
    /// # Errors
    ///
    /// Returns `None` if no GPU adapter is present or if the adapter does not
    /// support compute shaders.
    #[must_use]
    #[inline]
    pub fn new() -> Option<Self> {
        get_gpu().map(|_| Self)
    }
}