HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
unitTestHelper.h
Go to the documentation of this file.
1 //
2 // Copyright 2023 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_UNIT_TEST_HELPER_H
8 #define PXR_IMAGING_HGI_UNIT_TEST_HELPER_H
9 
10 #include "pxr/pxr.h"
11 
12 #include "pxr/imaging/hgi/hgi.h"
13 
15 
16 using HgiUniquePtr = std::unique_ptr<class Hgi>;
17 
19 {
20 public:
21  HGI_API
23 
24  HGI_API
26 
27  HGI_API
28  Hgi* GetHgi() { return _hgi.get(); }
29 
30 private:
31  HgiUniquePtr _hgi;
32 };
33 
35 {
36 public:
37  HGI_API
39 
40  HGI_API
42 
43  HGI_API
44  bool CreateTestPipeline();
45 
46  HGI_API
47  Hgi* GetHgi() { return _hgi.get(); }
48 
49 protected:
50  bool _CreateShaderProgram();
51  void _DestroyShaderProgram();
53  bool _CreatePipeline();
54  void _PrintCompileErrors();
55 
62 };
63 
65 {
66 public:
67  HGI_API
69 
70  HGI_API
72 
73  HGI_API
74  bool ExecuteTestGfxCmdBfr();
75 
76  HGI_API
77  bool WriteToFile(const std::string& filePath);
78 
79 private:
80  GfVec3i _renderDim;
81 
82  bool _CreateResourceBuffers();
83  bool _CreateRenderTargets();
84 
85  HgiBufferHandle _indexBuffer;
86  HgiBufferHandle _vertexBuffer;
87 
88  HgiTextureHandle _colorTarget;
89  HgiTextureViewHandle _colorTargetView;
90 
91  HgiTextureHandle _depthTarget;
92  HgiTextureViewHandle _depthTargetView;
93 };
94 
96 
97 #endif // PXR_IMAGING_HGI_UNIT_TEST_HELPER_H
HgiGraphicsPipelineHandle _pipeline
int HgiHandle< class HgiTexture > HgiTextureHandle
HgiShaderProgramHandle _shaderProgram
Definition: vec3i.h:43
HGI_API bool CreateTestPipeline()
Definition: hgi.h:93
HGI_API ~HgiInitializationTestDriver()
#define HGI_API
Definition: api.h:23
HgiVertexBufferDesc _vboDesc
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HGI_API bool WriteToFile(const std::string &filePath)
std::unique_ptr< class Hgi > HgiUniquePtr
Definition: hgi.h:37