Loading...
Searching...
No Matches
graphicsPipeline.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_GRAPHICS_PIPELINE_H
8#define PXR_IMAGING_HGI_GRAPHICS_PIPELINE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hgi/api.h"
12#include "pxr/imaging/hgi/attachmentDesc.h"
13#include "pxr/imaging/hgi/enums.h"
14#include "pxr/imaging/hgi/handle.h"
15#include "pxr/imaging/hgi/resourceBindings.h"
16#include "pxr/imaging/hgi/shaderProgram.h"
17#include "pxr/imaging/hgi/types.h"
18
19#include "pxr/base/gf/vec2f.h"
20
21#include <string>
22#include <vector>
23
24PXR_NAMESPACE_OPEN_SCOPE
25
26
41{
42 HGI_API
44
45 HgiFormat format;
46 uint32_t offset;
47 uint32_t shaderBindLocation;
48};
49using HgiVertexAttributeDescVector = std::vector<HgiVertexAttributeDesc>;
50
51HGI_API
52bool operator==(
53 const HgiVertexAttributeDesc& lhs,
54 const HgiVertexAttributeDesc& rhs);
55
56HGI_API
57bool operator!=(
58 const HgiVertexAttributeDesc& lhs,
59 const HgiVertexAttributeDesc& rhs);
60
61
78{
79 HGI_API
81
82 uint32_t bindingIndex;
83 HgiVertexAttributeDescVector vertexAttributes;
84 HgiVertexBufferStepFunction vertexStepFunction;
85 uint32_t vertexStride;
86};
87using HgiVertexBufferDescVector = std::vector<HgiVertexBufferDesc>;
88
89HGI_API
90bool operator==(
91 const HgiVertexBufferDesc& lhs,
92 const HgiVertexBufferDesc& rhs);
93
94HGI_API
95inline bool operator!=(
96 const HgiVertexBufferDesc& lhs,
97 const HgiVertexBufferDesc& rhs);
98
99
119{
120 HGI_API
122
123 bool multiSampleEnable;
124 bool alphaToCoverageEnable;
125 bool alphaToOneEnable;
126 HgiSampleCount sampleCount;
127};
128
129HGI_API
130bool operator==(
131 const HgiMultiSampleState& lhs,
132 const HgiMultiSampleState& rhs);
133
134HGI_API
135bool operator!=(
136 const HgiMultiSampleState& lhs,
137 const HgiMultiSampleState& rhs);
138
139
168{
169 HGI_API
171
172 HgiPolygonMode polygonMode;
173 float lineWidth;
174 HgiCullMode cullMode;
175 HgiWinding winding;
176 bool rasterizerEnabled;
177 bool depthClampEnabled;
178 GfVec2f depthRange;
179 bool conservativeRaster;
180 size_t numClipDistances;
181};
182
183HGI_API
184bool operator==(
185 const HgiRasterizationState& lhs,
186 const HgiRasterizationState& rhs);
187
188HGI_API
189bool operator!=(
190 const HgiRasterizationState& lhs,
191 const HgiRasterizationState& rhs);
192
202//. The reference value used by the stencil test function.</li>
217{
218 HGI_API
220
221 HgiCompareFunction compareFn;
222 uint32_t referenceValue;
223 HgiStencilOp stencilFailOp;
224 HgiStencilOp depthFailOp;
225 HgiStencilOp depthStencilPassOp;
226 uint32_t readMask;
227 uint32_t writeMask;
228};
229
230HGI_API
231bool operator==(
232 const HgiStencilState& lhs,
233 const HgiStencilState& rhs);
234
235HGI_API
236bool operator!=(
237 const HgiStencilState& lhs,
238 const HgiStencilState& rhs);
239
270{
271 HGI_API
273
274 bool depthTestEnabled;
275 bool depthWriteEnabled;
276 HgiCompareFunction depthCompareFn;
277
278 bool depthBiasEnabled;
279 float depthBiasConstantFactor;
280 float depthBiasSlopeFactor;
281
282 bool stencilTestEnabled;
283 HgiStencilState stencilFront;
284 HgiStencilState stencilBack;
285};
286
287HGI_API
288bool operator==(
289 const HgiDepthStencilState& lhs,
290 const HgiDepthStencilState& rhs);
291
292HGI_API
293bool operator!=(
294 const HgiDepthStencilState& lhs,
295 const HgiDepthStencilState& rhs);
296
309 HGI_API
311
312 uint32_t byteSize;
313 HgiShaderStage stageUsage;
314};
315
316HGI_API
317bool operator==(
320
321HGI_API
322bool operator!=(
325
326struct HgiTessellationLevel
327{
328 HGI_API
329 HgiTessellationLevel();
330
331 float innerTessLevel[2];
332 float outerTessLevel[4];
333};
334
349{
350 enum PatchType {
351 Triangle,
352 Quad,
353 Isoline
354 };
355
356 enum TessFactorMode {
357 Constant,
358 TessControl,
359 TessVertex
360 };
361
362 HGI_API
364
365 PatchType patchType;
366 int primitiveIndexSize;
367 TessFactorMode tessFactorMode = TessFactorMode::Constant;
368 HgiTessellationLevel tessellationLevel;
369};
370
403{
404 HGI_API
406
407 std::string debugName;
408 HgiPrimitiveType primitiveType;
409 HgiShaderProgramHandle shaderProgram;
410 HgiDepthStencilState depthState;
411 HgiMultiSampleState multiSampleState;
412 HgiRasterizationState rasterizationState;
413 HgiVertexBufferDescVector vertexBuffers;
414 HgiAttachmentDescVector colorAttachmentDescs;
415 HgiAttachmentDesc depthAttachmentDesc;
416 bool resolveAttachments;
417 HgiGraphicsShaderConstantsDesc shaderConstantsDesc;
418 HgiTessellationState tessellationState;
419};
420
421HGI_API
422bool operator==(
423 const HgiGraphicsPipelineDesc& lhs,
424 const HgiGraphicsPipelineDesc& rhs);
425
426HGI_API
427bool operator!=(
428 const HgiGraphicsPipelineDesc& lhs,
429 const HgiGraphicsPipelineDesc& rhs);
430
431
443{
444public:
445 HGI_API
446 virtual ~HgiGraphicsPipeline();
447
449 HGI_API
451
452protected:
453 HGI_API
455
456 HgiGraphicsPipelineDesc _descriptor;
457
458private:
459 HgiGraphicsPipeline() = delete;
460 HgiGraphicsPipeline & operator=(const HgiGraphicsPipeline&) = delete;
462};
463
465using HgiGraphicsPipelineHandleVector = std::vector<HgiGraphicsPipelineHandle>;
466
467
468PXR_NAMESPACE_CLOSE_SCOPE
469
470#endif
Basic type for a vector of 2 float components.
Definition: vec2f.h:46
Represents a graphics platform independent GPU graphics pipeline resource.
HGI_API HgiGraphicsPipelineDesc const & GetDescriptor() const
The descriptor describes the object.
Describes the properties of a framebuffer attachment.
Properties to configure depth and stencil test.
Describes the properties needed to create a GPU pipeline.
A small, but fast buffer of uniform data for shaders.
Properties to configure multi sampling.
Properties to configure the rasterization state.
stencilFailOp: The operation executed when the stencil test fails.
Properties to configure tessellation.
Describes one attribute of a vertex.
Describes the attributes of a vertex buffer.