Skip to main content

GpuRenderer

Trait GpuRenderer 

Source
pub trait GpuRenderer: SceneRenderer {
    type Device;

    // Required method
    fn device(&self) -> Option<Self::Device>;
}
Expand description

A renderer that owns a device a producer can make resources on.

The engine’s SceneRenderer is GPU-agnostic and names no device, but a producer that must make a texture on the window’s GPU has to reach the concrete device the renderer drew with — the same-device rule seen from the renderer’s side. A renderer that owns one implements this; a renderer that has none to lend — a discard or capture-only one — simply does not, and is then absent from this door rather than answering it with a placeholder.

Device is the backend’s own handle — an ID3D11Device, a metal::Device, a wgpu context — so this trait adds no dependency on any GPU driver: only an implementor names one.

Required Associated Types§

Source

type Device

The device this renderer draws on, and so the one a producer must make its texture on.

Required Methods§

Source

fn device(&self) -> Option<Self::Device>

The device, or None while there is none to lend: a renderer mid-recovery has taken its device apart and has not yet rebuilt it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§