All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdBufferArray Class Referenceabstract

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

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

Protected Member Functions

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

Protected Attributes

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

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 88 of file bufferArray.h.

Member Function Documentation

void _SetMaxNumRanges ( size_t  max)
inlineprotected

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

Definition at line 171 of file bufferArray.h.

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

Swap the rangelist with ranges.

virtual void DebugDump ( std::ostream &  out) const
pure virtual
virtual bool GarbageCollect ( )
pure virtual
virtual HD_API size_t GetMaxNumElements ( ) const
virtual

Returns the maximum number of elements capacity.

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

HD_API HdBufferArrayRangePtr GetRange ( size_t  idx) const

Get the attached range at the specified index.

size_t GetRangeCount ( ) const
inline

How many ranges are attached to the buffer array.

Definition at line 138 of file bufferArray.h.

TfToken const& GetRole ( ) const
inline

Returns the role of the GPU data in this bufferArray.

Definition at line 100 of file bufferArray.h.

HdBufferArrayUsageHint GetUsageHint ( ) const
inline

Returns the usage hints for this buffer array.

Definition at line 160 of file bufferArray.h.

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 104 of file bufferArray.h.

HD_API void IncrementVersion ( )

Increments the version of this buffer array.

bool IsImmutable ( ) const
inline

Returns true if this buffer array is marked as immutable.

Definition at line 155 of file bufferArray.h.

bool NeedsReallocation ( ) const
inline

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

Definition at line 150 of file bufferArray.h.

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 HdStVBOMemoryManager::_StripedBufferArray, HdStVBOSimpleMemoryManager::_SimpleBufferArray, HdStInterleavedMemoryManager::_StripedInterleavedBuffer, and HdStDispatchBuffer.

HD_API void RemoveUnusedRanges ( )

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

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

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 167 of file bufferArray.h.


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