Skip to main content

Module gpu_plugin

Module gpu_plugin 

Source
Expand description

GPU plugin trait and lifecycle hooks. GPU plugin trait and lifecycle hooks for runtime extensions.

GpuPlugin is the GPU-side counterpart to RuntimePlugin. Where RuntimePlugin mutates the scene each frame in step, GpuPlugin encodes wgpu command buffers at well-defined lifecycle points around the renderer’s own work. The two traits are independent: a plugin may implement one, the other, or both and register itself separately with ViewportRuntime::with_plugin and ViewportRuntime::with_gpu_plugin.

§Frame integration

output = runtime.step(scene, selection, &frame_ctx);
// host applies output (write_mesh_positions_normals, SkinningPlugin::attach_palette, ...)

let plugin_bufs  = runtime.pre_prepare(device, queue, &gpu_ctx);
let prepare_bufs = renderer.pass().prepare(device, queue, &frame);
queue.submit(plugin_bufs.into_iter().chain(prepare_bufs));

wgpu submit ordering guarantees plugin command buffers complete before prepare()’s, so a storage buffer written by a plugin is observable by the standard render passes in the same frame.

Modules§

gpu_phase
Priority bands for GPU plugin lifecycle points.

Structs§

GpuFrameContext
Per-frame, read-only context passed to a GpuPlugin.
PostPaintTargets
Rendered target views handed to GpuPlugin::post_paint.

Traits§

GpuPlugin
A plugin that encodes GPU work into the per-frame command stream.