HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
aovInputTask.h
Go to the documentation of this file.
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_HDX_AOV_INPUT_TASK_H
8 #define PXR_IMAGING_HDX_AOV_INPUT_TASK_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdx/api.h"
12 #include "pxr/imaging/hdx/task.h"
14 
16 
18 
19 /// \class HdxAovInputTask
20 ///
21 /// A task for taking input AOV data comming from a render buffer that was
22 /// filled by render tasks and converting it to a HgiTexture.
23 /// The aov render buffer can be a GPU or CPU buffer, while the resulting output
24 /// HgiTexture will always be a GPU texture.
25 ///
26 /// The HgiTexture is placed in the shared task context so that following tasks
27 /// maybe operate on this HgiTexture without having to worry about converting
28 /// the aov data from CPU to GPU.
29 ///
30 class HdxAovInputTask : public HdxTask
31 {
32 public:
34 
35  HDX_API
36  HdxAovInputTask(HdSceneDelegate* delegate, SdfPath const& id);
37 
38  HDX_API
39  ~HdxAovInputTask() override;
40 
41  /// Hooks for progressive rendering.
42  bool IsConverged() const override;
43 
44  HDX_API
45  void Prepare(
46  HdTaskContext* ctx,
47  HdRenderIndex* renderIndex) override;
48 
49  HDX_API
50  void Execute(HdTaskContext* ctx) override;
51 
52 protected:
53  HDX_API
54  void _Sync(
55  HdSceneDelegate* delegate,
56  HdTaskContext* ctx,
57  HdDirtyBits* dirtyBits) override;
58 
59 private:
60  void _UpdateTexture(
61  HdTaskContext* ctx,
65 
66  void _UpdateIntermediateTexture(
70 
71  bool _converged;
72 
73  SdfPath _aovBufferPath;
74  SdfPath _depthBufferPath;
75 
76  HdRenderBuffer* _aovBuffer;
77  HdRenderBuffer* _depthBuffer;
78 
79  HgiTextureHandle _aovTexture;
80  HgiTextureHandle _depthTexture;
81  HgiTextureHandle _aovTextureIntermediate;
82  HgiTextureHandle _depthTextureIntermediate;
83 
84  HdxAovInputTask() = delete;
85  HdxAovInputTask(const HdxAovInputTask &) = delete;
86  HdxAovInputTask &operator =(const HdxAovInputTask &) = delete;
87 };
88 
89 
90 /// \class HdxAovInputTaskParams
91 ///
92 /// AovInput parameters.
93 ///
95 {
97 
100 };
101 
102 // VtValue requirements
103 HDX_API
104 std::ostream& operator<<(std::ostream& out, const HdxAovInputTaskParams& pv);
105 HDX_API
106 bool operator==(const HdxAovInputTaskParams& lhs,
107  const HdxAovInputTaskParams& rhs);
108 HDX_API
109 bool operator!=(const HdxAovInputTaskParams& lhs,
110  const HdxAovInputTaskParams& rhs);
111 
112 
114 
115 #endif
HDX_API void Execute(HdTaskContext *ctx) override
HDX_API std::ostream & operator<<(std::ostream &out, const HdxAovInputTaskParams &pv)
uint32_t HdDirtyBits
Definition: types.h:143
int HgiHandle< class HgiTexture > HgiTextureHandle
#define HDX_API
Definition: api.h:23
GLuint buffer
Definition: glcorearb.h:660
bool IsConverged() const override
Hooks for progressive rendering.
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
HDX_API void _Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Definition: path.h:273
HgiTextureUsageBits
Definition: enums.h:142
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition: renderIndex.h:61
Definition: task.h:27
HDX_API ~HdxAovInputTask() override
GLsizeiptr const void GLenum usage
Definition: glcorearb.h:664
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
GLuint texture
Definition: glcorearb.h:415
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542