HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rendererPlugin.h
Go to the documentation of this file.
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 //
7 #ifndef PXR_IMAGING_HD_RENDERER_PLUGIN_H
8 #define PXR_IMAGING_HD_RENDERER_PLUGIN_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
14 
16 
17 class SdfPath;
18 class HdRenderIndex;
20 
21 ///
22 /// This class defines a renderer plugin interface for Hydra.
23 /// A renderer plugin is a dynamically discovered and loaded at run-time using
24 /// the Plug system.
25 ///
26 /// This object has singleton behavior, in that is instantiated once per
27 /// library (managed by the plugin registry).
28 ///
29 /// The class is used to factory objects that provide delegate support
30 /// to other parts of the Hydra Ecosystem.
31 ///
33 public:
34 
35  ///
36  /// Create a render delegate through the plugin and wrap it in a
37  /// handle that keeps this plugin alive until render delegate is
38  /// destroyed. Initial settings can be passed in.
39  ///
40  HD_API
42  HdRenderSettingsMap const &settingsMap = {});
43 
44  ///
45  /// Look-up plugin id in plugin registry.
46  ///
47  HD_API
48  TfToken GetPluginId() const;
49 
50  ///
51  /// Look-up display name in plugin registry.
52  ///
53  HD_API
54  std::string GetDisplayName() const;
55 
56  ///
57  /// Clients should use CreateDelegate since this method
58  /// will eventually become protected, use CreateRenderDelegateHandle
59  /// instead.
60  ///
61  /// Factory a Render Delegate object, that Hydra can use to
62  /// factory prims and communicate with a renderer.
63  ///
65 
66  ///
67  /// Clients should use CreateDelegate since this method
68  /// will eventually become protected.
69  ///
70  /// Factory a Render Delegate object, that Hydra can use to
71  /// factory prims and communicate with a renderer. Pass in initial
72  /// settings...
73  ///
74  HD_API
76  HdRenderSettingsMap const& settingsMap);
77 
78  ///
79  /// Clients should use CreateDelegate since this method
80  /// will eventually become protected.
81  ///
82  /// Release the object factoried by CreateRenderDelegate().
83  ///
84  virtual void DeleteRenderDelegate(HdRenderDelegate *renderDelegate) = 0;
85 
86  ///
87  /// Returns \c true if this renderer plugin is supported in the running
88  /// process and \c false if not.
89  ///
90  /// This gives the plugin a chance to perform some runtime checks to make
91  /// sure that the system meets minimum requirements. The \p gpuEnabled
92  /// parameter indicates if the GPU is available for use by the plugin in
93  /// case this information is necessary to make this determination.
94  ///
95  virtual bool IsSupported(bool gpuEnabled = true) const = 0;
96 
97 protected:
98  HdRendererPlugin() = default;
99  HD_API
100  ~HdRendererPlugin() override;
101 
102 private:
103  // This class doesn't require copy support.
104  HdRendererPlugin(const HdRendererPlugin &) = delete;
105  HdRendererPlugin &operator =(const HdRendererPlugin &) = delete;
106 
107 };
108 
109 
111 
112 #endif // PXR_IMAGING_HD_RENDERER_PLUGIN_H
HdRendererPlugin()=default
virtual bool IsSupported(bool gpuEnabled=true) const =0
HD_API TfToken GetPluginId() const
HD_API ~HdRendererPlugin() override
#define HD_API
Definition: api.h:23
Definition: token.h:70
virtual void DeleteRenderDelegate(HdRenderDelegate *renderDelegate)=0
HD_API HdPluginRenderDelegateUniqueHandle CreateDelegate(HdRenderSettingsMap const &settingsMap={})
Definition: path.h:273
HD_API std::string GetDisplayName() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
virtual HdRenderDelegate * CreateRenderDelegate()=0