Loading...
Searching...
No Matches
renderTask.h
1//
2// Copyright 2016 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_RENDER_TASK_H
25#define PXR_IMAGING_HDX_RENDER_TASK_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdx/api.h"
29#include "pxr/imaging/hdx/version.h"
30#include "pxr/imaging/hdx/task.h"
31#include "pxr/imaging/hdx/renderSetupTask.h" // for short-term compatibility.
32#include "pxr/imaging/hdSt/renderPassState.h"
33
34#include <memory>
35
36PXR_NAMESPACE_OPEN_SCOPE
37
38
39class HdSceneDelegate;
40
41using HdRenderPassStateSharedPtr = std::shared_ptr<class HdRenderPassState>;
42using HdRenderPassSharedPtr = std::shared_ptr<class HdRenderPass>;
43using HdxRenderSetupTaskSharedPtr = std::shared_ptr<class HdxRenderSetupTask>;
44
64class HdxRenderTask : public HdxTask
65{
66public:
67 HDX_API
68 HdxRenderTask(HdSceneDelegate* delegate, SdfPath const& id);
69
70 HDX_API
71 ~HdxRenderTask() override;
72
74 HDX_API
75 bool IsConverged() const override;
76
78 HDX_API
79 void Prepare(HdTaskContext* ctx,
80 HdRenderIndex* renderIndex) override;
81
83 HDX_API
84 void Execute(HdTaskContext* ctx) override;
85
87 HDX_API
88 const TfTokenVector &GetRenderTags() const override;
89
90protected:
92 HDX_API
93 void _Sync(HdSceneDelegate* delegate,
94 HdTaskContext* ctx,
95 HdDirtyBits* dirtyBits) override;
96
97 HDX_API
98 HdRenderPassStateSharedPtr _GetRenderPassState(HdTaskContext *ctx) const;
99
100 // XXX: Storm specific API
101 // While HdDrawItem is currently a core-Hydra concept, it'll be moved
102 // to Storm. Until then, allow querying the render pass to know if there's
103 // draw submission work.
104
105 // Returns whether the render pass has any draw items to submit.
106 // For non-Storm backends, this returns true.
107 // When using with Storm tasks, make sure to call it after
108 // HdxRenderTask::Prepare().
109 HDX_API
110 bool _HasDrawItems() const;
111
112private:
113 HdRenderPassSharedPtr _pass;
114 TfTokenVector _renderTags;
115
116 // Optional internal render setup task, for params unpacking.
117 HdxRenderSetupTaskSharedPtr _setupTask;
118
119 // XXX: Storm specific API
120 // Setup additional state that HdStRenderPassState requires.
121 void _SetHdStRenderPassState(HdTaskContext *ctx,
122 HdStRenderPassState *renderPassState);
123
124 // Inspect the AOV bindings to determine if any of them need to be cleared.
125 bool _NeedToClearAovs(HdRenderPassStateSharedPtr const &renderPassState)
126 const;
127
128 HdxRenderTask() = delete;
129 HdxRenderTask(const HdxRenderTask &) = delete;
130 HdxRenderTask &operator =(const HdxRenderTask &) = delete;
131};
132
133
134PXR_NAMESPACE_CLOSE_SCOPE
135
136#endif //PXR_IMAGING_HDX_RENDER_TASK_H
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:121
Adapter class providing data exchange with the client scene graph.
A set of rendering parameters used among render passes.
A task for rendering geometry to pixels.
Definition: renderTask.h:65
HDX_API const TfTokenVector & GetRenderTags() const override
Collect Render Tags used by the task.
HDX_API void _Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
Sync the render pass resources.
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare the tasks resources.
HDX_API void Execute(HdTaskContext *ctx) override
Execute render pass task.
HDX_API bool IsConverged() const override
Hooks for progressive rendering (delegated to renderpasses).
Base class for (some) tasks in Hdx that provides common progressive rendering and Hgi functionality.
Definition: task.h:45
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:457