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,
78 
79  void _UpdateIntermediateTexture(
80  HgiTextureHandle& texture,
81  HdRenderBuffer* buffer,
82  HgiTextureUsageBits usage);
83 
84  bool _converged;
85 
86  SdfPath _aovBufferPath;
87  SdfPath _depthBufferPath;
88 
89  HdRenderBuffer* _aovBuffer;
90  HdRenderBuffer* _depthBuffer;
91 
92  HgiTextureHandle _aovTexture;
93  HgiTextureHandle _depthTexture;
94  HgiTextureHandle _aovTextureIntermediate;
95  HgiTextureHandle _depthTextureIntermediate;
96 
97  HdxAovInputTask() = delete;
98  HdxAovInputTask(const HdxAovInputTask &) = delete;
99  HdxAovInputTask &operator =(const HdxAovInputTask &) = delete;
100 };
101 
102 
103 /// \class HdxAovInputTaskParams
104 ///
105 /// AovInput parameters.
106 ///
108 {
110  : aovBufferPath()
111  , depthBufferPath()
112  {}
113 
116 };
117 
118 // VtValue requirements
119 HDX_API
120 std::ostream& operator<<(std::ostream& out, const HdxAovInputTaskParams& pv);
121 HDX_API
122 bool operator==(const HdxAovInputTaskParams& lhs,
123  const HdxAovInputTaskParams& rhs);
124 HDX_API
125 bool operator!=(const HdxAovInputTaskParams& lhs,
126  const HdxAovInputTaskParams& rhs);
127 
128 
130 
131 #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:556
HDX_API void _Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Definition: path.h:291
HgiTextureUsageBits
Definition: enums.h:156
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition: renderIndex.h:77
Definition: task.h:44
HDX_API ~HdxAovInputTask() override
GLsizeiptr const void GLenum usage
Definition: glcorearb.h:664
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
#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:542