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
34class HdStRenderDelegate final : public HdRenderDelegate
35{
36public:
37 HDST_API
39 HDST_API
40 HdStRenderDelegate(HdRenderSettingsMap const& settingsMap);
41
42 HDST_API
43 ~HdStRenderDelegate() override;
44
45 // ---------------------------------------------------------------------- //
47 // ---------------------------------------------------------------------- //
48
49 HDST_API
50 void SetDrivers(HdDriverVector const& drivers) override;
51
52 HDST_API
53 HdRenderParam *GetRenderParam() const override;
54
55 HDST_API
56 const TfTokenVector &GetSupportedRprimTypes() const override;
57 HDST_API
58 const TfTokenVector &GetSupportedSprimTypes() const override;
59 HDST_API
60 const TfTokenVector &GetSupportedBprimTypes() const override;
61 HDST_API
62 HdResourceRegistrySharedPtr GetResourceRegistry() const override;
63
64 HDST_API
65 HdRenderPassSharedPtr CreateRenderPass(HdRenderIndex *index,
66 HdRprimCollection const& collection) override;
67 HDST_API
68 HdRenderPassStateSharedPtr CreateRenderPassState() const override;
69
70 HDST_API
71 HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
72 SdfPath const& id) override;
73
74 HDST_API
75 void DestroyInstancer(HdInstancer *instancer) override;
76
77 HDST_API
78 HdRprim *CreateRprim(TfToken const& typeId,
79 SdfPath const& rprimId) override;
80 HDST_API
81 void DestroyRprim(HdRprim *rPrim) override;
82
83 HDST_API
84 HdSprim *CreateSprim(TfToken const& typeId,
85 SdfPath const& sprimId) override;
86 HDST_API
87 HdSprim *CreateFallbackSprim(TfToken const& typeId) override;
88 HDST_API
89 void DestroySprim(HdSprim *sPrim) override;
90
91 HDST_API
92 HdBprim *CreateBprim(TfToken const& typeId,
93 SdfPath const& bprimId) override;
94 HDST_API
95 HdBprim *CreateFallbackBprim(TfToken const& typeId) override;
96 HDST_API
97 void DestroyBprim(HdBprim *bPrim) override;
98
99 HDST_API
100 void CommitResources(HdChangeTracker *tracker) override;
101
102 HDST_API
103 TfTokenVector GetMaterialRenderContexts() const override;
104
105 HDST_API
106 TfTokenVector GetShaderSourceTypes() const override;
107
108 HDST_API
109 bool IsPrimvarFilteringNeeded() const override;
110
111 HDST_API
112 HdRenderSettingDescriptorList
113 GetRenderSettingDescriptors() const override;
114
115 HDST_API
116 VtDictionary GetRenderStats() const override;
117
118 HDST_API
120 GetDefaultAovDescriptor(TfToken const& name) const override;
121
122 // ---------------------------------------------------------------------- //
124 // ---------------------------------------------------------------------- //
125
126 // Returns whether or not HdStRenderDelegate can run on the current
127 // hardware.
128 HDST_API
129 static bool IsSupported(
130 HdRendererCreateArgs const& rendererCreateArgs = {});
131
132 // Returns a raw pointer to the draw items cache owned (solely) by the
133 // render delegate.
134 HDST_API
135 HdStDrawItemsCachePtr GetDrawItemsCache() const;
136
137 // Returns Hydra graphics interface
138 HDST_API
139 Hgi* GetHgi();
140
141private:
142 void _ApplyTextureSettings();
143 HdSprim *_CreateFallbackMaterialPrim();
144
145 HdStRenderDelegate(const HdStRenderDelegate &) = delete;
146 HdStRenderDelegate &operator =(const HdStRenderDelegate &) = delete;
147
148 static const TfTokenVector SUPPORTED_RPRIM_TYPES;
149 static const TfTokenVector SUPPORTED_SPRIM_TYPES;
150
151 // Resource registry used in this render delegate
152 HdStResourceRegistrySharedPtr _resourceRegistry;
153
154 HdRenderSettingDescriptorList _settingDescriptors;
155
156 Hgi* _hgi;
157
158 std::unique_ptr<HdStRenderParam> _renderParam;
159
160 HdStDrawItemsCacheUniquePtr _drawItemsCache;
161};
162
163
164PXR_NAMESPACE_CLOSE_SCOPE
165
166#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.
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:274
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:43
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