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

The render graph configures the modular, parallel and re-usable render logic. It is a retained and stateless (nodes itself my have their internal state) structure, which can not be modified while it is executed by the graph runner.

The RenderGraphRunner is responsible for executing the entire graph each frame.

It consists of three main components: Nodes, Edges and Slots.

Nodes are responsible for generating draw calls and operating on input and output slots. Edges specify the order of execution for nodes and connect input and output slots together. Slots describe the render resources created or used by the nodes.

Additionally a render graph can contain multiple sub graphs, which are run by the corresponding nodes. Every render graph can have it’s own optional input node.

Example

Here is a simple render graph example with two nodes connected by a node edge.

let mut graph = RenderGraph::default();
graph.add_node("input_node", MyNode);
graph.add_node("output_node", MyNode);
graph.add_node_edge("output_node", "input_node").unwrap();

Implementations

The name of the GraphInputNode of this graph. Used to connect other nodes to it.

Updates all nodes and sub graphs of the render graph. Should be called before executing it.

Creates an GraphInputNode with the specified slots if not already present.

Returns the NodeState of the input node of this graph..

Adds the node with the name to the graph. If the name is already present replaces it instead.

Removes the node with the name from the graph. If the name is does not exist, nothing happens.

Retrieves the NodeState referenced by the label.

Retrieves the NodeState referenced by the label mutably.

Retrieves the NodeId referenced by the label.

Retrieves the Node referenced by the label.

Retrieves the Node referenced by the label mutably.

Adds the Edge::SlotEdge to the graph. This guarantees that the output_node is run before the input_node and also connects the output_slot to the input_slot.

Removes the Edge::SlotEdge from the graph. If any nodes or slots do not exist then nothing happens.

Adds the Edge::NodeEdge to the graph. This guarantees that the output_node is run before the input_node.

Removes the Edge::NodeEdge from the graph. If either node does not exist then nothing happens.

Verifies that the edge existence is as expected and checks that slot edges are connected correctly.

Checks whether the edge already exists in the graph.

Returns an iterator over the NodeStates.

Returns an iterator over the NodeStates, that allows modifying each value.

Returns an iterator over the sub graphs.

Returns an iterator over the sub graphs, that allows modifying each value.

Returns an iterator over a tuple of the input edges and the corresponding output nodes for the node referenced by the label.

Returns an iterator over a tuple of the output edges and the corresponding input nodes for the node referenced by the label.

Adds the sub_graph with the name to the graph. If the name is already present replaces it instead.

Removes the sub_graph with the name from the graph. If the name does not exist then nothing happens.

Retrieves the sub graph corresponding to the name.

Retrieves the sub graph corresponding to the name mutably.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Creates Self using data from the given World

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more