HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rendererPluginRegistry.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_REGISTRY_H
8 #define PXR_IMAGING_HD_RENDERER_PLUGIN_REGISTRY_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
13 #include "pxr/base/tf/singleton.h"
15 
17 
18 
19 class HdRendererPlugin;
22 
24 {
25 public:
26  ///
27  /// Returns the singleton registry for \c HdRendererPlugin
28  ///
29  HD_API
31 
32  ///
33  /// Entry point for defining an HdRendererPlugin plugin.
34  ///
35  template<typename T, typename... Bases>
36  static void Define();
37 
38  ///
39  /// \deprecated Use GetDefaultPluginId overload below.
40  ///
41  /// Returns the id of plugin to use as the default. To ensure an
42  /// appropriate default is found, the \p gpuEnabled parameter will be used
43  /// to indicate if the GPU will be available when making the determination.
44  HD_API
45  TfToken GetDefaultPluginId(bool gpuEnabled = true);
46 
47  ///
48  /// Returns the id of plugin to use as the default. To ensure an
49  /// appropriate default is found, the \p rendererCreateArgs parameter will
50  /// be used to indicate the resources available when making the
51  /// determination.
52  ///
53  HD_API
55  HdRendererCreateArgs const &rendererCreateArgs);
56 
57  ///
58  /// \deprecated Use GetOrCreateRendererPlugin instead.
59  ///
60  /// Returns the renderer plugin for the given id or null
61  /// if not found. The reference count on the returned
62  /// delegate is incremented.
63  ///
64  HD_API
65  HdRendererPlugin *GetRendererPlugin(const TfToken &pluginId);
66 
67  ///
68  /// Returns the renderer plugin for the given id or a null handle
69  /// if not found. The plugin is wrapped in a handle that automatically
70  /// increments and decrements the reference count and also stores the
71  /// plugin id.
72  ///
73  HD_API
75 
76  ///
77  /// Returns a render delegate created by the plugin with the given name
78  /// if the plugin is supported using given initial settings.
79  /// The render delegate is wrapped in a movable handle that
80  /// keeps the plugin alive until the render delegate is destroyed by
81  /// dropping the handle.
82  ///
83  HD_API
85  const TfToken &pluginId,
86  const HdRenderSettingsMap &settingsMap = {});
87 
88 private:
89  // Friend required by TfSingleton to access constructor (as it is private).
91 
92  void _CollectAdditionalMetadata(
93  const PlugRegistry &plugRegistry, const TfType &pluginType) override;
94 
95  // Singleton gets private constructed
97  ~HdRendererPluginRegistry() override;
98 
99  //
100  /// This class is not intended to be copied.
101  ///
104 };
105 
106 
107 template<typename T, typename... Bases>
109 {
111 }
112 
113 
115 
116 #endif // PXR_IMAGING_HD_RENDERER_PLUGIN_REGISTRY_H
HD_API HdRendererPlugin * GetRendererPlugin(const TfToken &pluginId)
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
#define HD_API
Definition: api.h:23
HD_API HdRendererPluginHandle GetOrCreateRendererPlugin(const TfToken &pluginId)
HD_API TfToken GetDefaultPluginId(bool gpuEnabled=true)
HD_API HdPluginRenderDelegateUniqueHandle CreateRenderDelegate(const TfToken &pluginId, const HdRenderSettingsMap &settingsMap={})
Definition: token.h:70
static void Define()
LeafData & operator=(const LeafData &)=delete
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
static HD_API HdRendererPluginRegistry & GetInstance()