Skip to main content

RenderNode

Trait RenderNode 

Source
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§

Source

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§

Source

fn input_count(&self) -> usize

Number of input textures required by this node (default: 1).

Source

fn pass_count(&self) -> usize

Number of render passes (default: 1). Multi-pass nodes (e.g. gaussian blur) return 2 or more.

Source

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.

Source

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§

Source§

impl RenderNode for AlphaMatteNode

Available on crate feature wgpu only.
Source§

impl RenderNode for BlendModeNode

Available on crate feature wgpu only.
Source§

impl RenderNode for ChromaKeyNode

Available on crate feature wgpu only.
Source§

impl RenderNode for ColorGradeNode

Available on crate feature wgpu only.
Source§

impl RenderNode for ColorWheelsNode

Available on crate feature wgpu only.
Source§

impl RenderNode for CrossfadeNode

Available on crate feature wgpu only.
Source§

impl RenderNode for CurvesNode

Available on crate feature wgpu only.
Source§

impl RenderNode for DipToColorNode

Available on crate feature wgpu only.
Source§

impl RenderNode for DissolveTransitionNode

Available on crate feature wgpu only.
Source§

impl RenderNode for FadeTransitionNode

Available on crate feature wgpu only.
Source§

impl RenderNode for FilmGrainNode

Available on crate feature wgpu only.
Source§

impl RenderNode for GaussianBlurNode

Available on crate feature wgpu only.
Source§

impl RenderNode for GlowNode

Available on crate feature wgpu only.
Source§

impl RenderNode for HslNode

Available on crate feature wgpu only.
Source§

impl RenderNode for LumaMaskNode

Available on crate feature wgpu only.
Source§

impl RenderNode for LutNode

Available on crate feature wgpu only.
Source§

impl RenderNode for MotionBlurNode

Available on crate feature wgpu only.
Source§

impl RenderNode for OverlayNode

Available on crate feature wgpu only.
Source§

impl RenderNode for ScaleNode

Available on crate feature wgpu only.
Source§

impl RenderNode for ShapeMaskNode

Available on crate feature wgpu only.
Source§

impl RenderNode for SharpenNode

Available on crate feature wgpu only.
Source§

impl RenderNode for TransformNode

Available on crate feature wgpu only.
Source§

impl RenderNode for VignetteNode

Available on crate feature wgpu only.
Source§

impl RenderNode for WipeTransitionNode

Available on crate feature wgpu only.
Source§

impl RenderNode for YuvUploadNode

Available on crate feature wgpu only.