Skip to content

Commit 2d86bac

Browse files
rajabalapixar-oss
authored andcommitted
[hd, hdsi, hdGp] Scene index plugin ordering via JSON metadata
This change introduces a JSON metadata-based system for declaring scene index plugin ordering, as an alternative and improvement to the existing C++ registration API. It lays the groundwork for eventually deprecating the C++ registration API in favor of a more declarative, data-driven approach. Plugins can now declare ordering constraints directly in their plugInfo.json via the following new fields: - tags - a list of semantic labels for a plugin (the plugin's own ID is added as a default tag) - ordering.before / ordering.after - tag-based constraints specifying which groups of plugins this plugin must come before or after - ordering.position - a tiebreaker within the unconstrained middle group (firstAfter, lastBefore, doesNotMatter) A new PluginOrderingPolicy enum controls which ordering mechanism is active: - CppRegistrationOnly (default) - preserves existing behavior, uses C++ insertion phase/order - JsonMetadataOnly - uses JSON metadata exclusively - Hybrid - attempts to honor both C++ registration order and JSON metadata constraints When using JsonMetadataOnly or Hybrid, ordering constraints are resolved using a topological sort (Kahn's algorithm). The default policy can be set via the env var HD_SCENE_INDEX_PLUGIN_ORDERING_POLICY_DEFAULT. It can also be set programmatically via SetPluginOrderingPolicy(), but this API is intended for testing purposes. Additionally, this change addresses a latent bug wherein the app name was used as a filter for plugin loading, but not when gathering the plugin entries. Callouts: Previously, plugins could use an env var to guard C++ registration causing the plugin to be excluded when creating the scene index plugin graph. Plugins should now also use the guard in _AppendSceneIndex so that the input scene is returned if the plugin shouldn't have an effect. See changes in hdsi/hdGp for examples. Testing: Updated testHdSceneIndexPluginRegistry to exercise all 3 ordering policies. (Internal change: 2398753)
1 parent 7f4bfb0 commit 2d86bac

10 files changed

Lines changed: 1120 additions & 115 deletions

File tree

pxr/imaging/hd/debugCodes.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ TF_REGISTRY_FUNCTION(TfDebug)
8383
TF_DEBUG_ENVIRONMENT_SYMBOL(HD_SAFE_MODE,
8484
"Enable additional security checks");
8585

86+
TF_DEBUG_ENVIRONMENT_SYMBOL(HD_SCENE_INDEX_PLUGIN_REGISTRY,
87+
"Report debug info on scene index plugin registry");
88+
8689
TF_DEBUG_ENVIRONMENT_SYMBOL(HD_SELECTION_UPDATE,
8790
"Report when selection is updated");
8891

pxr/imaging/hd/debugCodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ TF_DEBUG_CODES(
4343
HD_RPRIM_REMOVED,
4444
HD_RPRIM_UPDATED,
4545
HD_SAFE_MODE,
46+
HD_SCENE_INDEX_PLUGIN_REGISTRY,
4647
HD_SELECTION_UPDATE,
4748
HD_SHARED_EXT_COMPUTATION_DATA,
4849
HD_SPRIM_ADDED,

0 commit comments

Comments
 (0)