24 #ifndef PXR_IMAGING_HD_ST_VBO_MEMORY_MANAGER_H
25 #define PXR_IMAGING_HD_ST_VBO_MEMORY_MANAGER_H
36 #include "pxr/base/tf/mallocTag.h"
86 class _StripedBufferArray;
95 _stripedBufferArray(nullptr),
108 return (
bool)_stripedBufferArray;
124 bool Resize(
int numElements)
override;
136 return _elementOffset;
185 void DebugDump(std::ostream &out)
const override;
194 _numElements = numElements;
204 _capacity = capacity;
209 _stripedBufferArray = NULL;
232 std::shared_ptr<_StripedBufferArray>;
234 std::shared_ptr<_StripedBufferArrayRange>;
236 std::weak_ptr<_StripedBufferArrayRange>;
260 void DebugDump(std::ostream &out)
const override;
266 std::vector<HdBufferArrayRangeSharedPtr>
const &ranges,
280 _needsCompaction =
true;
297 {
return _resourceList;}
317 bool _needsCompaction;
319 size_t _maxBytesPerElement;
334 #endif // PXR_IMAGING_HD_ST_VBO_MEMORY_MANAGER_H
int GetByteOffset(TfToken const &resourceName) const override
HDST_API const void * _GetAggregation() const override
Returns the aggregation container.
bool IsImmutable() const override
Returns true if this bar is marked as immutable.
bool IsValid() const override
Returns true if this range is valid.
std::shared_ptr< class HdBufferArray > HdBufferArraySharedPtr
void SetNeedsCompaction()
Mark to perform compaction on GarbageCollect()
_StripedBufferArrayRange(HdStResourceRegistry *resourceRegistry)
Constructor.
HDST_API void _DeallocateResources()
HDST_API void CopyData(HdBufferSourceSharedPtr const &bufferSource) override
Copy source data into buffer.
virtual HDST_API HdBufferArrayRangeSharedPtr CreateBufferArrayRange()
std::vector< std::pair< TfToken, HdStBufferResourceSharedPtr > > HdStBufferResourceNamedList
HDST_API VtValue ReadData(TfToken const &name) const override
Read back the buffer content.
void IncrementVersion() override
Increment the version of the buffer array.
HDST_API bool GarbageCollect() override
HDST_API ~_StripedBufferArray() override
Destructor. It invalidates _rangeList.
HDST_API ~_StripedBufferArrayRange() override
Destructor.
**But if you need a result
HDST_API bool Resize(int numElements) override
HDST_API size_t GetMaxNumElements() const override
Returns the maximum number of elements capacity.
HD_API HdBufferArrayRangePtr GetRange(size_t idx) const
Get the attached range at the specified index.
size_t AggregationId
Aggregation ID.
HdStBufferResourceNamedList const & GetResources() const
Returns the list of all named GPU resources for this bufferArray.
HDST_API void Reallocate(std::vector< HdBufferArrayRangeSharedPtr > const &ranges, HdBufferArraySharedPtr const &curRangeOwner) override
HD_API void IncrementVersion()
Increments the version of this buffer array.
HdStVBOMemoryManager(HdStResourceRegistry *resourceRegistry)
bool RequiresStaging() const override
Returns true if this needs a staging buffer for CPU to GPU copies.
virtual size_t GetResourceAllocation(HdBufferArraySharedPtr const &bufferArray, VtDictionary &result) const
Returns the size of the GPU memory used by the passed buffer array.
int GetElementOffset() const override
Returns the relative element offset in aggregated buffer.
size_t GetNumElements() const override
Returns the number of elements.
std::weak_ptr< _StripedBufferArrayRange > _StripedBufferArrayRangePtr
GLint GLenum GLboolean GLsizei stride
HDST_API bool IsAssigned() const override
Returns true is the range has been assigned to a buffer.
HDST_API _StripedBufferArray(HdStResourceRegistry *resourceRegistry, TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
Constructor.
HDST_API void DebugDump(std::ostream &out) const override
Debug output.
HDST_API HdStBufferResourceSharedPtr _AddResource(TfToken const &name, HdTupleType tupleType, int offset, int stride)
Adds a new, named GPU resource and returns it.
void SetElementOffset(int offset)
Set the relative offset for this range.
std::shared_ptr< _StripedBufferArray > _StripedBufferArraySharedPtr
GLuint const GLchar * name
std::vector< struct HdBufferSpec > HdBufferSpecVector
int GetCapacity() const
Returns the capacity of allocated area.
std::shared_ptr< class HdStBufferResource > HdStBufferResourceSharedPtr
HDST_API HdStBufferResourceNamedList const & GetResources() const override
Returns the list of all named GPU resources for this bufferArrayRange.
size_t GetVersion() const
HDST_API void DebugDump(std::ostream &out) const override
Debug dump.
HDST_API HdBufferArrayUsageHint GetUsageHint() const override
Returns the usage hint from the underlying buffer array.
void Invalidate()
Make this range invalid.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
HDST_API HdBufferSpecVector GetBufferSpecs() const
Reconstructs the bufferspecs and returns it (for buffer splitting)
void SetNumElements(int numElements)
Set the number of elements for this range.
size_t GetVersion() const override
Returns the version of the buffer array.
#define PXR_NAMESPACE_CLOSE_SCOPE
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
void SetNeedsReallocation()
Mark to perform reallocation on Reallocate()
HDST_API size_t GetMaxNumElements() const override
Returns the max number of elements.
HDST_API HdStBufferResourceSharedPtr GetResource() const
virtual HDST_API AggregationId ComputeAggregationId(HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint) const
Returns id for given bufferSpecs to be used for aggregation.
specialized buffer array range
HDST_API void SetBufferArray(HdBufferArray *bufferArray) override
Sets the buffer array associated with this buffer;.
void SetCapacity(int capacity)
Set the capacity of allocated area for this range.
std::shared_ptr< class HdBufferSource > HdBufferSourceSharedPtr
HDST_API HdStBufferResourceSharedPtr GetResource() const override
HdStResourceRegistry * _resourceRegistry
std::shared_ptr< _StripedBufferArrayRange > _StripedBufferArrayRangeSharedPtr
virtual HDST_API HdBufferArraySharedPtr CreateBufferArray(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
virtual HdBufferSpecVector GetBufferSpecs(HdBufferArraySharedPtr const &bufferArray) const
Returns the buffer specs from a given buffer array.