resourceBindings.h
1 //
2 // Copyright 2020 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_HGI_RESOURCEBINDINGS_H
25 #define PXR_IMAGING_HGI_RESOURCEBINDINGS_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hgi/api.h"
29 #include "pxr/imaging/hgi/buffer.h"
30 #include "pxr/imaging/hgi/enums.h"
31 #include "pxr/imaging/hgi/handle.h"
32 #include "pxr/imaging/hgi/sampler.h"
33 #include "pxr/imaging/hgi/texture.h"
34 #include "pxr/imaging/hgi/types.h"
35 
36 #include <string>
37 #include <vector>
38 
39 
40 PXR_NAMESPACE_OPEN_SCOPE
41 
42 
43 
44 
45 
78 {
79  HGI_API
81 
82  HgiBufferHandleVector buffers;
83  std::vector<uint32_t> offsets;
84  std::vector<uint32_t> sizes;
85  HgiBindResourceType resourceType;
86  uint32_t bindingIndex;
87  HgiShaderStage stageUsage;
88 };
89 using HgiBufferBindDescVector = std::vector<HgiBufferBindDesc>;
90 
91 HGI_API
92 bool operator==(
93  const HgiBufferBindDesc& lhs,
94  const HgiBufferBindDesc& rhs);
95 
96 HGI_API
97 inline bool operator!=(
98  const HgiBufferBindDesc& lhs,
99  const HgiBufferBindDesc& rhs);
100 
124 {
125  HGI_API
127 
128  HgiTextureHandleVector textures;
129  HgiSamplerHandleVector samplers;
130  HgiBindResourceType resourceType;
131  uint32_t bindingIndex;
132  HgiShaderStage stageUsage;
133 };
134 using HgiTextureBindDescVector = std::vector<HgiTextureBindDesc>;
135 
136 HGI_API
137 bool operator==(
138  const HgiTextureBindDesc& lhs,
139  const HgiTextureBindDesc& rhs);
140 
141 HGI_API
142 bool operator!=(
143  const HgiTextureBindDesc& lhs,
144  const HgiTextureBindDesc& rhs);
145 
158 {
159  HGI_API
161 
162  std::string debugName;
163  HgiBufferBindDescVector buffers;
164  HgiTextureBindDescVector textures;
165 };
166 
167 HGI_API
168 bool operator==(
169  const HgiResourceBindingsDesc& lhs,
170  const HgiResourceBindingsDesc& rhs);
171 
172 HGI_API
173 bool operator!=(
174  const HgiResourceBindingsDesc& lhs,
175  const HgiResourceBindingsDesc& rhs);
176 
177 
185 {
186 public:
187  HGI_API
188  virtual ~HgiResourceBindings();
189 
191  HGI_API
192  HgiResourceBindingsDesc const& GetDescriptor() const;
193 
194 protected:
195  HGI_API
197 
198  HgiResourceBindingsDesc _descriptor;
199 
200 private:
201  HgiResourceBindings() = delete;
202  HgiResourceBindings & operator=(const HgiResourceBindings&) = delete;
203  HgiResourceBindings(const HgiResourceBindings&) = delete;
204 };
205 
207 using HgiResourceBindingsHandleVector = std::vector<HgiResourceBindingsHandle>;
208 
223 {
224  HGI_API
226  uint32_t byteOffset,
227  uint32_t index)
228  : buffer(buffer)
229  , byteOffset(byteOffset)
230  , index(index)
231  {
232  }
233 
234  HgiBufferHandle buffer;
235  uint32_t byteOffset;
236  uint32_t index;
237 };
238 
239 using HgiVertexBufferBindingVector = std::vector<HgiVertexBufferBinding>;
240 
241 
242 PXR_NAMESPACE_CLOSE_SCOPE
243 
244 #endif
HGI_API HgiResourceBindingsDesc const & GetDescriptor() const
The descriptor describes the object.
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
Represents a collection of buffers, texture and vertex attributes that will be used by an cmds object...
Describes the binding information of a buffer (or array of buffers).
Describes the binding information of a texture (or array of textures).
Describes a set of resources that are bound to the GPU during encoding.
Describes a buffer to be bound during encoding.