resourceBindings.h
1 //
2 // Copyright 2020 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_HGI_RESOURCEBINDINGS_H
8 #define PXR_IMAGING_HGI_RESOURCEBINDINGS_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hgi/api.h"
12 #include "pxr/imaging/hgi/buffer.h"
13 #include "pxr/imaging/hgi/enums.h"
14 #include "pxr/imaging/hgi/handle.h"
15 #include "pxr/imaging/hgi/sampler.h"
16 #include "pxr/imaging/hgi/texture.h"
17 #include "pxr/imaging/hgi/types.h"
18 
19 #include <string>
20 #include <vector>
21 
22 
23 PXR_NAMESPACE_OPEN_SCOPE
24 
25 
26 
27 
28 
63 {
64  HGI_API
66 
67  HgiBufferHandleVector buffers;
68  std::vector<uint32_t> offsets;
69  std::vector<uint32_t> sizes;
70  HgiBindResourceType resourceType;
71  uint32_t bindingIndex;
72  HgiShaderStage stageUsage;
73  bool writable;
74 };
75 using HgiBufferBindDescVector = std::vector<HgiBufferBindDesc>;
76 
77 HGI_API
78 bool operator==(
79  const HgiBufferBindDesc& lhs,
80  const HgiBufferBindDesc& rhs);
81 
82 HGI_API
83 bool operator!=(
84  const HgiBufferBindDesc& lhs,
85  const HgiBufferBindDesc& rhs);
86 
112 {
113  HGI_API
115 
116  HgiTextureHandleVector textures;
117  HgiSamplerHandleVector samplers;
118  HgiBindResourceType resourceType;
119  uint32_t bindingIndex;
120  HgiShaderStage stageUsage;
121  bool writable;
122 };
123 using HgiTextureBindDescVector = std::vector<HgiTextureBindDesc>;
124 
125 HGI_API
126 bool operator==(
127  const HgiTextureBindDesc& lhs,
128  const HgiTextureBindDesc& rhs);
129 
130 HGI_API
131 bool operator!=(
132  const HgiTextureBindDesc& lhs,
133  const HgiTextureBindDesc& rhs);
134 
147 {
148  HGI_API
150 
151  std::string debugName;
152  HgiBufferBindDescVector buffers;
153  HgiTextureBindDescVector textures;
154 };
155 
156 HGI_API
157 bool operator==(
158  const HgiResourceBindingsDesc& lhs,
159  const HgiResourceBindingsDesc& rhs);
160 
161 HGI_API
162 bool operator!=(
163  const HgiResourceBindingsDesc& lhs,
164  const HgiResourceBindingsDesc& rhs);
165 
166 
174 {
175 public:
176  HGI_API
177  virtual ~HgiResourceBindings();
178 
180  HGI_API
181  HgiResourceBindingsDesc const& GetDescriptor() const;
182 
183 protected:
184  HGI_API
186 
187  HgiResourceBindingsDesc _descriptor;
188 
189 private:
190  HgiResourceBindings() = delete;
191  HgiResourceBindings & operator=(const HgiResourceBindings&) = delete;
192  HgiResourceBindings(const HgiResourceBindings&) = delete;
193 };
194 
196 using HgiResourceBindingsHandleVector = std::vector<HgiResourceBindingsHandle>;
197 
212 {
213  HGI_API
215  uint32_t byteOffset,
216  uint32_t index)
217  : buffer(buffer)
218  , byteOffset(byteOffset)
219  , index(index)
220  {
221  }
222 
223  HgiBufferHandle buffer;
224  uint32_t byteOffset;
225  uint32_t index;
226 };
227 
228 using HgiVertexBufferBindingVector = std::vector<HgiVertexBufferBinding>;
229 
230 
231 PXR_NAMESPACE_CLOSE_SCOPE
232 
233 #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.