All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
renderDelegate.h
1//
2// Copyright 2016 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_HD_RENDER_DELEGATE_H
8#define PXR_IMAGING_HD_RENDER_DELEGATE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/aov.h"
13#include "pxr/imaging/hd/changeTracker.h"
14#include "pxr/imaging/hd/command.h"
15#include "pxr/imaging/hd/dataSource.h"
17#include "pxr/base/tf/token.h"
18
19#include <memory>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
23class SdfPath;
24class HdRprim;
25class HdSprim;
26class HdBprim;
27class HdSceneDelegate;
28class HdRenderIndex;
29class HdRenderPass;
30class HdInstancer;
31class HdDriver;
32
34
35using HdRenderPassSharedPtr = std::shared_ptr<class HdRenderPass>;
36using HdRenderPassStateSharedPtr = std::shared_ptr<class HdRenderPassState>;
37using HdResourceRegistrySharedPtr = std::shared_ptr<class HdResourceRegistry>;
38using HdDriverVector = std::vector<HdDriver*>;
39
46{
47public:
48 HdRenderParam() {}
49 HD_API
50 virtual ~HdRenderParam();
51
52private:
53 // Hydra will not attempt to copy the class.
54 HdRenderParam(const HdRenderParam &) = delete;
55 HdRenderParam &operator =(const HdRenderParam &) = delete;
56};
57
58typedef TfHashMap<TfToken, VtValue, TfToken::HashFunctor> HdRenderSettingsMap;
59
65{
66 // A human readable name.
67 std::string name;
68 // The key for HdRenderDelegate::SetRenderSetting/GetRenderSetting.
69 TfToken key;
70 // The default value.
71 VtValue defaultValue;
72};
73
74typedef std::vector<HdRenderSettingDescriptor> HdRenderSettingDescriptorList;
75
78class HdRenderDelegate
79{
80public:
81 HD_API
82 virtual ~HdRenderDelegate();
83
89 HD_API
90 virtual void SetDrivers(HdDriverVector const& drivers);
91
96 virtual const TfTokenVector &GetSupportedRprimTypes() const = 0;
97
102 virtual const TfTokenVector &GetSupportedSprimTypes() const = 0;
103
104
109 virtual const TfTokenVector &GetSupportedBprimTypes() const = 0;
110
123 HD_API
124 virtual HdRenderParam *GetRenderParam() const;
125
130 virtual HdResourceRegistrySharedPtr GetResourceRegistry() const = 0;
131
135 HD_API
136 virtual void SetRenderSetting(TfToken const& key, VtValue const& value);
137
141 HD_API
142 virtual VtValue GetRenderSetting(TfToken const& key) const;
143
148 template<typename T>
149 T GetRenderSetting(TfToken const& key, T const& defValue) const {
150 return GetRenderSetting(key).Cast<T>().GetWithDefault(defValue);
151 }
152
156 HD_API
157 virtual HdRenderSettingDescriptorList GetRenderSettingDescriptors() const;
158
162 HD_API
163 virtual unsigned int GetRenderSettingsVersion() const;
164
168 HD_API
169 virtual VtDictionary GetRenderStats() const;
170
175 HD_API
176 virtual HdContainerDataSourceHandle GetCapabilities() const;
177
183
188 HD_API
189 virtual bool IsPauseSupported() const;
190
195 HD_API
196 virtual bool IsPaused() const;
197
204 HD_API
205 virtual bool Pause();
206
213 HD_API
214 virtual bool Resume();
215
220 HD_API
221 virtual bool IsStopSupported() const;
222
227 HD_API
228 virtual bool IsStopped() const;
229
237 HD_API
238 virtual bool Stop(bool blocking = true);
239
246 HD_API
247 virtual bool Restart();
248
254
261 virtual HdRenderPassSharedPtr CreateRenderPass(HdRenderIndex *index,
262 HdRprimCollection const& collection) = 0;
263
272 HD_API
273 virtual HdRenderPassStateSharedPtr CreateRenderPassState() const;
274
280
286 virtual HdInstancer *CreateInstancer(HdSceneDelegate *delegate,
287 SdfPath const& id) = 0;
288
289 virtual void DestroyInstancer(HdInstancer *instancer) = 0;
290
296
297
304 virtual HdRprim *CreateRprim(TfToken const& typeId,
305 SdfPath const& rprimId) = 0;
306
310 virtual void DestroyRprim(HdRprim *rPrim) = 0;
311
318 virtual HdSprim *CreateSprim(TfToken const& typeId,
319 SdfPath const& sprimId) = 0;
320
330 virtual HdSprim *CreateFallbackSprim(TfToken const& typeId) = 0;
331
335 virtual void DestroySprim(HdSprim *sprim) = 0;
336
343 virtual HdBprim *CreateBprim(TfToken const& typeId,
344 SdfPath const& bprimId) = 0;
345
346
356 virtual HdBprim *CreateFallbackBprim(TfToken const& typeId) = 0;
357
361 virtual void DestroyBprim(HdBprim *bprim) = 0;
362
368
380 virtual void CommitResources(HdChangeTracker *tracker) = 0;
381
387
393 HD_API
394 virtual TfToken GetMaterialBindingPurpose() const;
395
396
398 HD_API
399 virtual TfToken GetMaterialNetworkSelector() const;
400
406 HD_API
407 virtual TfTokenVector GetMaterialRenderContexts() const;
408
414 HD_API
415 virtual TfTokenVector GetRenderSettingsNamespaces() const;
416
425 HD_API
426 virtual bool IsPrimvarFilteringNeeded() const;
427
432 HD_API
433 virtual TfTokenVector GetShaderSourceTypes() const;
434
440
445 HD_API
446 virtual HdAovDescriptor GetDefaultAovDescriptor(TfToken const& name) const;
447
453
457 HD_API
458 virtual HdCommandDescriptors GetCommandDescriptors() const;
459
468 HD_API
469 virtual bool InvokeCommand(
470 const TfToken &command,
471 const HdCommandArgs &args = HdCommandArgs());
472
475 HD_API
476 const std::string &GetRendererDisplayName() {
477 return _displayName;
478 }
479
488
496 HD_API
497 virtual void SetTerminalSceneIndex(
498 const HdSceneIndexBaseRefPtr &terminalSceneIndex);
499
505 HD_API
506 virtual void Update();
507
510 HD_API
511 virtual bool IsParallelSyncEnabled(const TfToken &primType) const;
512
513protected:
515 HD_API
516 HdRenderDelegate();
518 HD_API
519 HdRenderDelegate(HdRenderSettingsMap const& settingsMap);
520
524 HdRenderDelegate(const HdRenderDelegate &) = delete;
525 HdRenderDelegate &operator=(const HdRenderDelegate &) = delete;
526
527 HD_API
528 void _PopulateDefaultSettings(
529 HdRenderSettingDescriptorList const& defaultSettings);
530
532 HdRenderSettingsMap _settingsMap;
533 unsigned int _settingsVersion;
534
535private:
536
537 friend class HdRendererPlugin;
542 void _SetRendererDisplayName(const std::string &displayName) {
543 _displayName = displayName;
544 }
545 std::string _displayName;
546
547};
548
549PXR_NAMESPACE_CLOSE_SCOPE
550
551#endif //PXR_IMAGING_HD_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
HdDriver represents a device object, commonly a render device, that is owned by the application and p...
Definition: driver.h:23
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 ...
An abstract class representing a single render iteration over a set of prims (the HdRprimCollection),...
Definition: renderPass.h:53
This class defines a renderer plugin interface for Hydra.
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.
Abstract interface to scene data.
Definition: sceneIndex.h:48
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
A map with string keys and VtValue values.
Definition: dictionary.h:43
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
A bundle of state describing an AOV ("Arbitrary Output Variable") display channel.
Definition: aov.h:30
HdRenderSettingDescriptor represents a render setting that a render delegate wants to export (e....
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440