24 #ifndef PXR_IMAGING_HD_BUFFER_ARRAY_REGISTRY_H 25 #define PXR_IMAGING_HD_BUFFER_ARRAY_REGISTRY_H 28 #include "pxr/imaging/hd/api.h" 29 #include "pxr/imaging/hd/version.h" 31 #include "pxr/imaging/hd/bufferArrayRange.h" 32 #include "pxr/imaging/hd/bufferSpec.h" 33 #include "pxr/imaging/hd/perfLog.h" 34 #include "pxr/imaging/hd/strategyBase.h" 36 #include "pxr/imaging/hf/perfLog.h" 41 #include <tbb/concurrent_unordered_map.h> 43 #include <condition_variable> 47 PXR_NAMESPACE_OPEN_SCOPE
50 using HdBufferArraySharedPtr = std::shared_ptr<class HdBufferArray>;
59 HF_MALLOC_TAG_NEW(
"new HdBufferArrayRegistry");
71 HdBufferSpecVector
const &bufferSpecs,
99 typedef std::list<HdBufferArraySharedPtr> _HdBufferArraySharedPtrList;
112 _HdBufferArraySharedPtrList bufferArrays;
114 std::condition_variable emptyCondition;
119 _Entry(
const _Entry &other) {
TF_VERIFY(bufferArrays.empty()); }
126 class _EntryIsNotEmpty
129 _EntryIsNotEmpty(
const _Entry &entry) : _entry(entry) {}
132 return (!(_entry.bufferArrays.empty()));
136 const _Entry &_entry;
139 typedef tbb::concurrent_unordered_map< HdAggregationStrategy::AggregationId, _Entry> _BufferArrayIndex;
141 _BufferArrayIndex _entries;
150 void _InsertNewBufferArray(_Entry &entry,
151 const HdBufferArraySharedPtr &expectedTail,
154 HdBufferSpecVector
const &bufferSpecs,
159 PXR_NAMESPACE_CLOSE_SCOPE
161 #endif // PXR_IMAGING_HD_BUFFER_ARRAY_REGISTRY_H The union provides a set of flags that provide hints to the memory management system about the proper...
HD_API void ReallocateAll(HdAggregationStrategy *strategy)
Triggers reallocation on all buffers managed by the registry.
Aggregation strategy base class.
A map with string keys and VtValue values.
HD_API size_t GetResourceAllocation(HdAggregationStrategy *strategy, VtDictionary &result) const
Generate a report on resources consumed by the managed buffer array.
Manages the pool of buffer arrays.
HD_API void GarbageCollect()
Frees up buffers that no longer contain any allocated ranges.
Token for efficient comparison, assignment, and hashing of known strings.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
HD_API HdBufferArrayRangeSharedPtr AllocateRange(HdAggregationStrategy *strategy, TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
Allocate new buffer array range using strategy Thread-Safe.
HD_API friend std::ostream & operator<<(std::ostream &out, const HdBufferArrayRegistry &self)
Debug dump.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...