24 #ifndef PXR_IMAGING_HD_ST_VBO_SIMPLE_MEMORY_MANAGER_H
25 #define PXR_IMAGING_HD_ST_VBO_SIMPLE_MEMORY_MANAGER_H
81 class _SimpleBufferArray;
93 , _bufferArray(nullptr)
99 return (
bool)_bufferArray;
115 _numElements = numElements;
116 return _bufferArray->
Resize(numElements);
187 void DebugDump(std::ostream &out)
const override;
212 std::shared_ptr<_SimpleBufferArray>;
214 std::shared_ptr<_SimpleBufferArrayRange>;
216 std::weak_ptr<_SimpleBufferArrayRange>;
242 void DebugDump(std::ostream &out)
const override;
246 bool Resize(
int numElements);
252 std::vector<HdBufferArrayRangeSharedPtr>
const &ranges,
296 size_t _maxBytesPerElement;
312 #endif // PXR_IMAGING_HD_ST_VBO_SIMPLE_MEMORY_MANAGER_H
int GetCapacity() const
Returns the capacity of allocated area for this range.
HDST_API size_t GetMaxNumElements() const override
Returns the max number of elements.
std::shared_ptr< class HdBufferArray > HdBufferArraySharedPtr
int GetByteOffset(TfToken const &resourceName) const override
HDST_API void CopyData(HdBufferSourceSharedPtr const &bufferSource) override
Copy source data into buffer.
bool IsImmutable() const override
Returns true if this range is marked as immutable.
HDST_API bool IsAssigned() const override
Returns true is the range has been assigned to a buffer.
std::vector< std::pair< TfToken, HdStBufferResourceSharedPtr > > HdStBufferResourceNamedList
HdStResourceRegistry *const _resourceRegistry
**But if you need a result
bool RequiresStaging() const override
Returns true if this needs a staging buffer for CPU to GPU copies.
HDST_API void DebugDump(std::ostream &out) const override
Debug output.
int GetCapacity() const
Returns current capacity. It could be different from numElements.
HDST_API ~_SimpleBufferArray() override
Destructor. It invalidates _range.
HDST_API VtValue ReadData(TfToken const &name) const override
Read back the buffer content.
std::weak_ptr< _SimpleBufferArrayRange > _SimpleBufferArrayRangePtr
HDST_API HdStBufferResourceSharedPtr GetResource() const
bool IsValid() const override
Returns true if this range is valid.
HD_API HdBufferArrayRangePtr GetRange(size_t idx) const
Get the attached range at the specified index.
size_t AggregationId
Aggregation ID.
void IncrementVersion() override
Increment the version of the buffer array.
HDST_API void _DeallocateResources()
size_t GetVersion() const override
Returns the version of the buffer array.
HD_API void IncrementVersion()
Increments the version of this buffer array.
HDST_API void SetBufferArray(HdBufferArray *bufferArray) override
Sets the buffer array associated with this buffer;.
virtual HDST_API HdBufferArrayRangeSharedPtr CreateBufferArrayRange()
Factory for creating HdBufferArrayRange.
HDST_API void Reallocate(std::vector< HdBufferArrayRangeSharedPtr > const &ranges, HdBufferArraySharedPtr const &curRangeOwner) override
HDST_API const void * _GetAggregation() const override
Returns the aggregation container.
GLint GLenum GLboolean GLsizei stride
HDST_API HdBufferArrayUsageHint GetUsageHint() const override
Returns the usage hint from the underlying buffer array.
HDST_API void DebugDump(std::ostream &out) const override
Debug dump.
virtual HDST_API HdStAggregationStrategy::AggregationId ComputeAggregationId(HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint) const
Returns id for given bufferSpecs to be used for aggregation.
GLuint const GLchar * name
std::vector< struct HdBufferSpec > HdBufferSpecVector
HDST_API size_t GetMaxNumElements() const override
Returns the maximum number of elements capacity.
void Invalidate()
Make this range invalid.
std::shared_ptr< class HdStBufferResource > HdStBufferResourceSharedPtr
HDST_API bool GarbageCollect() override
perform compaction if necessary, returns true if it becomes empty.
bool Resize(int numElements) override
_SimpleBufferArrayRange(HdStResourceRegistry *resourceRegistry)
Constructor.
virtual HdBufferSpecVector GetBufferSpecs(HdBufferArraySharedPtr const &bufferArray) const
Returns the buffer specs from a given buffer array.
int GetElementOffset() const override
size_t GetNumElements() const override
Returns the number of elements allocated.
size_t GetVersion() const
HDST_API HdStBufferResourceSharedPtr GetResource() const override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
HDST_API HdStBufferResourceSharedPtr _AddResource(TfToken const &name, HdTupleType tupleType, int offset, int stride)
Adds a new, named GPU resource and returns it.
HDST_API _SimpleBufferArray(HdStResourceRegistry *resourceRegistry, TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
Constructor.
#define PXR_NAMESPACE_CLOSE_SCOPE
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
HDST_API bool Resize(int numElements)
Set to resize buffers. Actual reallocation happens on Reallocate()
HDST_API HdBufferSpecVector GetBufferSpecs() const
Reconstructs the bufferspecs and returns it (for buffer splitting)
HDST_API HdStBufferResourceSharedPtr _AddResource(TfToken const &name, HdTupleType tupleType, int offset, int stride)
Adds a new, named GPU resource and returns it.
HDST_API HdStBufferResourceNamedList const & GetResources() const override
Returns the list of all named GPU resources for this bufferArrayRange.
size_t GetRangeCount() const
How many ranges are attached to the buffer array.
std::shared_ptr< _SimpleBufferArrayRange > _SimpleBufferArrayRangeSharedPtr
HdStVBOSimpleMemoryManager(HdStResourceRegistry *resourceRegistry)
std::shared_ptr< class HdBufferSource > HdBufferSourceSharedPtr
std::shared_ptr< _SimpleBufferArray > _SimpleBufferArraySharedPtr
HdStBufferResourceNamedList const & GetResources() const
Returns the list of all named GPU resources for this bufferArray.
virtual HDST_API HdBufferArraySharedPtr CreateBufferArray(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)
virtual size_t GetResourceAllocation(HdBufferArraySharedPtr const &bufferArray, VtDictionary &result) const
Returns the size of the GPU memory used by the passed buffer array.