Loading...
Searching...
No Matches
renderDelegate.h
1//
2// Copyright 2017 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6#ifndef PXR_IMAGING_HD_ST_RENDER_DELEGATE_H
7#define PXR_IMAGING_HD_ST_RENDER_DELEGATE_H
8
9#include "pxr/pxr.h"
10#include "pxr/imaging/hdSt/api.h"
11#include "pxr/imaging/hd/renderDelegate.h"
12
13#include <memory>
14#include <mutex>
15
16PXR_NAMESPACE_OPEN_SCOPE
17
18class Hgi;
19class HdStRenderParam;
20using HdStDrawItemsCacheUniquePtr =
21 std::unique_ptr<class HdSt_DrawItemsCache>;
22using HdStDrawItemsCachePtr = HdSt_DrawItemsCache *;
23
24using HdStResourceRegistrySharedPtr =
25 std::shared_ptr<class HdStResourceRegistry>;
26
27struct HdRenderDelegateInfo;
28
36class HdStRenderDelegate final : public HdRenderDelegate
37{
38public:
39 HDST_API
41 HDST_API
42 HdStRenderDelegate(HdRenderSettingsMap const& settingsMap);
43
44 HDST_API
45 ~HdStRenderDelegate() override;
46
47 // ---------------------------------------------------------------------- //
49 // ---------------------------------------------------------------------- //
50
51 HDST_API
52 void SetDrivers(HdDriverVector const& drivers) override;
53
54 HDST_API
55 HdRenderParam *GetRenderParam() const override;
56
57 HDST_API
58 const TfTokenVector &GetSupportedRprimTypes() const override;
59 HDST_API
60 const TfTokenVector &GetSupportedSprimTypes() const override;
61 HDST_API
62 const TfTokenVector &GetSupportedBprimTypes() const override;
63 HDST_API
64 HdResourceRegistrySharedPtr GetResourceRegistry() const override;
65
66 HDST_API
67 HdRenderPassSharedPtr CreateRenderPass(HdRenderIndex *index,
68 HdRprimCollection const& collection) override;
69 HDST_API
70 HdRenderPassStateSharedPtr CreateRenderPassState() const override;
71
72 HDST_API
73 HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
74 SdfPath const& id) override;
75
76 HDST_API
77 void DestroyInstancer(HdInstancer *instancer) override;
78
79 HDST_API
80 HdRprim *CreateRprim(TfToken const& typeId,
81 SdfPath const& rprimId) override;
82 HDST_API
83 void DestroyRprim(HdRprim *rPrim) override;
84
85 HDST_API
86 HdSprim *CreateSprim(TfToken const& typeId,
87 SdfPath const& sprimId) override;
88 HDST_API
89 HdSprim *CreateFallbackSprim(TfToken const& typeId) override;
90 HDST_API
91 void DestroySprim(HdSprim *sPrim) override;
92
93 HDST_API
94 HdBprim *CreateBprim(TfToken const& typeId,
95 SdfPath const& bprimId) override;
96 HDST_API
97 HdBprim *CreateFallbackBprim(TfToken const& typeId) override;
98 HDST_API
99 void DestroyBprim(HdBprim *bPrim) override;
100
101 HDST_API
102 void CommitResources(HdChangeTracker *tracker) override;
103
104 HDST_API
105 TfTokenVector GetMaterialRenderContexts() const override;
106
107 HDST_API
108 TfTokenVector GetShaderSourceTypes() const override;
109
110 HDST_API
111 bool IsPrimvarFilteringNeeded() const override;
112
113 HDST_API
114 HdRenderSettingDescriptorList
115 GetRenderSettingDescriptors() const override;
116
117 HDST_API
118 VtDictionary GetRenderStats() const override;
119
120 HDST_API
122 GetDefaultAovDescriptor(TfToken const& name) const override;
123
129 HDST_API
130 bool RequiresStormTasks() const override;
131
132 // ---------------------------------------------------------------------- //
134 // ---------------------------------------------------------------------- //
135
136 // Returns whether or not HdStRenderDelegate can run on the current
137 // hardware.
138 HDST_API
139 static bool IsSupported(
140 HdRendererCreateArgs const& rendererCreateArgs = {});
141
142 // Returns a raw pointer to the draw items cache owned (solely) by the
143 // render delegate.
144 HDST_API
145 HdStDrawItemsCachePtr GetDrawItemsCache() const;
146
147 // Returns Hydra graphics interface
148 HDST_API
149 Hgi* GetHgi();
150
151 HDST_API
152 static
153 const HdRenderDelegateInfo &GetRenderDelegateInfo();
154
155private:
156 void _ApplyTextureSettings();
157 HdSprim *_CreateFallbackMaterialPrim();
158
159 HdStRenderDelegate(const HdStRenderDelegate &) = delete;
160 HdStRenderDelegate &operator =(const HdStRenderDelegate &) = delete;
161
162 static const TfTokenVector SUPPORTED_RPRIM_TYPES;
163 static const TfTokenVector SUPPORTED_SPRIM_TYPES;
164
165 // Resource registry used in this render delegate
166 HdStResourceRegistrySharedPtr _resourceRegistry;
167
168 HdRenderSettingDescriptorList _settingDescriptors;
169
170 Hgi* _hgi;
171
172 std::unique_ptr<HdStRenderParam> _renderParam;
173
174 HdStDrawItemsCacheUniquePtr _drawItemsCache;
175};
176
177
178PXR_NAMESPACE_CLOSE_SCOPE
179
180#endif // PXR_IMAGING_HD_ST_RENDER_DELEGATE_H
Bprim (buffer prim) is a base class of managing a blob of data that is used to communicate between th...
Definition: bprim.h:40
Tracks changes from the HdSceneDelegate, providing invalidation cues to the render engine.
Definition: changeTracker.h:35
This class exists to facilitate point cloud style instancing.
Definition: instancer.h:108
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Definition: renderIndex.h:105
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
A named, semantic collection of objects.
The render engine state for a given rprim from the scene graph.
Definition: rprim.h:38
Adapter class providing data exchange with the client scene graph.
Sprim (state prim) is a base class of managing state for non-drawable scene entity (e....
Definition: sprim.h:35
HdStRenderDelegate.
HDST_API bool RequiresStormTasks() const override
Flag for the HdxTaskControllerSceneIndex.
The render delegate can create an object of type HdRenderParam, to pass to each prim during Sync().
Definition: renderParam.h:27
Hydra Graphics Interface.
Definition: hgi.h:95
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
A map with string keys and VtValue values.
Definition: dictionary.h:52
A bundle of state describing an AOV ("Arbitrary Output Variable") display channel.
Definition: aov.h:30
HdRendererCreateArgs contains members indicating the resources available when creating a renderer plu...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440