bevy/crates/bevy_render/src/render_graph/mod.rs
Robert Swain 6c085cba47 bevy_render: Support removal of nodes, edges, subgraphs (#3048)
Add support for removing nodes, edges, and subgraphs. This enables live re-wiring of the render graph.

This was something I did to support the MSAA implementation, but it turned out to be unnecessary there. However, it is still useful so here it is in its own PR.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-03-21 23:58:37 +00:00

46 lines
1.3 KiB
Rust

mod context;
mod edge;
mod graph;
mod node;
mod node_slot;
pub use context::*;
pub use edge::*;
pub use graph::*;
pub use node::*;
pub use node_slot::*;
use thiserror::Error;
#[derive(Error, Debug, Eq, PartialEq)]
pub enum RenderGraphError {
#[error("node does not exist")]
InvalidNode(NodeLabel),
#[error("output node slot does not exist")]
InvalidOutputNodeSlot(SlotLabel),
#[error("input node slot does not exist")]
InvalidInputNodeSlot(SlotLabel),
#[error("node does not match the given type")]
WrongNodeType,
#[error("attempted to connect a node output slot to an incompatible input node slot")]
MismatchedNodeSlots {
output_node: NodeId,
output_slot: usize,
input_node: NodeId,
input_slot: usize,
},
#[error("attempted to add an edge that already exists")]
EdgeAlreadyExists(Edge),
#[error("attempted to remove an edge that does not exist")]
EdgeDoesNotExist(Edge),
#[error("node has an unconnected input slot")]
UnconnectedNodeInputSlot { node: NodeId, input_slot: usize },
#[error("node has an unconnected output slot")]
UnconnectedNodeOutputSlot { node: NodeId, output_slot: usize },
#[error("node input slot already occupied")]
NodeInputSlotAlreadyOccupied {
node: NodeId,
input_slot: usize,
occupied_by_node: NodeId,
},
}