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