7#ifndef PXR_IMAGING_HD_ST_BUFFER_ARRAY_REGISTRY_H
8#define PXR_IMAGING_HD_ST_BUFFER_ARRAY_REGISTRY_H
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hdSt/strategyBase.h"
14#include "pxr/imaging/hd/bufferArrayRange.h"
15#include "pxr/imaging/hd/bufferSpec.h"
16#include "pxr/imaging/hd/perfLog.h"
18#include "pxr/imaging/hf/perfLog.h"
23#include <tbb/concurrent_unordered_map.h>
25#include <condition_variable>
29PXR_NAMESPACE_OPEN_SCOPE
32using HdBufferArraySharedPtr = std::shared_ptr<class HdBufferArray>;
41 HF_MALLOC_TAG_NEW(
"new HdStBufferArrayRegistry");
53 HdBufferSpecVector
const &bufferSpecs,
54 HdBufferArrayUsageHint usageHint);
81 typedef std::list<HdBufferArraySharedPtr> _HdBufferArraySharedPtrList;
94 _HdBufferArraySharedPtrList bufferArrays;
96 std::condition_variable emptyCondition;
101 _Entry(
const _Entry &other) {
TF_VERIFY(bufferArrays.empty()); }
108 class _EntryIsNotEmpty
111 _EntryIsNotEmpty(
const _Entry &entry) : _entry(entry) {}
114 return (!(_entry.bufferArrays.empty()));
118 const _Entry &_entry;
121 using _BufferArrayIndex = tbb::concurrent_unordered_map<
123 _BufferArrayIndex _entries;
132 void _InsertNewBufferArray(_Entry &entry,
133 const HdBufferArraySharedPtr &expectedTail,
136 HdBufferSpecVector
const &bufferSpecs,
137 HdBufferArrayUsageHint usageHint);
141PXR_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...