7 #ifndef PXR_EXEC_EF_DEPENDENCY_CACHE_H 8 #define PXR_EXEC_EF_DEPENDENCY_CACHE_H 14 #include "pxr/exec/ef/api.h" 16 #include "pxr/base/tf/bits.h" 21 #include <tbb/concurrent_vector.h> 24 #include <unordered_map> 27 PXR_NAMESPACE_OPEN_SCOPE
59 std::vector<const VdfNode *> *);
86 const VdfMaskedOutputVector &outputs,
87 bool updateIncrementally)
const;
98 const std::vector<const VdfNode *> &
FindNodes(
99 const VdfMaskedOutputVector &outputs,
100 bool updateIncrementally)
const;
136 _Entry(
bool updateIncrementally)
137 : updateIncrementally(updateIncrementally)
142 bool ContainsNode(
const VdfNode &node)
const {
145 nodeRefs.GetSize() > nodeIndex &&
146 nodeRefs.IsSet(nodeIndex);
149 bool IsValid()
const {
150 return valid.load(std::memory_order_relaxed);
154 valid.store(
false, std::memory_order_relaxed);
161 std::vector<const VdfNode *> nodeDeps;
176 : sourceNodeId(sourceNodeId_)
177 , outputName(outputName_)
178 , targetNodeId(targetNodeId_)
179 , inputName(inputName_)
198 tbb::concurrent_vector<_Connection> newConnections;
210 std::vector<size_t> nodeNumOutputs;
213 bool updateIncrementally;
216 std::atomic<bool> valid;
220 const _Entry & _Find(
221 const VdfMaskedOutputVector &outputs,
222 bool updateIncrementally)
const;
225 const _Entry & _PopulateCache(
226 const VdfMaskedOutputVector& outputs,
227 bool updateIncrementally)
const;
231 const VdfMaskedOutputVector &outputs,
232 _Entry *entry)
const;
236 void _TraversePartially(
238 _Entry *entry)
const;
243 bool _GatherDependenciesForNewConnection(
246 VdfMaskedOutputVector *dependencies)
const;
250 void _GatherDependenciesForExtendedNode(
253 VdfMaskedOutputVector *dependencies)
const;
256 static bool _NodeCallback(
262 static bool _OutputCallback(
273 using _Cache = std::unordered_map<
277 mutable _Cache _cache;
284 PXR_NAMESPACE_CLOSE_SCOPE
A VdfNetwork is a collection of VdfNodes and their connections.
A class that fully represents a connection between two VdfNodes.
EF_API const std::vector< const VdfNode * > & FindNodes(const VdfMaskedOutputVector &outputs, bool updateIncrementally) const
Find the node dependencies associated with the given request.
EF_API EfDependencyCache(PredicateFunction predicate)
Constructor.
This is the base class for all nodes in a VdfNetwork.
VdfId GetId() const
Returns the unique id of this node in its network.
A VdfMask is placed on connections to specify the data flowing through them.
bool(*)(const VdfNode &node, VdfOutputToMaskMap *, std::vector< const VdfNode * > *) PredicateFunction
The predicate function that determines the cached dependencies.
EF_API void WillDeleteConnection(const VdfConnection &connection)
Invalidate all traversals dependent on this connection.
std::vector< VdfMaskedOutput > VdfMaskedOutputVector
A vector of VdfMaskedOutputs.
Token for efficient comparison, assignment, and hashing of known strings.
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manne...
EF_API void Invalidate()
Invalidate all cached dependencies.
EF_API ~EfDependencyCache()
Destructor.
std::unordered_map< const VdfOutput *, VdfMask, TfHash > VdfOutputToMaskMap
A map from output pointer to mask.
A VdfOutput represents an output on a node.
Hashing functor for VdfMaskedOutputVectors.
EF_API const VdfOutputToMaskMap & FindOutputs(const VdfMaskedOutputVector &outputs, bool updateIncrementally) const
Find the output dependencies associated with the given request.
EF_API void DidConnect(const VdfConnection &connection)
Invalidate all traversals dependent on this new connection.
Caches output traversals by associating an input request with a set of stored output dependencies,...
static VdfIndex GetIndexFromId(const VdfId id)
Get the node index from the node id.
uint64_t VdfId
The unique identifier type for Vdf objects.
uint32_t VdfIndex
The index type for Vdf objects.