Skip to main content

RenderGraph

Struct RenderGraph 

Source
pub struct RenderGraph { /* private fields */ }
Expand description

Linear chain of render nodes executed in insertion order.

The CPU fallback path (process_cpu) is always available and does not require the wgpu feature. When the wgpu feature is enabled, process_gpu runs every node on the GPU.

§Construction

// GPU+CPU graph (wgpu feature):
let ctx = Arc::new(RenderContext::init().await?);
let graph = RenderGraph::new(Arc::clone(&ctx))
    .push(ColorGradeNode { brightness: 0.1, ..Default::default() });

// CPU-only graph (no wgpu feature needed):
let graph = RenderGraph::new_cpu()
    .push_cpu(ColorGradeNode { brightness: 0.1, ..Default::default() });

Implementations§

Source§

impl RenderGraph

Source

pub fn new_cpu() -> Self

Create a CPU-only graph (no GPU context required).

process_gpu returns [RenderError::Composite] when called on a CPU-only graph. Use process_cpu instead.

Source

pub fn push(self, node: impl RenderNodeCpu + 'static) -> Self

Append a CPU-only node to the chain.

CPU-only nodes participate in process_cpu but not in process_gpu.

When the wgpu feature is not enabled, this is the only push method.

Source

pub fn push_cpu(self, node: impl RenderNodeCpu + 'static) -> Self

Append a CPU-only node (available regardless of the wgpu feature).

Source

pub fn process_cpu(&self, rgba: &[u8], w: u32, h: u32) -> Vec<u8>

Run the CPU fallback pipeline: apply each node’s process_cpu in order.

Both CPU-only nodes (push_cpu) and GPU nodes (push, wgpu feature) participate — GPU nodes expose a CPU path via the RenderNodeCpu supertrait.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.