pub struct WgpuDispatcher { /* private fields */ }Expand description
Dispatcher that compiles engawa render graphs to wgpu
commands. Construct once; call dispatch_with per frame.
Implementations§
Source§impl WgpuDispatcher
impl WgpuDispatcher
Sourcepub fn new(device: &Device, queue: &Queue, target_format: TextureFormat) -> Self
pub fn new(device: &Device, queue: &Queue, target_format: TextureFormat) -> Self
Construct a dispatcher. The device/queue handles are
cloned (wgpu handles are internally reference-counted) —
the dispatcher holds no lifetime borrow, so a consumer
that does not own its device (mado’s TerminalRenderer)
can still own a dispatcher.
Sourcepub fn cached_pipeline_count(&self) -> usize
pub fn cached_pipeline_count(&self) -> usize
Number of Materials with a compiled pipeline in the
cache. Pipelines compile once per Material name; a
second dispatch_with over the same graph must not grow
this count.
Sourcepub fn invalidate_material(&mut self, name: &str)
pub fn invalidate_material(&mut self, name: &str)
Drop the cached pipeline for one Material name. The cache is keyed by name only — a hot-reload that swaps a Material’s shader under the same name MUST call this or the stale pipeline keeps dispatching.
Sourcepub fn dispatch_with(
&mut self,
graph: &CompiledGraph,
bindings: &ResourceBindings,
bound: BoundResources,
frame: &FrameUniforms,
) -> Result<CommandBuffer, WgpuDispatcherError>
pub fn dispatch_with( &mut self, graph: &CompiledGraph, bindings: &ResourceBindings, bound: BoundResources, frame: &FrameUniforms, ) -> Result<CommandBuffer, WgpuDispatcherError>
Canonical per-call dispatch: write the per-frame
uniforms, compile any uncached Materials, walk the
graph, return the recorded CommandBuffer ready to
submit.
Trait Implementations§
Source§impl Dispatcher for WgpuDispatcher
impl Dispatcher for WgpuDispatcher
Source§fn dispatch_node(
&mut self,
node: &Node,
_bindings: &ResourceBindings,
) -> Result<(), DispatchError>
fn dispatch_node( &mut self, node: &Node, _bindings: &ResourceBindings, ) -> Result<(), DispatchError>
dispatch_graph in
execution order. Implementations record / encode /
dispatch as appropriate for their backend.Source§fn dispatch_graph(
&mut self,
graph: &CompiledGraph,
bindings: &ResourceBindings,
) -> Result<(), DispatchError>
fn dispatch_graph( &mut self, graph: &CompiledGraph, bindings: &ResourceBindings, ) -> Result<(), DispatchError>
graph.execution_order, validating bindings + then
calling dispatch_node for each. The default impl
handles all engawa-side concerns; backends typically
don’t override this.