Loading...
Searching...
No Matches
renderDelegate.h
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_RENDER_DELEGATE_H
8#define EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_RENDER_DELEGATE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/renderDelegate.h"
12#include "pxr/imaging/hd/version.h"
13#include "hdPrman/api.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
17#define HDPRMAN_RENDER_SETTINGS_TOKENS \
18 ((rileyVariant, "ri:variant")) \
19 ((xpuDevices, "ri:xpudevices")) \
20 ((integrator, "integrator")) \
21 ((integratorName, "ri:integrator:name")) \
22 ((interactiveIntegrator, "interactiveIntegrator")) \
23 ((interactiveIntegratorTimeout, "interactiveIntegratorTimeout")) \
24 ((dataWindowNDC, "dataWindowNDC")) \
25 ((pixelAspectRatio, "pixelAspectRatio")) \
26 ((resolution, "resolution")) \
27 \
28 /* \deprecated Use disableMotionBlur instead */ \
29 ((instantaneousShutter, "instantaneousShutter")) \
30 ((disableMotionBlur, "disableMotionBlur")) \
31 ((shutterOpen, "shutter:open")) \
32 ((shutterClose, "shutter:close")) \
33 ((experimentalRenderSpec, "experimental:renderSpec")) \
34 ((delegateRenderProducts, "delegateRenderProducts")) \
35 ((batchCommandLine, "batchCommandLine")) \
36 ((houdiniFrame, "houdini:frame")) \
37 ((checkpointInterval, "ri:checkpoint:interval"))
38
39TF_DECLARE_PUBLIC_TOKENS(HdPrmanRenderSettingsTokens, HDPRMAN_API,
40 HDPRMAN_RENDER_SETTINGS_TOKENS);
41
42#define HDPRMAN_EXPERIMENTAL_RENDER_SPEC_TOKENS \
43 (renderProducts) \
44 (renderVars) \
45 (renderVarIndices) \
46 (name) \
47 (sourceName) \
48 (sourceType) \
49 (type) \
50 (params) \
51 (camera)
52
53TF_DECLARE_PUBLIC_TOKENS(HdPrmanExperimentalRenderSpecTokens, HDPRMAN_API,
54 HDPRMAN_EXPERIMENTAL_RENDER_SPEC_TOKENS);
55
56#define HDPRMAN_INTEGRATOR_TOKENS \
57 (PxrPathTracer) \
58 (PbsPathTracer) \
59 (PxrDirectLighting)
60
61TF_DECLARE_PUBLIC_TOKENS(HdPrmanIntegratorTokens, HDPRMAN_API,
62 HDPRMAN_INTEGRATOR_TOKENS);
63
64#define HDPRMAN_RENDER_PRODUCT_TOKENS \
65 (productName) \
66 (productType) \
67 (orderedVars) \
68 (sourcePrim)
69
71 HdPrmanRenderProductTokens, HDPRMAN_API,
72 HDPRMAN_RENDER_PRODUCT_TOKENS);
73
74#define HDPRMAN_AOV_SETTINGS_TOKENS \
75 ((dataType, "dataType")) \
76 ((sourceName, "sourceName")) \
77 ((sourceType, "sourceType")) \
78 ((format, "aovDescriptor.format")) \
79 ((multiSampled, "aovDescriptor.multiSampled")) \
80 ((aovSettings, "aovDescriptor.aovSettings")) \
81 ((clearValue, "aovDescriptor.clearValue"))
82
84 HdPrmanAovSettingsTokens, HDPRMAN_API,
85 HDPRMAN_AOV_SETTINGS_TOKENS);
86
87class HdPrmanRenderDelegate : public HdRenderDelegate
88{
89public:
90 HDPRMAN_API
91 HdPrmanRenderDelegate(HdRenderSettingsMap const& settingsMap);
92 HDPRMAN_API
93 ~HdPrmanRenderDelegate() override;
94
95 // ------------------------------------------------------------------------
96 // Satisfying HdRenderDelegate
97 // ------------------------------------------------------------------------
98 HDPRMAN_API
99 HdRenderParam *GetRenderParam() const override;
100 HDPRMAN_API
101 const TfTokenVector & GetSupportedRprimTypes() const override;
102 HDPRMAN_API
103 const TfTokenVector & GetSupportedSprimTypes() const override;
104 HDPRMAN_API
105 const TfTokenVector & GetSupportedBprimTypes() const override;
106 HDPRMAN_API
107 HdResourceRegistrySharedPtr GetResourceRegistry() const override;
108
110 HDPRMAN_API
111 HdRenderSettingDescriptorList GetRenderSettingDescriptors() const override;
112
113 HDPRMAN_API
114 HdRenderPassSharedPtr CreateRenderPass(
115 HdRenderIndex *index,
116 HdRprimCollection const& collection) override;
117 HDPRMAN_API
118 HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
119 SdfPath const& id) override;
120 HDPRMAN_API
121 void DestroyInstancer(HdInstancer *instancer) override;
122 HDPRMAN_API
123 HdRprim *CreateRprim(TfToken const& typeId,
124 SdfPath const& rprimId) override;
125 HDPRMAN_API
126 void DestroyRprim(HdRprim *rPrim) override;
127 HDPRMAN_API
128 HdSprim *CreateSprim(TfToken const& typeId,
129 SdfPath const& sprimId) override;
130 HDPRMAN_API
131 HdSprim *CreateFallbackSprim(TfToken const& typeId) override;
132 HDPRMAN_API
133 void DestroySprim(HdSprim *sPrim) override;
134 HDPRMAN_API
135 HdBprim *CreateBprim(TfToken const& typeId,
136 SdfPath const& bprimId) override;
137 HDPRMAN_API
138 HdBprim *CreateFallbackBprim(TfToken const& typeId) override;
139 HDPRMAN_API
140 void DestroyBprim(HdBprim *bPrim) override;
141
142 HDPRMAN_API
143 HdAovDescriptor GetDefaultAovDescriptor(TfToken const& name) const override;
144
145 HDPRMAN_API
146 void CommitResources(HdChangeTracker *tracker) override;
147 HDPRMAN_API
148 TfToken GetMaterialBindingPurpose() const override;
149#if HD_API_VERSION < 41
150 HDPRMAN_API
151 TfToken GetMaterialNetworkSelector() const override;
152#else
153 HDPRMAN_API
154 TfTokenVector GetMaterialRenderContexts() const override;
155#endif
156 HDPRMAN_API
157 TfTokenVector GetShaderSourceTypes() const override;
158
159#if HD_API_VERSION > 46
160 HDPRMAN_API
161 TfTokenVector GetRenderSettingsNamespaces() const override;
162#endif
163
164#if HD_API_VERSION >= 60
165 HDPRMAN_API
166 HdContainerDataSourceHandle GetCapabilities() const override;
167#endif
168
169 HDPRMAN_API
170 void SetRenderSetting(TfToken const &key, VtValue const &value) override;
171
176 HDPRMAN_API
177 bool IsPauseSupported() const override { return false; }
178
180 HDPRMAN_API
181 bool IsStopSupported() const override;
182
184 HDPRMAN_API
185 bool IsStopped() const override;
186
188 HDPRMAN_API
189 bool Stop(bool blocking) override;
190
192 HDPRMAN_API
193 bool Restart() override;
194
195#if HD_API_VERSION >= 55
196
202
203 HDPRMAN_API
204 void SetTerminalSceneIndex(
205 const HdSceneIndexBaseRefPtr &inputSceneIndex) override;
206
207 HDPRMAN_API
208 void Update() override;
209
210#endif
211
212 // ------------------------------------------------------------------------
213 // Public (non-virtual) API
214 // ------------------------------------------------------------------------
215
216 HDPRMAN_API
217 HdRenderSettingsMap GetRenderSettingsMap() const;
218
219 HDPRMAN_API
220 bool IsInteractive() const;
221
222 HDPRMAN_API
223 HdRenderIndex* GetRenderIndex() const;
224
225private:
226 // This class does not support copying.
227 HdPrmanRenderDelegate(const HdPrmanRenderDelegate &) = delete;
228 HdPrmanRenderDelegate &operator =(const HdPrmanRenderDelegate &) = delete;
229
230 void _Initialize();
231
232protected:
233 static const TfTokenVector SUPPORTED_RPRIM_TYPES;
234 static const TfTokenVector SUPPORTED_SPRIM_TYPES;
235 static const TfTokenVector SUPPORTED_BPRIM_TYPES;
236
237 std::shared_ptr<class HdPrman_RenderParam> _renderParam;
238
239#if HD_API_VERSION >= 55
240 std::unique_ptr<class HdPrman_TerminalSceneIndexObserver>
241 _terminalObserver;
242#endif
243
244 struct _RileySceneIndices;
245 std::unique_ptr<_RileySceneIndices> _rileySceneIndices;
246
247 HdResourceRegistrySharedPtr _resourceRegistry;
248 HdRenderPassSharedPtr _renderPass;
249 HdRenderSettingDescriptorList _settingDescriptors;
250};
251
252PXR_NAMESPACE_CLOSE_SCOPE
253
254#endif // EXT_RMANPKG_25_0_PLUGIN_RENDERMAN_PLUGIN_HD_PRMAN_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:104
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
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
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:81
A bundle of state describing an AOV ("Arbitrary Output Variable") display channel.
Definition: aov.h:30
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440