Loading...
Searching...
No Matches
bufferArrayRange.h
1//
2// Copyright 2017 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_ST_BUFFER_ARRAY_RANGE_H
8#define PXR_IMAGING_HD_ST_BUFFER_ARRAY_RANGE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hd/version.h"
13#include "pxr/base/tf/token.h"
14#include "pxr/imaging/hd/bufferArrayRange.h"
15
16#include <memory>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
20
21class HdBufferArrayGL;
23
24using HdStBufferArrayRangeSharedPtr =
25 std::shared_ptr<class HdStBufferArrayRange>;
26
28
29using HdStBufferResourceSharedPtr =
30 std::shared_ptr<class HdStBufferResource>;
31using HdStBufferResourceNamedList =
32 std::vector< std::pair<TfToken, HdStBufferResourceSharedPtr> >;
33
43{
44public:
46
52 HDST_API
54
57 virtual HdStBufferResourceSharedPtr GetResource() const = 0;
58
60 virtual HdStBufferResourceSharedPtr GetResource(TfToken const& name) = 0;
61
63 virtual HdStBufferResourceNamedList const& GetResources() const = 0;
64
66 HDST_API
67 virtual void GetBufferSpecs(HdBufferSpecVector *bufferSpecs) const override;
68
69 virtual int GetElementStride() const {
70 return 0;
71 }
72
73protected:
74 HdStResourceRegistry* GetResourceRegistry();
75
76 HdStResourceRegistry* GetResourceRegistry() const;
77
78private:
79 HdStResourceRegistry* _resourceRegistry;
80};
81
82HDST_API
83std::ostream &operator <<(std::ostream &out,
84 const HdStBufferArrayRange &self);
85
91{
92public:
94 HdStBufferArrayRangeContainer(int size) : _ranges(size) { }
95
98 HDST_API
99 void Set(int index, HdStBufferArrayRangeSharedPtr const &range);
100
102 // is out of range or not yet set.
103 HDST_API
104 HdStBufferArrayRangeSharedPtr const &Get(int index) const;
105
106private:
107 std::vector<HdStBufferArrayRangeSharedPtr> _ranges;
108};
109
110
111PXR_NAMESPACE_CLOSE_SCOPE
112
113#endif // HD_BUFFER_ARRAY_RANGE_GL_H
Interface class for representing range (subset) locator of HdBufferArray.
A resizable container of HdBufferArrayRanges.
HdStBufferArrayRangeContainer(int size)
Constructor.
HDST_API HdStBufferArrayRangeSharedPtr const & Get(int index) const
Returns the bar at index. returns null if either the index.
HDST_API void Set(int index, HdStBufferArrayRangeSharedPtr const &range)
Set range into the container at index.
Interface class for representing range (subset) locator of HdBufferArray.
virtual HdStBufferResourceSharedPtr GetResource() const =0
Returns the GPU resource.
virtual HDST_API ~HdStBufferArrayRange()
Destructor (do nothing).
virtual HDST_API void GetBufferSpecs(HdBufferSpecVector *bufferSpecs) const override
Sets the bufferSpecs for all resources.
virtual HdStBufferResourceSharedPtr GetResource(TfToken const &name)=0
Returns the named GPU resource.
virtual HdStBufferResourceNamedList const & GetResources() const =0
Returns the list of all named GPU resources for this bufferArrayRange.
A GPU resource contained within an underlying HgiBuffer.
A central registry of all GPU resources.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...