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
37 static
38 HDX_API
39 bool AreTasksConverged(HdRenderIndex * const renderIndex,
40 const SdfPathVector &taskPaths);
41
46 HDX_API
47 void Sync(
48 HdSceneDelegate* delegate,
49 HdTaskContext* ctx,
50 HdDirtyBits* dirtyBits) override final;
51
52protected:
53 // This is called during the hydra Sync Phase via HdxTask::Sync.
54 // Please see HdTask::Sync for Sync Phase documentation.
55 virtual void _Sync(
56 HdSceneDelegate* delegate,
57 HdTaskContext* ctx,
58 HdDirtyBits* dirtyBits) = 0;
59
60 // Swaps the color target and colorIntermediate target.
61 // This is used when a task wishes to read from the color and also write
62 // to it. We use two color targets and ping-pong between them.
63 HDX_API
64 void _ToggleRenderTarget(HdTaskContext* ctx);
65
66 // Swaps the depth target and depthIntermediate target.
67 // This is used when a task wishes to read from the depth and also write
68 // to it. We use two depth targets and ping-pong between them.
69 HDX_API
70 void _ToggleDepthTarget(HdTaskContext* ctx);
71
72 // Helper function to facilitate texture ping-ponging.
73 HDX_API
74 void _SwapTextures(
75 HdTaskContext* ctx,
76 const TfToken& textureToken,
77 const TfToken& textureIntermediateToken);
78
79 // Return pointer to Hydra Graphics Interface.
80 HDX_API
81 Hgi* _GetHgi() const;
82
83private:
84 Hgi* _hgi;
85};
86
87PXR_NAMESPACE_CLOSE_SCOPE
88
89#endif
90
The render index is part of the Hydra 1.0 API and is only used for emulation purposes so that HdScene...
Adapter class providing data exchange with the client scene graph.
HdTask represents a unit of work to perform during a Hydra render.
Definition task.h:44
Base class for (some) tasks in Hdx that provides common progressive rendering and Hgi functionality.
Definition task.h:28
static HDX_API bool AreTasksConverged(HdRenderIndex *const renderIndex, const SdfPathVector &taskPaths)
Are all tasks at taskPaths in the render index 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:95
A path value used to locate objects in layers or scenegraphs.
Definition path.h:281
Token for efficient comparison, assignment, and hashing of known strings.
Definition token.h:71