Loading...
Searching...
No Matches
presentTask.h
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HDX_PRESENT_TASK_H
8#define PXR_IMAGING_HDX_PRESENT_TASK_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdx/api.h"
12#include "pxr/imaging/hdx/task.h"
13#include "pxr/imaging/hgi/tokens.h"
14#include "pxr/imaging/hgi/types.h"
15#include "pxr/imaging/hgiInterop/hgiInterop.h"
16
17PXR_NAMESPACE_OPEN_SCOPE
18
24{
26 : dstApi(HgiTokens->OpenGL)
27 , dstRegion(0)
28 , enabled(true)
29 {}
30
31 // The graphics lib that is used by the application / viewer.
32 // (The 'interopSrc' is determined by checking Hgi->GetAPIName)
33 TfToken dstApi;
34
43
44 // Subrectangular region of the framebuffer over which to composite aov
45 // contents. Coordinates are (left, BOTTOM, width, height).
46 GfVec4i dstRegion;
47
48 // When not enabled, present task does not execute, but still calls
49 // Hgi::EndFrame.
50 bool enabled;
51};
52
61class HdxPresentTask : public HdxTask
62{
63public:
65
66 // Returns true if the format is supported for presentation. This is useful
67 // for upstream tasks to prepare the AOV data accordingly, and keeps the
68 // interop step simple.
69 HDX_API
70 static bool IsFormatSupported(HgiFormat aovFormat);
71
72 HDX_API
73 HdxPresentTask(HdSceneDelegate* delegate, SdfPath const& id);
74
75 HDX_API
76 ~HdxPresentTask() override;
77
78 HDX_API
79 void Prepare(HdTaskContext* ctx,
80 HdRenderIndex* renderIndex) override;
81
82 HDX_API
83 void Execute(HdTaskContext* ctx) override;
84
85protected:
86 HDX_API
87 void _Sync(HdSceneDelegate* delegate,
88 HdTaskContext* ctx,
89 HdDirtyBits* dirtyBits) override;
90
91private:
93 HgiInterop _interop;
94
95 HdxPresentTask() = delete;
96 HdxPresentTask(const HdxPresentTask &) = delete;
97 HdxPresentTask &operator =(const HdxPresentTask &) = delete;
98};
99
100
101
102// VtValue requirements
103HDX_API
104std::ostream& operator<<(std::ostream& out, const HdxPresentTaskParams& pv);
105HDX_API
106bool operator==(const HdxPresentTaskParams& lhs,
107 const HdxPresentTaskParams& rhs);
108HDX_API
109bool operator!=(const HdxPresentTaskParams& lhs,
110 const HdxPresentTaskParams& rhs);
111
112
113PXR_NAMESPACE_CLOSE_SCOPE
114
115#endif
Basic type for a vector of 4 int components.
Definition: vec4i.h:44
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:105
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:62
HDX_API void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex) override
Prepare Phase: Resolve bindings and manage resources.
HDX_API void Execute(HdTaskContext *ctx) override
Execute Phase: Runs the task.
Base class for (some) tasks in Hdx that provides common progressive rendering and Hgi functionality.
Definition: task.h:28
Hydra Graphics Interface Interop.
Definition: hgiInterop.h:33
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:152
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
PresentTask parameters.
Definition: presentTask.h:24
VtValue dstFramebuffer
The framebuffer that the AOVs are presented into.
Definition: presentTask.h:42