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" 26 PXR_NAMESPACE_OPEN_SCOPE
53 return _version.load(std::memory_order_relaxed);
60 const VdfMaskedOutputVector &outputs,
61 bool updateIncrementally);
66 const std::vector<const VdfNode *> &
FindNodes(
67 const VdfMaskedOutputVector &outputs,
68 bool updateIncrementally);
76 const std::vector<const VdfNode *> &
FindNodes(
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<
154 _VectorizedCacheEntry,
156 _VectorizedCache _vectorizedCache;
160 using _SparseCache = TfHashMap<
164 _SparseCache _sparseCache;
170 PXR_NAMESPACE_CLOSE_SCOPE
A class that fully represents a connection between two VdfNodes.
size_t GetVersion() const
Returns the current edit version of the leaf node cache.
This cache is a thin wrapper around the EfDependencyCache.
std::vector< VdfMaskedOutput > VdfMaskedOutputVector
A vector of VdfMaskedOutputs.
EF_API void WillDeleteConnection(const VdfConnection &connection)
Call this to notify the cache of connections that have been deleted.
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manne...
Traverses a VdfNetwork in the input-to-output direction, while treating each output in the traversal ...
EF_API void Clear()
Clear the entire cache.
std::unordered_map< const VdfOutput *, VdfMask, TfHash > VdfOutputToMaskMap
A map from output pointer to mask.
The leaf node indexer tracks leaf nodes added and removed from the network, and associates each leaf ...
EF_API const VdfOutputToMaskMap & FindOutputs(const VdfMaskedOutputVector &outputs, bool updateIncrementally)
Find outputs dependent on the given outputs.
Hashing functor for VdfMaskedOutputVectors.
EF_API void DidConnect(const VdfConnection &connection)
Call this to notify the cache of newly added connections.
Caches output traversals by associating an input request with a set of stored output dependencies,...
EF_API EfLeafNodeCache()
Constructor.
EF_API const std::vector< const VdfNode * > & FindNodes(const VdfMaskedOutputVector &outputs, bool updateIncrementally)
Find leaf nodes dependent on the given outputs.