Loading...
Searching...
No Matches
task.h
1//
2// Copyright 2018 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_TASK_H
25#define PXR_IMAGING_HDX_TASK_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdx/api.h"
29#include "pxr/imaging/hd/task.h"
30
31PXR_NAMESPACE_OPEN_SCOPE
32
33class Hgi;
34
35
44class HdxTask : public HdTask
45{
46public:
47 HDX_API
48 HdxTask(SdfPath const& id);
49
50 HDX_API
51 ~HdxTask() override;
52
62 HDX_API
63 virtual bool IsConverged() const;
64
69 HDX_API
70 void Sync(
71 HdSceneDelegate* delegate,
72 HdTaskContext* ctx,
73 HdDirtyBits* dirtyBits) override final;
74
75protected:
76 // This is called during the hydra Sync Phase via HdxTask::Sync.
77 // Please see HdTask::Sync for Sync Phase documentation.
78 virtual void _Sync(
79 HdSceneDelegate* delegate,
80 HdTaskContext* ctx,
81 HdDirtyBits* dirtyBits) = 0;
82
83 // Swaps the color target and colorIntermediate target.
84 // This is used when a task wishes to read from the color and also write
85 // to it. We use two color targets and ping-pong between them.
86 HDX_API
87 void _ToggleRenderTarget(HdTaskContext* ctx);
88
89 // Swaps the depth target and depthIntermediate target.
90 // This is used when a task wishes to read from the depth and also write
91 // to it. We use two depth targets and ping-pong between them.
92 HDX_API
93 void _ToggleDepthTarget(HdTaskContext* ctx);
94
95 // Helper function to facilitate texture ping-ponging.
96 HDX_API
97 void _SwapTextures(
98 HdTaskContext* ctx,
99 const TfToken& textureToken,
100 const TfToken& textureIntermediateToken);
101
102 // Return pointer to Hydra Graphics Interface.
103 HDX_API
104 Hgi* _GetHgi() const;
105
106private:
107 Hgi* _hgi;
108};
109
110PXR_NAMESPACE_CLOSE_SCOPE
111
112#endif
113
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:45
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:111
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