7#ifndef PXR_EXEC_EF_LEAF_NODE_CACHE_H
8#define PXR_EXEC_EF_LEAF_NODE_CACHE_H
14#include "pxr/exec/ef/api.h"
18#include "pxr/base/tf/hashmap.h"
26PXR_NAMESPACE_OPEN_SCOPE
53 return _version.load(std::memory_order_relaxed);
60 const VdfMaskedOutputVector &outputs,
61 bool updateIncrementally);
67 const VdfMaskedOutputVector &outputs,
68 bool updateIncrementally);
77 const VdfMaskedOutputVector &outputs,
78 const TfBits &outputsMask);
105 struct _VectorizedCacheEntry {
106 std::vector<TfBits> leafNodes;
107 TfHashMap<TfBits, TfBits, TfBits::FastHash> combinedLeafNodes;
111 struct _SparseCacheEntry {
112 std::vector<const VdfNode *> nodes;
119 void _ClearCachesIfInvalid();
123 const TfBits &outputsMask,
124 const std::vector<TfBits> &leafNodes)
const;
127 _VectorizedCacheEntry *_PopulateVectorizedEntry(
128 const VdfMaskedOutputVector &outputs);
132 _SparseCacheEntry *_PopulateSparseEntry(
133 const VdfMaskedOutputVector &outputs,
137 std::atomic<size_t> _version;
141 std::atomic<bool> _cachesAreInvalid;
152 using _VectorizedCache = TfHashMap<
153 VdfMaskedOutputVector,
154 _VectorizedCacheEntry,
156 _VectorizedCache _vectorizedCache;
160 using _SparseCache = TfHashMap<
161 VdfMaskedOutputVector,
164 _SparseCache _sparseCache;
170PXR_NAMESPACE_CLOSE_SCOPE
The leaf node indexer tracks leaf nodes added and removed from the network, and associates each leaf ...
Caches output traversals by associating an input request with a set of stored output dependencies,...
This cache is a thin wrapper around the EfDependencyCache.
EF_API EfLeafNodeCache()
Constructor.
EF_API void DidConnect(const VdfConnection &connection)
Call this to notify the cache of newly added connections.
EF_API void WillDeleteConnection(const VdfConnection &connection)
Call this to notify the cache of connections that have been deleted.
EF_API const VdfOutputToMaskMap & FindOutputs(const VdfMaskedOutputVector &outputs, bool updateIncrementally)
Find outputs dependent on the given outputs.
EF_API void Clear()
Clear the entire cache.
EF_API const std::vector< const VdfNode * > & FindNodes(const VdfMaskedOutputVector &outputs, const TfBits &outputsMask)
Find all leaf nodes dependent on the given outputs, but only return the nodes dependent on the reques...
EF_API const std::vector< const VdfNode * > & FindNodes(const VdfMaskedOutputVector &outputs, bool updateIncrementally)
Find leaf nodes dependent on the given outputs.
size_t GetVersion() const
Returns the current edit version of the leaf node cache.
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manne...
A class that fully represents a connection between two VdfNodes.
Traverses a VdfNetwork in the input-to-output direction, while treating each output in the traversal ...
std::unordered_map< const VdfOutput *, VdfMask, TfHash > VdfOutputToMaskMap
A map from output pointer to mask.
Hashing functor for VdfMaskedOutputVectors.