7 #ifndef PXR_EXEC_VDF_EXECUTOR_DATA_VECTOR_H
8 #define PXR_EXEC_VDF_EXECUTOR_DATA_VECTOR_H
21 #include <tbb/concurrent_vector.h>
81 return &_bufferData[handle];
91 return &_invalidationData[handle];
102 return _outputData[handle].invalidationTimestamp;
113 _outputData[handle].invalidationTimestamp = ts;
124 return _smblData[handle].get();
134 if (!_smblData[handle]) {
137 return _smblData[handle].get();
147 return _outputData[handle].touched;
157 _outputData[handle].touched =
true;
167 const bool wasTouched = _outputData[handle].touched;
168 _outputData[handle].touched =
false;
175 return _locations.size();
181 return _bufferData.size();
199 _OutputData(
const VdfId oid) :
201 invalidationTimestamp(
208 invalidationTimestamp =
219 using _LocationsSegment = uint32_t *;
224 _LocationsSegment _CreateSegment(
size_t segmentIndex);
228 inline void _CreateData(
const VdfId outputId);
231 constexpr
static size_t _InitialExecutorDataNum = 1000;
235 constexpr
static size_t _SegmentSize = 4096;
238 std::vector<_LocationsSegment> _locations;
244 tbb::concurrent_vector<_OutputData> _outputData;
245 tbb::concurrent_vector<VdfExecutorBufferData> _bufferData;
246 tbb::concurrent_vector<VdfExecutorInvalidationData> _invalidationData;
247 tbb::concurrent_vector<std::unique_ptr<VdfSMBLData>> _smblData;
260 const size_t segmentIndex = outputIndex / _SegmentSize;
264 _LocationsSegment segment = _locations[segmentIndex];
266 segment = _CreateSegment(segmentIndex);
270 const size_t segmentOffset = outputIndex & (_SegmentSize - 1);
271 uint32_t *
const location = &segment[segmentOffset];
279 if (*location >= numData ||
281 _outputData[*location].outputId)) {
283 _CreateData(outputId);
290 else if (outputId != _outputData[*location].outputId) {
291 Reset(*location, outputId);
305 const size_t segmentIndex = outputIndex / _SegmentSize;
309 if (segmentIndex >= _locations.size() || !_locations[segmentIndex]) {
317 const size_t segmentOffset = outputIndex & (_SegmentSize - 1);
318 const uint32_t
location = _locations[segmentIndex][segmentOffset];
328 _outputData[handle].Reset(outputId);
329 _bufferData[handle].Reset();
330 _invalidationData[handle].Reset();
331 _smblData[handle].reset();
335 Vdf_ExecutorDataVector::_CreateData(
const VdfId outputId)
337 _outputData.emplace_back(outputId);
338 _bufferData.emplace_back();
339 _invalidationData.emplace_back();
340 _smblData.emplace_back();
VdfSMBLData * GetOrCreateSMBLData(const DataHandle handle)
bool IsTouched(const DataHandle handle)
void Touch(const DataHandle handle)
#define PXR_NAMESPACE_OPEN_SCOPE
VDF_API void Resize(const VdfNetwork &network)
DataHandle GetDataHandle(const VdfId outputId) const
static constexpr VdfInvalidationTimestamp InitialInvalidationTimestamp
bool Untouch(const DataHandle handle)
#define TF_DEV_AXIOM(cond)
VdfExecutorInvalidationData * GetInvalidationData(const DataHandle handle)
void Reset(const DataHandle handle, const VdfId outputId)
VdfSMBLData holds per-output data that is meant to be consumed by the executor. This data is an optio...
void SetInvalidationTimestamp(const DataHandle &handle, VdfInvalidationTimestamp ts)
VdfSMBLData * GetSMBLData(const DataHandle handle) const
This object is responsible for storing the executor buffer data, comprised of the executor cache vect...
VdfExecutorBufferData * GetBufferData(const DataHandle handle)
VdfInvalidationTimestamp GetInvalidationTimestamp(const DataHandle handle) const
size_t GetNumData() const
A vector-like container for executor data used by the VdfDataManagerVector. Unlike a hash-map...
static VdfIndex GetIndexFromId(const VdfId id)
unsigned int VdfInvalidationTimestamp
Type of the timestamp that identifies the most recent round of invalidation.
#define PXR_NAMESPACE_CLOSE_SCOPE
VDF_API ~Vdf_ExecutorDataVector()
static const size_t InvalidHandle
DataHandle GetOrCreateDataHandle(const VdfId outputId)
uint64_t VdfId
The unique identifier type for Vdf objects.
uint32_t VdfIndex
The index type for Vdf objects.