Loading...
Searching...
No Matches
task.h
1//
2// Copyright 2018 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_TASK_H
8#define PXR_IMAGING_HDX_TASK_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdx/api.h"
12#include "pxr/imaging/hd/task.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
16class Hgi;
17
18
27class HdxTask : public HdTask
28{
29public:
30 HDX_API
31 HdxTask(SdfPath const& id);
32
33 HDX_API
34 ~HdxTask() override;
35
45 HDX_API
46 virtual bool IsConverged() const;
47
52 HDX_API
53 void Sync(
54 HdSceneDelegate* delegate,
55 HdTaskContext* ctx,
56 HdDirtyBits* dirtyBits) override final;
57
58protected:
59 // This is called during the hydra Sync Phase via HdxTask::Sync.
60 // Please see HdTask::Sync for Sync Phase documentation.
61 virtual void _Sync(
62 HdSceneDelegate* delegate,
63 HdTaskContext* ctx,
64 HdDirtyBits* dirtyBits) = 0;
65
66 // Swaps the color target and colorIntermediate target.
67 // This is used when a task wishes to read from the color and also write
68 // to it. We use two color targets and ping-pong between them.
69 HDX_API
70 void _ToggleRenderTarget(HdTaskContext* ctx);
71
72 // Swaps the depth target and depthIntermediate target.
73 // This is used when a task wishes to read from the depth and also write
74 // to it. We use two depth targets and ping-pong between them.
75 HDX_API
76 void _ToggleDepthTarget(HdTaskContext* ctx);
77
78 // Helper function to facilitate texture ping-ponging.
79 HDX_API
80 void _SwapTextures(
81 HdTaskContext* ctx,
82 const TfToken& textureToken,
83 const TfToken& textureIntermediateToken);
84
85 // Return pointer to Hydra Graphics Interface.
86 HDX_API
87 Hgi* _GetHgi() const;
88
89private:
90 Hgi* _hgi;
91};
92
93PXR_NAMESPACE_CLOSE_SCOPE
94
95#endif
96
Adapter class providing data exchange with the client scene graph.
Base class for (some) tasks in Hdx that provides common progressive rendering and Hgi functionality.
Definition: task.h:28
virtual HDX_API bool IsConverged() const
This function returns true when a (progressive) task considers its execution results converged.
HDX_API void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override final
We override HdTask::Sync, but make it 'final' to make sure derived classes can't override it and inst...
Hydra Graphics Interface.
Definition: hgi.h:94
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