Skip to main content

Crate engawa_wgpu

Crate engawa_wgpu 

Source
Expand description

wgpu-backed Dispatcher impl for engawa render graphs.

engawa owns the typed IR; this crate owns the wgpu wiring. Operators construct a WgpuDispatcher once per graph (or once per consumer lifetime), pass it the device + queue + a target format, and call dispatch_graph from their render loop.

Scope (v0.1): fullscreen-effect graphs. Every node with a Material is dispatched as a render-pass that draws a single fullscreen triangle through a built-in vertex shader, with the operator’s WGSL providing the fragment. Compute and blit passes are pending — same trait, follow-on work.

Scope (NOT v0.1): texture allocation, swapchain management, bind-group authoring. Engawa’s ResourceBindings is the operator-facing handoff for those — the consumer allocates / reuses wgpu textures + binds them to engawa ResourceIds. This crate dispatches; the consumer feeds it.

Structs§

BoundResources
Per-frame map of engawa ResourceId → live wgpu handle. The consumer (mado, future ayatsuri) populates this before calling dispatch_graph. Engawa already validated at compile time that every node references a resource that’s either an input or another node’s output; the dispatcher validates that every referenced resource has a BoundResource entry at dispatch time.
WgpuDispatcher
Dispatcher that compiles engawa render graphs to wgpu commands. Construct once; call dispatch_graph per frame.

Enums§

BoundResource
Live wgpu handle wrapped in a tagged enum so the dispatcher can match the bind type the Material declared. Operators build this from their own wgpu resources at dispatch time.
WgpuDispatcherError

Constants§

FULLSCREEN_VERTEX_WGSL
The canonical fullscreen triangle: three vertices in clip space (no buffers needed). vertex_index 0/1/2 maps to (-1,-1) / (3,-1) / (-1,3), which fully covers [-1, 1]² with no overdraw beyond the viewport.

Functions§

combined_shader_source
Concatenate the built-in fullscreen vertex shader with the operator’s WGSL (which provides fs_main). Returns the combined source ready to hand to wgpu::Device::create_shader_module.