Loading...
Searching...
No Matches
HdBufferArray Class Referenceabstract

Similar to a VAO, this object is a bundle of coherent buffers. More...

#include <bufferArray.h>

+ Inheritance diagram for HdBufferArray:

Public Member Functions

HD_API HdBufferArray (TfToken const &role, TfToken const garbageCollectionPerfToken, HdBufferArrayUsageHint usageHint)
 
TfToken const & GetRole () const
 Returns the role of the GPU data in this bufferArray.
 
size_t GetVersion () const
 Returns the version of this buffer array.
 
HD_API void IncrementVersion ()
 Increments the version of this buffer array.
 
HD_API bool TryAssignRange (HdBufferArrayRangeSharedPtr &range)
 Attempts to assign a range to this buffer array.
 
virtual bool GarbageCollect ()=0
 Performs compaction if necessary and returns true if it becomes empty.
 
virtual void Reallocate (std::vector< HdBufferArrayRangeSharedPtr > const &ranges, HdBufferArraySharedPtr const &curRangeOwner)=0
 Performs reallocation.
 
virtual HD_API size_t GetMaxNumElements () const
 Returns the maximum number of elements capacity.
 
virtual void DebugDump (std::ostream &out) const =0
 Debug output.
 
size_t GetRangeCount () const
 How many ranges are attached to the buffer array.
 
HD_API HdBufferArrayRangePtr GetRange (size_t idx) const
 Get the attached range at the specified index.
 
HD_API void RemoveUnusedRanges ()
 Remove any ranges from the range list that have been deallocated Returns number of ranges after clean-up.
 
bool NeedsReallocation () const
 Returns true if Reallocate() needs to be called on this buffer array.
 
bool IsImmutable () const
 Returns true if this buffer array is marked as immutable.
 
HdBufferArrayUsageHint GetUsageHint () const
 Returns the usage hints for this buffer array.
 

Protected Member Functions

void _SetMaxNumRanges (size_t max)
 Limits the number of ranges that can be allocated to this buffer to max.
 
HD_API void _SetRangeList (std::vector< HdBufferArrayRangeSharedPtr > const &ranges)
 Swap the rangelist with ranges.
 

Protected Attributes

bool _needsReallocation
 Dirty bit to set when the ranges attached to the buffer changes.
 

Detailed Description

Similar to a VAO, this object is a bundle of coherent buffers.

This object can be shared across multiple HdRprims, in the context of buffer aggregation.

Definition at line 85 of file bufferArray.h.

Member Function Documentation

◆ _SetMaxNumRanges()

void _SetMaxNumRanges ( size_t  max)
inlineprotected

Limits the number of ranges that can be allocated to this buffer to max.

Definition at line 168 of file bufferArray.h.

◆ _SetRangeList()

HD_API void _SetRangeList ( std::vector< HdBufferArrayRangeSharedPtr > const &  ranges)
protected

Swap the rangelist with ranges.

◆ DebugDump()

virtual void DebugDump ( std::ostream &  out) const
pure virtual

◆ GarbageCollect()

virtual bool GarbageCollect ( )
pure virtual

◆ GetMaxNumElements()

virtual HD_API size_t GetMaxNumElements ( ) const
virtual

Returns the maximum number of elements capacity.

Reimplemented in HdStVBOMemoryManager::_StripedBufferArray, and HdStVBOSimpleMemoryManager::_SimpleBufferArray.

◆ GetRange()

HD_API HdBufferArrayRangePtr GetRange ( size_t  idx) const

Get the attached range at the specified index.

◆ GetRangeCount()

size_t GetRangeCount ( ) const
inline

How many ranges are attached to the buffer array.

Definition at line 135 of file bufferArray.h.

◆ GetRole()

TfToken const & GetRole ( ) const
inline

Returns the role of the GPU data in this bufferArray.

Definition at line 97 of file bufferArray.h.

◆ GetUsageHint()

HdBufferArrayUsageHint GetUsageHint ( ) const
inline

Returns the usage hints for this buffer array.

Definition at line 157 of file bufferArray.h.

◆ GetVersion()

size_t GetVersion ( ) const
inline

Returns the version of this buffer array.

Used to determine when to rebuild outdated indirect dispatch buffers

Definition at line 101 of file bufferArray.h.

◆ IncrementVersion()

HD_API void IncrementVersion ( )

Increments the version of this buffer array.

◆ IsImmutable()

bool IsImmutable ( ) const
inline

Returns true if this buffer array is marked as immutable.

Definition at line 152 of file bufferArray.h.

◆ NeedsReallocation()

bool NeedsReallocation ( ) const
inline

Returns true if Reallocate() needs to be called on this buffer array.

Definition at line 147 of file bufferArray.h.

◆ Reallocate()

virtual void Reallocate ( std::vector< HdBufferArrayRangeSharedPtr > const &  ranges,
HdBufferArraySharedPtr const &  curRangeOwner 
)
pure virtual

Performs reallocation.

After reallocation, the buffer will contain the specified ranges. If these ranges are currently held by a different buffer array instance, then their data will be copied from the specified curRangeOwner.

Implemented in HdStDispatchBuffer, HdStInterleavedMemoryManager::_StripedInterleavedBuffer, HdStVBOMemoryManager::_StripedBufferArray, and HdStVBOSimpleMemoryManager::_SimpleBufferArray.

◆ RemoveUnusedRanges()

HD_API void RemoveUnusedRanges ( )

Remove any ranges from the range list that have been deallocated Returns number of ranges after clean-up.

◆ TryAssignRange()

HD_API bool TryAssignRange ( HdBufferArrayRangeSharedPtr &  range)

Attempts to assign a range to this buffer array.

Multiple threads could be trying to assign to this buffer at the same time. Returns true is the range is assigned to this buffer otherwise returns false if the buffer doesn't have space to assign the range.

Member Data Documentation

◆ _needsReallocation

bool _needsReallocation
protected

Dirty bit to set when the ranges attached to the buffer changes.

If set Reallocate() should be called to clean it.

Definition at line 164 of file bufferArray.h.


The documentation for this class was generated from the following file: