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:
64 // Returns true if the format is supported for presentation. This is useful
65 // for upstream tasks to prepare the AOV data accordingly, and keeps the
66 // interop step simple.
67 HDX_API
68 static bool IsFormatSupported(HgiFormat aovFormat);
69
70 HDX_API
71 HdxPresentTask(HdSceneDelegate* delegate, SdfPath const& id);
72
73 HDX_API
74 ~HdxPresentTask() override;
75
76 HDX_API
77 void Prepare(HdTaskContext* ctx,
78 HdRenderIndex* renderIndex) override;
79
80 HDX_API
81 void Execute(HdTaskContext* ctx) override;
82
83protected:
84 HDX_API
85 void _Sync(HdSceneDelegate* delegate,
86 HdTaskContext* ctx,
87 HdDirtyBits* dirtyBits) override;
88
89private:
91 HgiInterop _interop;
92
93 HdxPresentTask() = delete;
94 HdxPresentTask(const HdxPresentTask &) = delete;
95 HdxPresentTask &operator =(const HdxPresentTask &) = delete;
96};
97
98
99
100// VtValue requirements
101HDX_API
102std::ostream& operator<<(std::ostream& out, const HdxPresentTaskParams& pv);
103HDX_API
104bool operator==(const HdxPresentTaskParams& lhs,
105 const HdxPresentTaskParams& rhs);
106HDX_API
107bool operator!=(const HdxPresentTaskParams& lhs,
108 const HdxPresentTaskParams& rhs);
109
110
111PXR_NAMESPACE_CLOSE_SCOPE
112
113#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:104
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
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:147
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