7#ifndef PXR_IMAGING_HD_SCENE_INDEX_PLUGIN_REGISTRY_H
8#define PXR_IMAGING_HD_SCENE_INDEX_PLUGIN_REGISTRY_H
13#include "pxr/imaging/hf/pluginRegistry.h"
14#include "pxr/imaging/hd/api.h"
15#include "pxr/imaging/hd/sceneIndex.h"
17PXR_NAMESPACE_OPEN_SCOPE
19#define HDSCENEINDEXPLUGINREGISTRY_TOKENS \
20 ((rendererDisplayName, "__rendererDisplayName")) \
24 HDSCENEINDEXPLUGINREGISTRY_TOKENS);
28class HdSceneIndexPlugin;
45 template<
typename T,
typename... Bases>
55 const TfToken &sceneIndexPluginId,
56 const HdSceneIndexBaseRefPtr &inputScene,
57 const HdContainerDataSourceHandle &inputArgs,
58 const std::string &renderInstanceId=std::string());
77 const std::string &rendererDisplayName,
78 const HdSceneIndexBaseRefPtr &inputScene,
79 const std::string &renderInstanceId=std::string(),
80 const std::string &appName=std::string());
84 InsertionOrderAtStart,
88 using InsertionPhase = int;
132 const std::string &rendererDisplayName,
133 const TfToken &sceneIndexPluginId,
134 const HdContainerDataSourceHandle &inputArgs,
135 InsertionPhase insertionPhase,
136 InsertionOrder insertionOrder);
139 using SceneIndexAppendCallback =
141 HdSceneIndexBaseRefPtr(
142 const std::string &renderInstanceId,
143 const HdSceneIndexBaseRefPtr &inputScene,
144 const HdContainerDataSourceHandle &inputArgs)>;
180 const std::string &rendererDisplayName,
181 SceneIndexAppendCallback callback,
182 const HdContainerDataSourceHandle &inputArgs,
183 InsertionPhase insertionPhase,
184 InsertionOrder insertionOrder);
192 const std::string& rendererDisplayName,
193 const std::string& appName);
207 void _LoadPluginsForRenderer(
208 const std::string &rendererDisplayName,
209 const std::string &appName);
211 HdSceneIndexPlugin *_GetSceneIndexPlugin(
const TfToken &pluginId);
215 _Entry(
const TfToken &sceneIndexPluginId,
216 const HdContainerDataSourceHandle &args)
217 : sceneIndexPluginId(sceneIndexPluginId)
221 _Entry(SceneIndexAppendCallback callback,
222 const HdContainerDataSourceHandle &args)
228 HdContainerDataSourceHandle args;
229 SceneIndexAppendCallback callback;
232 using _EntryList = std::vector<_Entry>;
233 using _EntriesByPhasesMap = std::map<InsertionPhase, _EntryList>;
234 using _RendererEntries
235 = std::map<std::pair<InsertionPhase, InsertionOrder>, _EntryList>;
237 using _RenderersMap = std::map<std::string, _RendererEntries>;
239 static _EntriesByPhasesMap
240 _RendererEntriesToPhaseMap(
const _RendererEntries& rendererEntries);
246 _ComputeEntriesByPhasesMap(
const std::string& rendererDisplayName)
const;
248 HdSceneIndexBaseRefPtr _AppendForPhases(
249 const HdSceneIndexBaseRefPtr &inputScene,
250 const _EntriesByPhasesMap &entriesByPhases,
251 const HdContainerDataSourceHandle &argsUnderlay,
252 const std::string &renderInstanceId);
254 _RenderersMap _sceneIndicesForRenderers;
260 using _PreloadMap = std::map<std::string, TfTokenVector>;
261 _PreloadMap _preloadsForRenderer;
268 using _EnabledAppsMap = std::map<TfToken, std::set<std::string>>;
269 _EnabledAppsMap _preloadAppsForPlugins;
272template<
typename T,
typename... Bases>
278PXR_NAMESPACE_CLOSE_SCOPE
A registry for renderer- and application-specific scene indices.
static HD_API HdSceneIndexPluginRegistry & GetInstance()
Returns the singleton registry for HdSceneIndexPlugin.
HD_API HdSceneIndexBaseRefPtr AppendSceneIndicesForRenderer(const std::string &rendererDisplayName, const HdSceneIndexBaseRefPtr &inputScene, const std::string &renderInstanceId=std::string(), const std::string &appName=std::string())
Append scene indices generated by plug-ins registered (via RegisterSceneIndexForRenderer) for this re...
HD_API void RegisterSceneIndexForRenderer(const std::string &rendererDisplayName, SceneIndexAppendCallback callback, const HdContainerDataSourceHandle &inputArgs, InsertionPhase insertionPhase, InsertionOrder insertionOrder)
Register a scene index to be instantiated via a callback for a specified renderer (or all renderers i...
static void Define()
Entry point for defining an HdSceneIndexPlugin plugin.
HD_API void RegisterSceneIndexForRenderer(const std::string &rendererDisplayName, const TfToken &sceneIndexPluginId, const HdContainerDataSourceHandle &inputArgs, InsertionPhase insertionPhase, InsertionOrder insertionOrder)
Register a scene index to be instantiated for a specified renderer (or all renderers if rendererDispl...
void _CollectAdditionalMetadata(const PlugRegistry &plugRegistry, const TfType &pluginType) override
Gives subclasses an opportunity to inspect plugInfo-based metadata at the time of discovery.
HD_API std::vector< TfToken > LoadAndGetSceneIndexPluginIds(const std::string &rendererDisplayName, const std::string &appName)
Loads plugins for rendererDisplayName and appName.
HD_API HdSceneIndexBaseRefPtr AppendSceneIndex(const TfToken &sceneIndexPluginId, const HdSceneIndexBaseRefPtr &inputScene, const HdContainerDataSourceHandle &inputArgs, const std::string &renderInstanceId=std::string())
Given a specific scene index plug-in id, give the plug-in a chance to add scene indices to the end of...
Base class for registering Hydra plugins using the plug mechanism.
static void Define()
Entry point for registering a types implementation.
Defines an interface for registering plugins.
Manage a single instance of an object (see.
Token for efficient comparison, assignment, and hashing of known strings.
TfType represents a dynamic runtime type.
Manage a single instance of an object.
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.