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  /// Returns the id of plugin to use as the default. To ensure an
40  /// appropriate default is found, the \p gpuEnabled parameter will be used
41  /// to indicate if the GPU will be available when making the determination.
42  ///
43  HD_API
44  TfToken GetDefaultPluginId(bool gpuEnabled = true);
45 
46  ///
47  /// \deprecated Use GetOrCreateRendererPlugin instead.
48  ///
49  /// Returns the renderer plugin for the given id or null
50  /// if not found. The reference count on the returned
51  /// delegate is incremented.
52  ///
53  HD_API
54  HdRendererPlugin *GetRendererPlugin(const TfToken &pluginId);
55 
56  ///
57  /// Returns the renderer plugin for the given id or a null handle
58  /// if not found. The plugin is wrapped in a handle that automatically
59  /// increments and decrements the reference count and also stores the
60  /// plugin id.
61  ///
62  HD_API
64 
65  ///
66  /// Returns a render delegate created by the plugin with the given name
67  /// if the plugin is supported using given initial settings.
68  /// The render delegate is wrapped in a movable handle that
69  /// keeps the plugin alive until the render delegate is destroyed by
70  /// dropping the handle.
71  ///
72  HD_API
74  const TfToken &pluginId,
75  const HdRenderSettingsMap &settingsMap = {});
76 
77 private:
78  // Friend required by TfSingleton to access constructor (as it is private).
80 
81  void _CollectAdditionalMetadata(
82  const PlugRegistry &plugRegistry, const TfType &pluginType) override;
83 
84  // Singleton gets private constructed
86  ~HdRendererPluginRegistry() override;
87 
88  //
89  /// This class is not intended to be copied.
90  ///
93 };
94 
95 
96 template<typename T, typename... Bases>
98 {
100 }
101 
102 
104 
105 #endif // PXR_IMAGING_HD_RENDERER_PLUGIN_REGISTRY_H
HD_API HdRendererPlugin * GetRendererPlugin(const TfToken &pluginId)
#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
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
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()