Loading...
Searching...
No Matches
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
40PXR_NAMESPACE_OPEN_SCOPE
41
42
43
44
45
80{
81 HGI_API
83
84 HgiBufferHandleVector buffers;
85 std::vector<uint32_t> offsets;
86 std::vector<uint32_t> sizes;
87 HgiBindResourceType resourceType;
88 uint32_t bindingIndex;
89 HgiShaderStage stageUsage;
90 bool writable;
91};
92using HgiBufferBindDescVector = std::vector<HgiBufferBindDesc>;
93
94HGI_API
95bool operator==(
96 const HgiBufferBindDesc& lhs,
97 const HgiBufferBindDesc& rhs);
98
99HGI_API
100inline bool operator!=(
101 const HgiBufferBindDesc& lhs,
102 const HgiBufferBindDesc& rhs);
103
129{
130 HGI_API
132
133 HgiTextureHandleVector textures;
134 HgiSamplerHandleVector samplers;
135 HgiBindResourceType resourceType;
136 uint32_t bindingIndex;
137 HgiShaderStage stageUsage;
138 bool writable;
139};
140using HgiTextureBindDescVector = std::vector<HgiTextureBindDesc>;
141
142HGI_API
143bool operator==(
144 const HgiTextureBindDesc& lhs,
145 const HgiTextureBindDesc& rhs);
146
147HGI_API
148bool operator!=(
149 const HgiTextureBindDesc& lhs,
150 const HgiTextureBindDesc& rhs);
151
164{
165 HGI_API
167
168 std::string debugName;
169 HgiBufferBindDescVector buffers;
170 HgiTextureBindDescVector textures;
171};
172
173HGI_API
174bool operator==(
175 const HgiResourceBindingsDesc& lhs,
176 const HgiResourceBindingsDesc& rhs);
177
178HGI_API
179bool operator!=(
180 const HgiResourceBindingsDesc& lhs,
181 const HgiResourceBindingsDesc& rhs);
182
183
191{
192public:
193 HGI_API
194 virtual ~HgiResourceBindings();
195
197 HGI_API
199
200protected:
201 HGI_API
203
204 HgiResourceBindingsDesc _descriptor;
205
206private:
207 HgiResourceBindings() = delete;
208 HgiResourceBindings & operator=(const HgiResourceBindings&) = delete;
210};
211
213using HgiResourceBindingsHandleVector = std::vector<HgiResourceBindingsHandle>;
214
229{
230 HGI_API
232 uint32_t byteOffset,
233 uint32_t index)
234 : buffer(buffer)
235 , byteOffset(byteOffset)
236 , index(index)
237 {
238 }
239
240 HgiBufferHandle buffer;
241 uint32_t byteOffset;
242 uint32_t index;
243};
244
245using HgiVertexBufferBindingVector = std::vector<HgiVertexBufferBinding>;
246
247
248PXR_NAMESPACE_CLOSE_SCOPE
249
250#endif
Represents a collection of buffers, texture and vertex attributes that will be used by an cmds object...
HGI_API HgiResourceBindingsDesc const & GetDescriptor() const
The descriptor describes the object.
Describes the binding information of a buffer (or array of buffers).
Describes a set of resources that are bound to the GPU during encoding.
Describes the binding information of a texture (or array of textures).
Describes a buffer to be bound during encoding.