Path: blob/main/crates/bevy_render/src/render_graph/edge.rs
6596 views
use super::InternedRenderLabel;12/// An edge, which connects two [`Nodes`](super::Node) in3/// a [`RenderGraph`](crate::render_graph::RenderGraph).4///5/// They are used to describe the ordering (which node has to run first)6/// and may be of two kinds: [`NodeEdge`](Self::NodeEdge) and [`SlotEdge`](Self::SlotEdge).7///8/// Edges are added via the [`RenderGraph::add_node_edge`] and the9/// [`RenderGraph::add_slot_edge`] methods.10///11/// The former simply states that the `output_node` has to be run before the `input_node`,12/// while the later connects an output slot of the `output_node`13/// with an input slot of the `input_node` to pass additional data along.14/// For more information see [`SlotType`](super::SlotType).15///16/// [`RenderGraph::add_node_edge`]: crate::render_graph::RenderGraph::add_node_edge17/// [`RenderGraph::add_slot_edge`]: crate::render_graph::RenderGraph::add_slot_edge18#[derive(Clone, Debug, Eq, PartialEq)]19pub enum Edge {20/// An edge describing to ordering of both nodes (`output_node` before `input_node`)21/// and connecting the output slot at the `output_index` of the `output_node`22/// with the slot at the `input_index` of the `input_node`.23SlotEdge {24input_node: InternedRenderLabel,25input_index: usize,26output_node: InternedRenderLabel,27output_index: usize,28},29/// An edge describing to ordering of both nodes (`output_node` before `input_node`).30NodeEdge {31input_node: InternedRenderLabel,32output_node: InternedRenderLabel,33},34}3536impl Edge {37/// Returns the id of the `input_node`.38pub fn get_input_node(&self) -> InternedRenderLabel {39match self {40Edge::SlotEdge { input_node, .. } | Edge::NodeEdge { input_node, .. } => *input_node,41}42}4344/// Returns the id of the `output_node`.45pub fn get_output_node(&self) -> InternedRenderLabel {46match self {47Edge::SlotEdge { output_node, .. } | Edge::NodeEdge { output_node, .. } => *output_node,48}49}50}5152#[derive(PartialEq, Eq)]53pub enum EdgeExistence {54Exists,55DoesNotExist,56}575859