14#include <unordered_map>
15#include <unordered_set>
30 node.Parameters[
"__posX"] =
bx;
31 node.Parameters[
"__posY"] =
by;
41 std::vector<Layer> layers;
42 if (
graph.Nodes.empty())
return layers;
53 for (
const auto&
n :
graph.Nodes)
68 std::unordered_map<int32_t, std::vector<int32_t>>
adj;
69 for (
const auto&
n :
graph.Nodes)
adj[
n.NodeID];
70 for (
const auto&
ec :
graph.ExecConnections)
73 adj[
ec.SourceNodeID].push_back(
ec.TargetNodeID);
77 std::unordered_map<int32_t, int>
layerOf;
105 layers.resize(
static_cast<std::size_t
>(
maxLayer + 1));
108 layers[
static_cast<std::size_t
>(
kv.second)].NodeIDs.push_back(
kv.first);
112 std::unordered_set<int32_t>
visited;
116 for (
const auto&
n :
graph.Nodes)
125 for (
auto& layer : layers)
127 std::sort(layer.NodeIDs.begin(), layer.NodeIDs.end());
138 const std::vector<Layer>& layers)
140 if (
graph.Nodes.empty() || layers.empty())
return;
143 std::unordered_map<int32_t, std::size_t>
indexOf;
144 for (std::size_t
i = 0;
i <
graph.Nodes.size(); ++
i)
ComponentTypeID GetComponentTypeID_Static()
Hierarchical (Sugiyama-inspired) auto-layout for VS task graphs (Phase 6).
static constexpr float ORIGIN_X
X coordinate of the root (EntryPoint) column.
static constexpr float SPACING_Y
Vertical gap between rows (pixels).
static void AssignPositions(TaskGraphTemplate &graph, const std::vector< Layer > &layers)
Assigns x/y positions from the layer structure.
static void SetPos(TaskNodeDefinition &node, float x, float y)
Writes a float position into a node's Parameters map.
static constexpr float SPACING_X
Horizontal gap between columns (pixels).
static std::vector< Layer > BuildLayers(const TaskGraphTemplate &graph)
Builds layers via BFS from the entry point.
static constexpr float ORIGIN_Y
Y coordinate of the first row.
static void ApplyHierarchicalLayout(TaskGraphTemplate &graph)
Assigns screen-space positions to every node in graph.
Immutable, shareable task graph asset.
C++14-compliant type-safe value container for task parameters.
< Provides AssetID and INVALID_ASSET_ID
@ Literal
Value is embedded directly in the template.
@ EntryPoint
Unique entry node for VS graphs (replaces Root)
constexpr int32_t NODE_INDEX_NONE
Sentinel value for "no node" in node index / ID fields.
A single layer in the hierarchical layout.
std::vector< int32_t > NodeIDs
IDs of nodes assigned to this layer, in order.
Describes how a single parameter value is supplied to a task node.
ParameterBindingType Type
Binding mode.
Full description of a single node in the task graph.