24#ifndef PXR_IMAGING_HD_ST_BUFFER_ARRAY_REGISTRY_H
25#define PXR_IMAGING_HD_ST_BUFFER_ARRAY_REGISTRY_H
28#include "pxr/imaging/hdSt/api.h"
29#include "pxr/imaging/hdSt/strategyBase.h"
31#include "pxr/imaging/hd/bufferArrayRange.h"
32#include "pxr/imaging/hd/bufferSpec.h"
33#include "pxr/imaging/hd/perfLog.h"
35#include "pxr/imaging/hf/perfLog.h"
40#include <tbb/concurrent_unordered_map.h>
42#include <condition_variable>
46PXR_NAMESPACE_OPEN_SCOPE
49using HdBufferArraySharedPtr = std::shared_ptr<class HdBufferArray>;
58 HF_MALLOC_TAG_NEW(
"new HdStBufferArrayRegistry");
70 HdBufferSpecVector
const &bufferSpecs,
71 HdBufferArrayUsageHint usageHint);
98 typedef std::list<HdBufferArraySharedPtr> _HdBufferArraySharedPtrList;
111 _HdBufferArraySharedPtrList bufferArrays;
113 std::condition_variable emptyCondition;
118 _Entry(
const _Entry &other) {
TF_VERIFY(bufferArrays.empty()); }
125 class _EntryIsNotEmpty
128 _EntryIsNotEmpty(
const _Entry &entry) : _entry(entry) {}
131 return (!(_entry.bufferArrays.empty()));
135 const _Entry &_entry;
138 using _BufferArrayIndex = tbb::concurrent_unordered_map<
140 _BufferArrayIndex _entries;
149 void _InsertNewBufferArray(_Entry &entry,
150 const HdBufferArraySharedPtr &expectedTail,
153 HdBufferSpecVector
const &bufferSpecs,
154 HdBufferArrayUsageHint usageHint);
158PXR_NAMESPACE_CLOSE_SCOPE
Aggregation strategy base class.
size_t AggregationId
Aggregation ID.
Manages the pool of buffer arrays.
HDST_API void GarbageCollect()
Frees up buffers that no longer contain any allocated ranges.
HDST_API friend std::ostream & operator<<(std::ostream &out, const HdStBufferArrayRegistry &self)
Debug dump.
HDST_API HdBufferArrayRangeSharedPtr AllocateRange(HdStAggregationStrategy *strategy, TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
Allocate new buffer array range using strategy Thread-Safe.
HDST_API size_t GetResourceAllocation(HdStAggregationStrategy *strategy, VtDictionary &result) const
Generate a report on resources consumed by the managed buffer array.
HDST_API void ReallocateAll(HdStAggregationStrategy *strategy)
Triggers reallocation on all buffers managed by the registry.
Token for efficient comparison, assignment, and hashing of known strings.
A map with string keys and VtValue values.
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...