Loading...
Searching...
No Matches
bufferArrayRange.h
1//
2// Copyright 2017 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_IMAGING_HD_ST_BUFFER_ARRAY_RANGE_H
25#define PXR_IMAGING_HD_ST_BUFFER_ARRAY_RANGE_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdSt/api.h"
29#include "pxr/imaging/hd/version.h"
30#include "pxr/base/tf/token.h"
31#include "pxr/imaging/hd/bufferArrayRange.h"
32
33#include <memory>
34
35PXR_NAMESPACE_OPEN_SCOPE
36
37
38class HdBufferArrayGL;
40
41using HdStBufferArrayRangeSharedPtr =
42 std::shared_ptr<class HdStBufferArrayRange>;
43
45
46using HdStBufferResourceSharedPtr =
47 std::shared_ptr<class HdStBufferResource>;
48using HdStBufferResourceNamedList =
49 std::vector< std::pair<TfToken, HdStBufferResourceSharedPtr> >;
50
60{
61public:
63
69 HDST_API
71
74 virtual HdStBufferResourceSharedPtr GetResource() const = 0;
75
77 virtual HdStBufferResourceSharedPtr GetResource(TfToken const& name) = 0;
78
80 virtual HdStBufferResourceNamedList const& GetResources() const = 0;
81
83 HDST_API
84 virtual void GetBufferSpecs(HdBufferSpecVector *bufferSpecs) const override;
85
86 virtual int GetElementStride() const {
87 return 0;
88 }
89
90protected:
91 HdStResourceRegistry* GetResourceRegistry();
92
93 HdStResourceRegistry* GetResourceRegistry() const;
94
95private:
96 HdStResourceRegistry* _resourceRegistry;
97};
98
99HDST_API
100std::ostream &operator <<(std::ostream &out,
101 const HdStBufferArrayRange &self);
102
108{
109public:
111 HdStBufferArrayRangeContainer(int size) : _ranges(size) { }
112
115 HDST_API
116 void Set(int index, HdStBufferArrayRangeSharedPtr const &range);
117
119 // is out of range or not yet set.
120 HDST_API
121 HdStBufferArrayRangeSharedPtr const &Get(int index) const;
122
123private:
124 std::vector<HdStBufferArrayRangeSharedPtr> _ranges;
125};
126
127
128PXR_NAMESPACE_CLOSE_SCOPE
129
130#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:88
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...