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 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_HDX_AOV_INPUT_TASK_H
25 #define PXR_IMAGING_HDX_AOV_INPUT_TASK_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdx/api.h"
29 #include "pxr/imaging/hdx/task.h"
31 
33 
34 /// \class HdxAovInputTask
35 ///
36 /// A task for taking input AOV data comming from a render buffer that was
37 /// filled by render tasks and converting it to a HgiTexture.
38 /// The aov render buffer can be a GPU or CPU buffer, while the resulting output
39 /// HgiTexture will always be a GPU texture.
40 ///
41 /// The HgiTexture is placed in the shared task context so that following tasks
42 /// maybe operate on this HgiTexture without having to worry about converting
43 /// the aov data from CPU to GPU.
44 ///
45 class HdxAovInputTask : public HdxTask
46 {
47 public:
48  HDX_API
49  HdxAovInputTask(HdSceneDelegate* delegate, SdfPath const& id);
50 
51  HDX_API
52  ~HdxAovInputTask() override;
53 
54  /// Hooks for progressive rendering.
55  bool IsConverged() const override;
56 
57  HDX_API
58  void Prepare(
59  HdTaskContext* ctx,
60  HdRenderIndex* renderIndex) override;
61 
62  HDX_API
63  void Execute(HdTaskContext* ctx) override;
64 
65 protected:
66  HDX_API
67  void _Sync(
68  HdSceneDelegate* delegate,
69  HdTaskContext* ctx,
70  HdDirtyBits* dirtyBits) override;
71 
72 private:
73  void _UpdateTexture(
74  HdTaskContext* ctx,
77 
78  void _UpdateIntermediateTexture(
79  HgiTextureHandle& texture,
80  HdRenderBuffer* buffer);
81 
82  bool _converged;
83 
84  SdfPath _aovBufferPath;
85  SdfPath _depthBufferPath;
86 
87  HdRenderBuffer* _aovBuffer;
88  HdRenderBuffer* _depthBuffer;
89 
90  HgiTextureHandle _aovTexture;
91  HgiTextureHandle _depthTexture;
92  HgiTextureHandle _aovTextureIntermediate;
93 
94  HdxAovInputTask() = delete;
95  HdxAovInputTask(const HdxAovInputTask &) = delete;
96  HdxAovInputTask &operator =(const HdxAovInputTask &) = delete;
97 };
98 
99 
100 /// \class HdxAovInputTaskParams
101 ///
102 /// AovInput parameters.
103 ///
105 {
107  : aovBufferPath()
108  , depthBufferPath()
109  {}
110 
113 };
114 
115 // VtValue requirements
116 HDX_API
117 std::ostream& operator<<(std::ostream& out, const HdxAovInputTaskParams& pv);
118 HDX_API
119 bool operator==(const HdxAovInputTaskParams& lhs,
120  const HdxAovInputTaskParams& rhs);
121 HDX_API
122 bool operator!=(const HdxAovInputTaskParams& lhs,
123  const HdxAovInputTaskParams& rhs);
124 
125 
127 
128 #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:158
int HgiHandle< class HgiTexture > HgiTextureHandle
#define HDX_API
Definition: api.h:40
Definition: core.h:760
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:570
HDX_API void _Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Definition: path.h:290
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition: renderIndex.h:77
Definition: task.h:44
HDX_API ~HdxAovInputTask() override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1394
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
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:556