rendererPluginRegistry.h
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_REGISTRY_H
25 #define PXR_IMAGING_HD_RENDERER_PLUGIN_REGISTRY_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hd/api.h"
29 #include "pxr/imaging/hd/renderDelegate.h"
30 #include "pxr/base/tf/singleton.h"
31 #include "pxr/imaging/hf/pluginRegistry.h"
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 
36 class HdRendererPlugin;
39 
40 class HdRendererPluginRegistry final : public HfPluginRegistry
41 {
42 public:
46  HD_API
47  static HdRendererPluginRegistry &GetInstance();
48 
52  template<typename T, typename... Bases>
53  static void Define();
54 
60  HD_API
61  TfToken GetDefaultPluginId(bool gpuEnabled = true);
62 
70  HD_API
71  HdRendererPlugin *GetRendererPlugin(const TfToken &pluginId);
72 
79  HD_API
80  HdRendererPluginHandle GetOrCreateRendererPlugin(const TfToken &pluginId);
81 
89  HD_API
90  HdPluginRenderDelegateUniqueHandle CreateRenderDelegate(
91  const TfToken &pluginId,
92  const HdRenderSettingsMap &settingsMap = {});
93 
94 private:
95  // Friend required by TfSingleton to access constructor (as it is private).
96  friend class TfSingleton<HdRendererPluginRegistry>;
97 
98  // Singleton gets private constructed
99  HdRendererPluginRegistry();
100  ~HdRendererPluginRegistry() override;
101 
102  //
105  HdRendererPluginRegistry(const HdRendererPluginRegistry &) = delete;
106  HdRendererPluginRegistry &operator=(const HdRendererPluginRegistry &) = delete;
107 };
108 
109 
110 template<typename T, typename... Bases>
111 void HdRendererPluginRegistry::Define()
112 {
114 }
115 
116 
117 PXR_NAMESPACE_CLOSE_SCOPE
118 
119 #endif // PXR_IMAGING_HD_RENDERER_PLUGIN_REGISTRY_H
Manage a single instance of an object.
Manage a single instance of an object (see.
Definition: singleton.h:119
Base class for registering Hydra plugins using the plug mechanism.
This class defines a renderer plugin interface for Hydra.
A (movable) handle for a render delegate that was created using a a plugin.
static void Define()
Entry point for registering a types implementation.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
A handle for HdRendererPlugin also storing the plugin id.