pub trait RenderNode: RenderNodeCpu {
// Required method
fn process(
&self,
inputs: &[&Texture],
outputs: &[&Texture],
ctx: &RenderContext,
);
// Provided methods
fn input_count(&self) -> usize { ... }
fn pass_count(&self) -> usize { ... }
fn output_dimensions(&self, in_w: u32, in_h: u32) -> (u32, u32) { ... }
fn set_param(&self, _param: NodeParam) -> bool { ... }
}Expand description
GPU render node. Extends RenderNodeCpu so both paths are available.
Each node is responsible for creating and caching its own wgpu pipeline
on first use. The pipeline is stored in a std::sync::OnceLock field
so it is created exactly once per node instance.
process may submit one or more wgpu::CommandEncoder buffers. The
RenderGraph guarantees that the queue
processes them in submission order.
Required Methods§
Sourcefn process(
&self,
inputs: &[&Texture],
outputs: &[&Texture],
ctx: &RenderContext,
)
fn process( &self, inputs: &[&Texture], outputs: &[&Texture], ctx: &RenderContext, )
Run the GPU render pass.
inputs has input_count() textures: inputs[0] is the previous node’s
final-pass output (or the source frame for the first node), and
inputs[1..] are the original source frame. outputs has pass_count()
pre-allocated Rgba8Unorm targets; write the final result into
outputs[pass_count()-1], which the executor feeds to the next node.
Provided Methods§
Sourcefn input_count(&self) -> usize
fn input_count(&self) -> usize
Number of input textures required by this node (default: 1).
Sourcefn pass_count(&self) -> usize
fn pass_count(&self) -> usize
Number of render passes (default: 1). Multi-pass nodes (e.g. gaussian blur) return 2 or more.
Sourcefn output_dimensions(&self, in_w: u32, in_h: u32) -> (u32, u32)
fn output_dimensions(&self, in_w: u32, in_h: u32) -> (u32, u32)
Output dimensions this node produces given its input dimensions.
Default: unchanged ((in_w, in_h)). A resampling node (e.g.
ScaleNode) overrides this so the executor allocates its output target
— and every following node’s input — at the new size. All of a node’s
pass_count() targets are allocated at this size.
Sourcefn set_param(&self, _param: NodeParam) -> bool
fn set_param(&self, _param: NodeParam) -> bool
Applies param to this node in place, returning whether it was taken.
Takes &self because the caller only ever holds the graph, and because a
node that accepts a parameter is by nature one that already carries interior
mutability for its state.
Defaults to false: a node that does not name a parameter is unaffected by
one, and a caller can tell nothing was applied.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl RenderNode for AlphaMatteNode
wgpu only.impl RenderNode for BlendModeNode
wgpu only.impl RenderNode for ChromaKeyNode
wgpu only.impl RenderNode for ColorGradeNode
wgpu only.impl RenderNode for ColorWheelsNode
wgpu only.impl RenderNode for CrossfadeNode
wgpu only.impl RenderNode for CurvesNode
wgpu only.impl RenderNode for DipToColorNode
wgpu only.impl RenderNode for DissolveTransitionNode
wgpu only.impl RenderNode for FadeTransitionNode
wgpu only.impl RenderNode for FilmGrainNode
wgpu only.impl RenderNode for GaussianBlurNode
wgpu only.impl RenderNode for GlowNode
wgpu only.impl RenderNode for HslNode
wgpu only.impl RenderNode for LumaMaskNode
wgpu only.impl RenderNode for LutNode
wgpu only.impl RenderNode for MotionBlurNode
wgpu only.impl RenderNode for OverlayNode
wgpu only.impl RenderNode for ScaleNode
wgpu only.impl RenderNode for ShapeMaskNode
wgpu only.impl RenderNode for SharpenNode
wgpu only.impl RenderNode for TransformNode
wgpu only.impl RenderNode for VignetteNode
wgpu only.impl RenderNode for WipeTransitionNode
wgpu only.impl RenderNode for YuvUploadNode
wgpu only.