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§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl GpuRenderer for WgpuRenderer
impl GpuRenderer for WgpuRenderer
Source§type Device = (Arc<Device>, Arc<Queue>)
type Device = (Arc<Device>, Arc<Queue>)
The shared context slot, which is where a producer on this path reaches the device and the
queue: it is the same Rc every window in the process draws through, so reading them out
of it is the rendezvous it exists for. None for a renderer built offscreen, which holds
no context because it has no window to coordinate with.