cvkg_render_gpu/kvasir/planner.rs
1use super::KvasirError;
2use super::graph::KvasirGraph;
3
4/// The ExecutionPlanner takes a constructed RenderGraph (KvasirGraph)
5/// and produces a topologically sorted execution plan.
6pub struct ExecutionPlanner<'a> {
7 graph: &'a KvasirGraph,
8}
9
10impl<'a> ExecutionPlanner<'a> {
11 pub fn new(graph: &'a KvasirGraph) -> Self {
12 Self { graph }
13 }
14
15 /// Compiles the graph into an ordered sequence of PassIds.
16 pub fn compile(&self) -> Result<Vec<super::graph::NodeKey>, KvasirError> {
17 let order = self.graph.topological_sort()?;
18 Ok(order)
19 }
20}