7#ifndef PXR_EXEC_VDF_SPARSE_VECTORIZED_INPUT_TRAVERSER_H
8#define PXR_EXEC_VDF_SPARSE_VECTORIZED_INPUT_TRAVERSER_H
14#include "pxr/exec/vdf/api.h"
22#include "pxr/base/tf/hashmap.h"
26#include <unordered_map>
29PXR_NAMESPACE_OPEN_SCOPE
92 const VdfMaskedOutputVector &sharedMaskedOutputs,
119 const VdfMaskedOutputVector &sharedMaskedOutputs,
128 class _MasksToRequestsMap
133 _MaskToRequestBitsMap;
138 _MasksToRequestsMap(
size_t numRequests = 0)
139 : _numRequests(numRequests) {}
142 _MasksToRequestsMap(
const VdfMask &mask,
const TfBits &requestBits)
143 : _numRequests(requestBits.GetSize()) {
144 _maskToRequestBitsMap[mask] = requestBits;
148 void AddMask(
const VdfMask &mask,
size_t requestIndex) {
152 std::pair<_MaskToRequestBitsMap::iterator, bool> res =
153 _maskToRequestBitsMap.
insert(std::make_pair(mask, empty));
156 res.first->second.Resize(_numRequests);
157 res.first->second.ClearAll();
160 TF_VERIFY(!res.first->second.IsSet(requestIndex));
161 res.first->second.Set(requestIndex);
165 void AddMask(
const VdfMask &mask,
const TfBits &requestBits) {
167 std::pair<_MaskToRequestBitsMap::iterator, bool> res =
168 _maskToRequestBitsMap.
insert(std::make_pair(mask, requestBits));
174 res.first->second |= requestBits;
180 const_iterator begin()
const {
181 return _maskToRequestBitsMap.
begin();
184 const_iterator end()
const {
185 return _maskToRequestBitsMap.
end();
196 _MaskToRequestBitsMap _maskToRequestBitsMap;
200 void _Traverse(
const VdfMaskedOutputVector &sharedMaskedOutputs);
203 void _TraverseOutput(
205 const _MasksToRequestsMap &masks);
226 TfHashMap<const VdfConnection *, _MasksToRequestsMap, TfHash>
229 _VisitedConnections _visitedConnections;
235 std::unordered_map<const VdfOutput *, _MasksToRequestsMap, TfHash>
241 typedef std::pair<const VdfOutput *, _MasksToRequestsMap> _PrioritizedOutput;
250 std::greater<VdfPoolChainIndex> > _PrioritizedOutputMap;
252 _PrioritizedOutputMap _prioritizedOutputs;
255 _MasksToRequestsMap _emptyRequestToMaskMap;
258PXR_NAMESPACE_CLOSE_SCOPE
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manne...
This is a space efficient container that mimics the TfHashMap API that uses a vector for storage when...
_IteratorBase< const value_type, typename _Vector::const_iterator > const_iterator
insert_result insert(const value_type &v)
Returns a pair of <iterator, bool> where iterator points to the element in the list and bool is true ...
iterator end()
Returns an const_iterator pointing to the end of the map.
iterator begin()
Returns an const_iterator pointing to the beginning of the map.
A class that fully represents a connection between two VdfNodes.
A VdfMask is placed on connections to specify the data flowing through them.
This is the base class for all nodes in a VdfNetwork.
A VdfOutput represents an output on a node.
Opaque pool chain index type.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.