Loading...
Searching...
No Matches
presentTask.h
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_PRESENT_TASK_H
25#define PXR_IMAGING_HDX_PRESENT_TASK_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdx/api.h"
29#include "pxr/imaging/hdx/task.h"
30#include "pxr/imaging/hgi/tokens.h"
31#include "pxr/imaging/hgi/types.h"
32#include "pxr/imaging/hgiInterop/hgiInterop.h"
33
34PXR_NAMESPACE_OPEN_SCOPE
35
41{
43 : dstApi(HgiTokens->OpenGL)
44 , dstRegion(0)
45 , enabled(true)
46 {}
47
48 // The graphics lib that is used by the application / viewer.
49 // (The 'interopSrc' is determined by checking Hgi->GetAPIName)
50 TfToken dstApi;
51
60
61 // Subrectangular region of the framebuffer over which to composite aov
62 // contents. Coordinates are (left, BOTTOM, width, height).
63 GfVec4i dstRegion;
64
65 // When not enabled, present task does not execute, but still calls
66 // Hgi::EndFrame.
67 bool enabled;
68};
69
78class HdxPresentTask : public HdxTask
79{
80public:
81 // Returns true if the format is supported for presentation. This is useful
82 // for upstream tasks to prepare the AOV data accordingly, and keeps the
83 // interop step simple.
84 HDX_API
85 static bool IsFormatSupported(HgiFormat aovFormat);
86
87 HDX_API
88 HdxPresentTask(HdSceneDelegate* delegate, SdfPath const& id);
89
90 HDX_API
91 ~HdxPresentTask() override;
92
93 HDX_API
94 void Prepare(HdTaskContext* ctx,
95 HdRenderIndex* renderIndex) override;
96
97 HDX_API
98 void Execute(HdTaskContext* ctx) override;
99
100protected:
101 HDX_API
102 void _Sync(HdSceneDelegate* delegate,
103 HdTaskContext* ctx,
104 HdDirtyBits* dirtyBits) override;
105
106private:
107 HdxPresentTaskParams _params;
108 HgiInterop _interop;
109
110 HdxPresentTask() = delete;
111 HdxPresentTask(const HdxPresentTask &) = delete;
112 HdxPresentTask &operator =(const HdxPresentTask &) = delete;
113};
114
115
116
117// VtValue requirements
118HDX_API
119std::ostream& operator<<(std::ostream& out, const HdxPresentTaskParams& pv);
120HDX_API
121bool operator==(const HdxPresentTaskParams& lhs,
122 const HdxPresentTaskParams& rhs);
123HDX_API
124bool operator!=(const HdxPresentTaskParams& lhs,
125 const HdxPresentTaskParams& rhs);
126
127
128PXR_NAMESPACE_CLOSE_SCOPE
129
130#endif
Basic type for a vector of 4 int components.
Definition: vec4i.h:61
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 task for taking the final result of the aovs and compositing it over the currently bound framebuffe...
Definition: presentTask.h:79
Base class for (some) tasks in Hdx that provides common progressive rendering and Hgi functionality.
Definition: task.h:45
Hydra Graphics Interface Interop.
Definition: hgiInterop.h:50
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:164
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
PresentTask parameters.
Definition: presentTask.h:41
VtValue dstFramebuffer
The framebuffer that the AOVs are presented into.
Definition: presentTask.h:59