HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
oitResolveTask.h
Go to the documentation of this file.
1 //
2 // Copyright 2019 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_OIT_RESOLVE_TASK_H
25 #define PXR_IMAGING_HDX_OIT_RESOLVE_TASK_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdx/api.h"
30 #include "pxr/imaging/hd/task.h"
31 
32 #include <memory>
33 
35 
36 
37 class HdSceneDelegate;
38 
39 using HdStRenderPassStateSharedPtr = std::shared_ptr<class HdStRenderPassState>;
40 
42  std::shared_ptr<class HdSt_ImageShaderRenderPass>;
44  std::shared_ptr<class HdStRenderPassShader>;
45 
46 /// OIT resolve task params.
48 {
50  : useAovMultiSample(true)
51  , resolveAovMultiSample(true)
52  {}
53 
56 };
57 
58 /// \class HdxOitResolveTask
59 ///
60 /// A task for resolving previous passes to pixels.
61 ///
62 /// It is also responsible for allocating the OIT buffers, but it
63 /// leaves the clearing of the OIT buffers to the OIT render tasks.
64 /// OIT render tasks coordinate with the resolve task through
65 /// HdxOitResolveTask::OitBufferAccessor.
66 ///
67 class HdxOitResolveTask : public HdTask
68 {
69 public:
70  HDX_API
71  static bool IsOitEnabled();
72 
73  HDX_API
74  HdxOitResolveTask(HdSceneDelegate* delegate, SdfPath const& id);
75 
76  HDX_API
77  ~HdxOitResolveTask() override;
78 
79  /// Sync the resolve pass resources
80  HDX_API
81  void Sync(HdSceneDelegate* delegate,
82  HdTaskContext* ctx,
83  HdDirtyBits* dirtyBits) override;
84 
85  /// Prepare the tasks resources
86  ///
87  /// Allocates OIT buffers if requested by OIT render task
88  HDX_API
89  void Prepare(HdTaskContext* ctx,
90  HdRenderIndex* renderIndex) override;
91 
92  /// Execute render pass task
93  ///
94  /// Resolves OIT buffers
95  HDX_API
96  void Execute(HdTaskContext* ctx) override;
97 
98 private:
99  HdxOitResolveTask() = delete;
100  HdxOitResolveTask(const HdxOitResolveTask &) = delete;
101  HdxOitResolveTask &operator =(const HdxOitResolveTask &) = delete;
102 
103  void _PrepareOitBuffers(
104  HdTaskContext* ctx,
105  HdRenderIndex* renderIndex,
106  GfVec2i const& screenSize);
107 
108  GfVec2i _ComputeScreenSize(
109  HdTaskContext *ctx,
110  HdRenderIndex* renderIndex) const;
111 
112  const HdRenderPassAovBindingVector &_GetAovBindings(
113  HdTaskContext *ctx) const;
114 
116  HdStRenderPassStateSharedPtr _renderPassState;
117  HdStRenderPassShaderSharedPtr _renderPassShader;
118 
119  GfVec2i _screenSize;
120  HdBufferArrayRangeSharedPtr _counterBar;
122  HdBufferArrayRangeSharedPtr _depthBar;
123  HdBufferArrayRangeSharedPtr _indexBar;
124  HdBufferArrayRangeSharedPtr _uniformBar;
125 };
126 
127 HDX_API
128 bool operator==(const HdxOitResolveTaskParams& lhs,
129  const HdxOitResolveTaskParams& rhs);
130 HDX_API
131 bool operator!=(const HdxOitResolveTaskParams& lhs,
132  const HdxOitResolveTaskParams& rhs);
133 HDX_API
134 std::ostream& operator<<(std::ostream& out, const HdxOitResolveTaskParams& pv);
135 
137 
138 #endif
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Definition: vec2i.h:61
uint32_t HdDirtyBits
Definition: types.h:158
static HDX_API bool IsOitEnabled()
#define HDX_API
Definition: api.h:40
std::shared_ptr< class HdStRenderPassState > HdStRenderPassStateSharedPtr
Definition: commandBuffer.h:47
HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the resolve pass resources.
std::shared_ptr< class HdSt_ImageShaderRenderPass > HdSt_ImageShaderRenderPassSharedPtr
HDX_API ~HdxOitResolveTask() override
HDX_API void Execute(HdTaskContext *ctx) override
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:570
HDX_API std::ostream & operator<<(std::ostream &out, const HdxOitResolveTaskParams &pv)
Definition: task.h:54
Definition: path.h:290
std::unordered_map< TfToken, VtValue, TfToken::HashFunctor > HdTaskContext
Definition: renderIndex.h:77
std::shared_ptr< class HdStRenderPassShader > HdStRenderPassShaderSharedPtr
OIT resolve task params.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1394
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
Definition: bufferArray.h:45
std::vector< HdRenderPassAovBinding > HdRenderPassAovBindingVector
Definition: aov.h:154
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:556