GPUBackend

Struct GPUBackend 

Source
pub struct GPUBackend {
    pub backend_type: BackendType,
    pub device: Option<Arc<Device>>,
    pub queue: Option<Arc<Queue>>,
    pub surface: Option<Surface<'static>>,
    pub config: Option<SurfaceConfiguration>,
}
Expand description

GPU backend abstraction - OPTIONAL helper for web contexts

This struct is maintained for backward compatibility and web-based usage. For native window rendering (e.g., Python bindings), renderers can be created directly with device/queue/config without going through GPUBackend.

Design rationale:

  • Native contexts: Create device/queue/surface directly, pass to renderer
  • Web contexts: Use GPUBackend as a convenient factory/manager

Fields§

§backend_type: BackendType§device: Option<Arc<Device>>§queue: Option<Arc<Queue>>§surface: Option<Surface<'static>>§config: Option<SurfaceConfiguration>

Implementations§

Source§

impl GPUBackend

Source

pub async fn new() -> Result<Self, String>

Create a new GPU backend with automatic detection

Source

pub fn configure_surface( &mut self, surface: Surface<'static>, width: u32, height: u32, ) -> Result<(), String>

Configure surface for rendering

Source

pub fn device(&self) -> Result<&Device, String>

Get device reference

Source

pub fn queue(&self) -> Result<&Queue, String>

Get queue reference

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,