7#ifndef PXR_EXEC_VDF_SPARSE_INPUT_PATH_FINDER_H
8#define PXR_EXEC_VDF_SPARSE_INPUT_PATH_FINDER_H
14#include "pxr/exec/vdf/api.h"
19#include "pxr/base/tf/hashmap.h"
20#include "pxr/base/tf/hashset.h"
25PXR_NAMESPACE_OPEN_SCOPE
70 std::vector<VdfConnectionConstVector> *paths);
82 std::vector<VdfConnectionConstVector> *paths);
92 std::vector<VdfConnectionConstVector> *paths);
100 _PathSegment(
unsigned int id,
unsigned int len)
101 : id(id), len(len) {}
104 bool operator==(
const _PathSegment &rhs)
const {
105 return id == rhs.id && len == rhs.len;
108 std::string GetAsString()
const {
112 unsigned int id, len;
117 struct _StackFrame :
public _PathSegment
121 const _PathSegment &segment)
122 : _PathSegment(segment),
123 maskedOutput(maskedOutput) {}
138 struct _PotentialResult
141 const _PathSegment &ending,
const _PathSegment &encountered)
143 encountered(encountered) {}
146 bool operator==(
const _PotentialResult &rhs)
const {
147 return ending == rhs.ending && encountered == rhs.encountered;
152 size_t operator()(
const _PotentialResult &p)
const {
167 _PathSegment encountered;
170 using _VisitedDependencyToSegmentMap =
171 TfHashMap<VdfMask, _PathSegment, VdfMask::HashFunctor>;
175 using _VisitedConnectionsInfoMap =
176 TfHashMap<const VdfConnection *, _VisitedDependencyToSegmentMap, TfHash>;
181 using _PathToParentSegmentMap =
182 TfHashMap<unsigned int, _PathSegment, TfHash>;
188 using _PathToResultMap =
189 TfHashMap<unsigned int, VdfConnectionConstVector, TfHash>;
192 using _PathToPathChildrenMap =
193 TfHashMap<unsigned int, std::vector<unsigned int>>;
196 using _PotentialResults =
197 TfHashSet<_PotentialResult, _PotentialResult::HashFunctor>;
200 using _PathToRelevanceMap =
201 TfHashMap<unsigned int, const VdfInput *, TfHash>;
206 void _TraverseFrame(
const _StackFrame &frame,
bool isStartFrame);
209 void _TraverseSeenConnection(
210 const _PathSegment &ending,
const _PathSegment &encountered);
214 const _PathSegment &end,
const _PathSegment *start)
const;
217 void _FinalizePendingResults(
218 std::vector<VdfConnectionConstVector> *paths)
const;
221 void _AppendChildPathsToWorkingSet(
222 std::set<unsigned int> *pathToLookup,
224 const _PathSegment &encounteredSegment,
225 unsigned int joiningPathId)
const;
236 std::vector<VdfConnectionConstVector> _paths;
239 _PathToRelevanceMap _pathToRelevanceMap;
243 _VisitedConnectionsInfoMap _visitedConnectionsInfoMap;
248 _PathToParentSegmentMap _pathToParentSegmentMap;
251 _PathToPathChildrenMap _pathToPathChildrenMap;
257 _PathToResultMap _pathToResultMap;
260 std::vector<_StackFrame> _stack;
263 _PotentialResults _potentialResults;
268PXR_NAMESPACE_CLOSE_SCOPE
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
This is a small-vector class with local storage optimization, the local storage can be specified via ...
Class to hold on to an externally owned output and a mask.
This is the base class for all nodes in a VdfNetwork.
A VdfOutput represents an output on a node.
TF_API std::string TfStringPrintf(const char *fmt,...)
Returns a string formed by a printf()-like specification.
Definitions of basic string utilities in tf.