All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
graphicsPipeline.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_GRAPHICS_PIPELINE_H
25 #define PXR_IMAGING_HGI_GRAPHICS_PIPELINE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hgi/api.h"
29 #include "pxr/imaging/hgi/attachmentDesc.h"
30 #include "pxr/imaging/hgi/enums.h"
31 #include "pxr/imaging/hgi/handle.h"
32 #include "pxr/imaging/hgi/resourceBindings.h"
33 #include "pxr/imaging/hgi/shaderProgram.h"
34 #include "pxr/imaging/hgi/types.h"
35 
36 #include <string>
37 #include <vector>
38 
39 PXR_NAMESPACE_OPEN_SCOPE
40 
41 
56 {
57  HGI_API
59 
60  HgiFormat format;
61  uint32_t offset;
62  uint32_t shaderBindLocation;
63 };
64 using HgiVertexAttributeDescVector = std::vector<HgiVertexAttributeDesc>;
65 
66 HGI_API
67 bool operator==(
68  const HgiVertexAttributeDesc& lhs,
69  const HgiVertexAttributeDesc& rhs);
70 
71 HGI_API
72 inline bool operator!=(
73  const HgiVertexAttributeDesc& lhs,
74  const HgiVertexAttributeDesc& rhs);
75 
76 
91 {
92  HGI_API
94 
95  uint32_t bindingIndex;
96  HgiVertexAttributeDescVector vertexAttributes;
97  uint32_t vertexStride;
98 };
99 using HgiVertexBufferDescVector = std::vector<HgiVertexBufferDesc>;
100 
101 HGI_API
102 bool operator==(
103  const HgiVertexBufferDesc& lhs,
104  const HgiVertexBufferDesc& rhs);
105 
106 HGI_API
107 inline bool operator!=(
108  const HgiVertexBufferDesc& lhs,
109  const HgiVertexBufferDesc& rhs);
110 
111 
124 {
125  HGI_API
127 
128  bool alphaToCoverageEnable;
129  HgiSampleCount sampleCount;
130 };
131 
132 HGI_API
133 bool operator==(
134  const HgiMultiSampleState& lhs,
135  const HgiMultiSampleState& rhs);
136 
137 HGI_API
138 bool operator!=(
139  const HgiMultiSampleState& lhs,
140  const HgiMultiSampleState& rhs);
141 
142 
161 {
162  HGI_API
164 
165  HgiPolygonMode polygonMode;
166  float lineWidth;
167  HgiCullMode cullMode;
168  HgiWinding winding;
169  bool rasterizerEnabled;
170 };
171 
172 HGI_API
173 bool operator==(
174  const HgiRasterizationState& lhs,
175  const HgiRasterizationState& rhs);
176 
177 HGI_API
178 bool operator!=(
179  const HgiRasterizationState& lhs,
180  const HgiRasterizationState& rhs);
181 
200 {
201  HGI_API
203 
204  bool depthTestEnabled;
205  bool depthWriteEnabled;
206  HgiCompareFunction depthCompareFn;
207  bool stencilTestEnabled;
208 };
209 
210 HGI_API
211 bool operator==(
212  const HgiDepthStencilState& lhs,
213  const HgiDepthStencilState& rhs);
214 
215 HGI_API
216 bool operator!=(
217  const HgiDepthStencilState& lhs,
218  const HgiDepthStencilState& rhs);
219 
232  HGI_API
234 
235  uint32_t byteSize;
236  HgiShaderStage stageUsage;
237 };
238 
239 HGI_API
240 bool operator==(
242  const HgiGraphicsShaderConstantsDesc& rhs);
243 
244 HGI_API
245 bool operator!=(
247  const HgiGraphicsShaderConstantsDesc& rhs);
248 
282 {
283  HGI_API
285 
286  std::string debugName;
287  HgiPrimitiveType primitiveType;
288  HgiShaderProgramHandle shaderProgram;
289  HgiDepthStencilState depthState;
290  HgiMultiSampleState multiSampleState;
291  HgiRasterizationState rasterizationState;
292  HgiVertexBufferDescVector vertexBuffers;
293  HgiAttachmentDescVector colorAttachmentDescs;
294  HgiAttachmentDescVector colorResolveAttachmentDescs;
295  HgiAttachmentDesc depthAttachmentDesc;
296  HgiAttachmentDesc depthResolveAttachmentDesc;
297  HgiGraphicsShaderConstantsDesc shaderConstantsDesc;
298 };
299 
300 HGI_API
301 bool operator==(
302  const HgiGraphicsPipelineDesc& lhs,
303  const HgiGraphicsPipelineDesc& rhs);
304 
305 HGI_API
306 bool operator!=(
307  const HgiGraphicsPipelineDesc& lhs,
308  const HgiGraphicsPipelineDesc& rhs);
309 
310 
322 {
323 public:
324  HGI_API
325  virtual ~HgiGraphicsPipeline();
326 
328  HGI_API
329  HgiGraphicsPipelineDesc const& GetDescriptor() const;
330 
331 protected:
332  HGI_API
334 
335  HgiGraphicsPipelineDesc _descriptor;
336 
337 private:
338  HgiGraphicsPipeline() = delete;
339  HgiGraphicsPipeline & operator=(const HgiGraphicsPipeline&) = delete;
340  HgiGraphicsPipeline(const HgiGraphicsPipeline&) = delete;
341 };
342 
344 using HgiGraphicsPipelineHandleVector = std::vector<HgiGraphicsPipelineHandle>;
345 
346 
347 PXR_NAMESPACE_CLOSE_SCOPE
348 
349 #endif
Describes the properties of a framebuffer attachment.
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
A small, but fast buffer of uniform data for shaders.
Properties to configure multi sampling.
Describes one attribute of a vertex.
Represents a graphics platform independent GPU graphics pipeline resource.
Properties to configure multi sampling.
Properties to configure depth and stencil test.
Describes the attributes of a vertex buffer.
Describes the properties needed to create a GPU pipeline.
HGI_API HgiGraphicsPipelineDesc const & GetDescriptor() const
The descriptor describes the object.