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 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 PXR_IMAGING_HD_RENDERER_PLUGIN_H
25 #define PXR_IMAGING_HD_RENDERER_PLUGIN_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
31 
33 
34 class SdfPath;
35 class HdRenderIndex;
37 
38 ///
39 /// This class defines a renderer plugin interface for Hydra.
40 /// A renderer plugin is a dynamically discovered and loaded at run-time using
41 /// the Plug system.
42 ///
43 /// This object has singleton behavior, in that is instantiated once per
44 /// library (managed by the plugin registry).
45 ///
46 /// The class is used to factory objects that provide delegate support
47 /// to other parts of the Hydra Ecosystem.
48 ///
50 public:
51 
52  ///
53  /// Create a render delegate through the plugin and wrap it in a
54  /// handle that keeps this plugin alive until render delegate is
55  /// destroyed. Initial settings can be passed in.
56  ///
57  HD_API
59  HdRenderSettingsMap const &settingsMap = {});
60 
61  ///
62  /// Look-up plugin id in plugin registry.
63  ///
64  HD_API
65  TfToken GetPluginId() const;
66 
67  ///
68  /// Clients should use CreateDelegate since this method
69  /// will eventually become protected, use CreateRenderDelegateHandle
70  /// instead.
71  ///
72  /// Factory a Render Delegate object, that Hydra can use to
73  /// factory prims and communicate with a renderer.
74  ///
76 
77  ///
78  /// Clients should use CreateDelegate since this method
79  /// will eventually become protected.
80  ///
81  /// Factory a Render Delegate object, that Hydra can use to
82  /// factory prims and communicate with a renderer. Pass in initial
83  /// settings...
84  ///
85  HD_API
87  HdRenderSettingsMap const& settingsMap);
88 
89  ///
90  /// Clients should use CreateDelegate since this method
91  /// will eventually become protected.
92  ///
93  /// Release the object factoried by CreateRenderDelegate().
94  ///
95  virtual void DeleteRenderDelegate(HdRenderDelegate *renderDelegate) = 0;
96 
97  ///
98  /// Returns \c true if this renderer plugin is supported in the running
99  /// process and \c false if not.
100  ///
101  /// This gives the plugin a chance to perform some runtime checks to make
102  /// sure that the system meets minimum requirements.
103  ///
104  virtual bool IsSupported() const = 0;
105 
106 protected:
107  HdRendererPlugin() = default;
108  HD_API
109  ~HdRendererPlugin() override;
110 
111 private:
112  // This class doesn't require copy support.
113  HdRendererPlugin(const HdRendererPlugin &) = delete;
114  HdRendererPlugin &operator =(const HdRendererPlugin &) = delete;
115 
116 };
117 
118 
120 
121 #endif // PXR_IMAGING_HD_RENDERER_PLUGIN_H
HdRendererPlugin()=default
virtual bool IsSupported() const =0
HD_API TfToken GetPluginId() const
HD_API ~HdRendererPlugin() override
#define HD_API
Definition: api.h:40
Definition: token.h:87
virtual void DeleteRenderDelegate(HdRenderDelegate *renderDelegate)=0
HD_API HdPluginRenderDelegateUniqueHandle CreateDelegate(HdRenderSettingsMap const &settingsMap={})
Definition: path.h:288
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1375
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
virtual HdRenderDelegate * CreateRenderDelegate()=0