24 #ifndef PXR_IMAGING_HD_BUFFER_ARRAY_H
25 #define PXR_IMAGING_HD_BUFFER_ARRAY_H
87 class HdBufferArray :
public std::enable_shared_from_this<HdBufferArray>
92 TfToken const garbageCollectionPerfToken,
126 std::vector<HdBufferArrayRangeSharedPtr>
const &ranges,
134 virtual void DebugDump(std::ostream &out)
const = 0;
174 void _SetRangeList(std::vector<HdBufferArrayRangeSharedPtr>
const &ranges);
180 HdBufferArray &operator=(
const HdBufferArray &) =
delete;
183 typedef std::vector<HdBufferArrayRangePtr> _RangeList;
190 _RangeList _rangeList;
191 std::atomic_size_t _rangeCount;
192 std::mutex _rangeListLock;
195 const TfToken _garbageCollectionPerfToken;
199 size_t _maxNumRanges;
206 #endif //PXR_IMAGING_HD_BUFFER_ARRAY_H
virtual bool GarbageCollect()=0
Performs compaction if necessary and returns true if it becomes empty.
bool NeedsReallocation() const
Returns true if Reallocate() needs to be called on this buffer array.
TfToken const & GetRole() const
Returns the role of the GPU data in this bufferArray.
std::shared_ptr< class HdBufferArray > HdBufferArraySharedPtr
struct HdBufferArrayUsageHint::_Bits bits
void _SetMaxNumRanges(size_t max)
bool IsImmutable() const
Returns true if this buffer array is marked as immutable.
HD_API void _SetRangeList(std::vector< HdBufferArrayRangeSharedPtr > const &ranges)
Swap the rangelist with ranges.
virtual void Reallocate(std::vector< HdBufferArrayRangeSharedPtr > const &ranges, HdBufferArraySharedPtr const &curRangeOwner)=0
virtual HD_API size_t GetMaxNumElements() const
Returns the maximum number of elements capacity.
HD_API HdBufferArrayRangePtr GetRange(size_t idx) const
Get the attached range at the specified index.
HD_API void IncrementVersion()
Increments the version of this buffer array.
HD_API bool TryAssignRange(HdBufferArrayRangeSharedPtr &range)
virtual void DebugDump(std::ostream &out) const =0
Debug output.
virtual HD_API ~HdBufferArray()
size_t GetVersion() const
HdBufferArrayUsageHint GetUsageHint() const
Returns the usage hints for this buffer array.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
HD_API HdBufferArray(TfToken const &role, TfToken const garbageCollectionPerfToken, HdBufferArrayUsageHint usageHint)
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define PXR_NAMESPACE_CLOSE_SCOPE
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
size_t GetRangeCount() const
How many ranges are attached to the buffer array.
HD_API void RemoveUnusedRanges()
std::weak_ptr< HdBufferArrayRange > HdBufferArrayRangePtr