Skip to content

Commit 1a34133

Browse files
rajabalapixar-oss
authored andcommitted
[hdPrman] Refactor scene index plugin registration.
Hardcode input args in _AppendSceneIndex instead of registration. This is part of a series of a changes to remove the use of inputArgs in the registration API as preparatory work to simplify scene index plugin registration in Hydra. (Internal change: 2388908)
1 parent 6b06038 commit 1a34133

File tree

4 files changed

+63
-54
lines changed

4 files changed

+63
-54
lines changed

third_party/renderman/plugin/hdPrman/lightLinkingSceneIndexPlugin.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ TF_REGISTRY_FUNCTION(HdSceneIndexPlugin)
6262
HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer(
6363
rendererDisplayName,
6464
_tokens->sceneIndexPluginName,
65-
// XXX Update inputArgs to provide the list of geometry types
66-
// supported by hdPrman.
67-
nullptr,
65+
/* inputArgs = */ nullptr,
6866
insertionPhase,
6967
HdSceneIndexPluginRegistry::InsertionOrderAtStart);
7068
}
@@ -86,7 +84,12 @@ class HdPrman_LightLinkingSceneIndexPlugin :
8684
const HdSceneIndexBaseRefPtr &inputScene,
8785
const HdContainerDataSourceHandle &inputArgs) override
8886
{
89-
return HdsiLightLinkingSceneIndex::New(inputScene, inputArgs);
87+
TF_UNUSED(inputArgs);
88+
// XXX Update inputArgs to provide the list of geometry and light types
89+
// supported by hdPrman instead of using the fallback behavior in
90+
// HdsiLightLinkingSceneIndex that uses the hardcoded tokens in hd.
91+
static const HdContainerDataSourceHandle localInputArgs = nullptr;
92+
return HdsiLightLinkingSceneIndex::New(inputScene, localInputArgs);
9093
}
9194
};
9295

third_party/renderman/plugin/hdPrman/matfiltSceneIndexPlugins.cpp

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ enum _MatfiltOrder
5757
// Plugin registrations
5858
////////////////////////////////////////////////////////////////////////////////
5959

60-
// XXX: Hardcoded for now to match the legacy matfilt logic.
61-
static const bool _resolveVstructsWithConditionals = true;
62-
6360
TF_REGISTRY_FUNCTION(TfType)
6461
{
6562
HdSceneIndexPluginRegistry::Define<
@@ -79,6 +76,10 @@ TF_REGISTRY_FUNCTION(TfType)
7976

8077
TF_REGISTRY_FUNCTION(HdSceneIndexPlugin)
8178
{
79+
// XXX Do we expect other plugins to want to insert themselves between
80+
// these matfilt plugins? If not, we could use a single plugin that
81+
// strings them together in the correct order.
82+
//
8283
for( auto const& rendererDisplayName : HdPrman_GetPluginDisplayNames() ) {
8384
HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer(
8485
rendererDisplayName,
@@ -94,23 +95,17 @@ TF_REGISTRY_FUNCTION(HdSceneIndexPlugin)
9495
_MatfiltOrder::NodeTranslation,
9596
HdSceneIndexPluginRegistry::InsertionOrderAtStart);
9697

97-
HdContainerDataSourceHandle const inputArgs =
98-
HdRetainedContainerDataSource::New(
99-
_tokens->applyConditionals,
100-
HdRetainedTypedSampledDataSource<bool>::New(
101-
_resolveVstructsWithConditionals));
102-
10398
HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer(
10499
rendererDisplayName,
105100
_tokens->vstructPluginName,
106-
inputArgs,
101+
/* inputArgs = */ nullptr,
107102
_MatfiltOrder::ConnectionResolve,
108103
HdSceneIndexPluginRegistry::InsertionOrderAtStart);
109104

110105
HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer(
111106
rendererDisplayName,
112107
_tokens->nodeIdPluginName,
113-
inputArgs,
108+
/* inputArgs = */ nullptr,
114109
_MatfiltOrder::NodeIdResolution,
115110
HdSceneIndexPluginRegistry::InsertionOrderAtStart);
116111
}
@@ -263,16 +258,12 @@ HdPrman_VirtualStructResolvingSceneIndexPlugin::_AppendSceneIndex(
263258
const HdSceneIndexBaseRefPtr &inputScene,
264259
const HdContainerDataSourceHandle &inputArgs)
265260
{
266-
bool applyConditionals = false;
267-
if (HdBoolDataSourceHandle val = HdBoolDataSource::Cast(
268-
inputArgs->Get(_tokens->applyConditionals))) {
269-
applyConditionals = val->GetTypedValue(0.0f);
270-
} else {
271-
TF_CODING_ERROR("Missing argument to plugin %s",
272-
_tokens->vstructPluginName.GetText());
273-
}
261+
TF_UNUSED(inputArgs);
262+
// XXX: Hardcoded for now to match the legacy matfilt logic.
263+
static const bool _resolveVstructsWithConditionals = true;
264+
274265
return HdPrman_VirtualStructResolvingSceneIndex::New(
275-
inputScene, applyConditionals);
266+
inputScene, _resolveVstructsWithConditionals);
276267
}
277268

278269
/// ----------------------------------------------------------------------------

third_party/renderman/plugin/hdPrman/renderSettingsFilteringSceneIndexPlugin.cpp

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,31 +85,11 @@ TF_REGISTRY_FUNCTION(HdSceneIndexPlugin)
8585
{
8686
const HdSceneIndexPluginRegistry::InsertionPhase insertionPhase = 1;
8787

88-
// Configure the scene index to:
89-
// 1. Filter in settings that have either the ri: or outputs:ri namespaces.
90-
// 2. Insert a fallback render settings prim.
91-
//
92-
// (2) is a workaround to address Riley's requirements around scene options.
93-
// See HdPrman_RenderParam::SetRileyOptions and
94-
// HdPrman_RenderSettings::_Sync for further info.
95-
//
96-
const HdContainerDataSourceHandle inputArgs =
97-
HdRetainedContainerDataSource::New(
98-
HdsiRenderSettingsFilteringSceneIndexTokens->namespacePrefixes,
99-
HdRetainedTypedSampledDataSource<VtArray<TfToken>>::New(
100-
#if PXR_VERSION >= 2311
101-
{_namespaceTokens->ri, _namespaceTokens->outputsRi}),
102-
HdsiRenderSettingsFilteringSceneIndexTokens->fallbackPrimDs,
103-
_BuildFallbackRenderSettingsPrimDataSource() );
104-
#else
105-
{_namespaceTokens->ri, _namespaceTokens->outputsRi}));
106-
#endif
107-
10888
for( auto const& pluginDisplayName : HdPrman_GetPluginDisplayNames()) {
10989
HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer(
11090
pluginDisplayName,
11191
_tokens->sceneIndexPluginName,
112-
inputArgs,
92+
/* inputArgs =*/ nullptr,
11393
insertionPhase,
11494
HdSceneIndexPluginRegistry::InsertionOrderAtStart);
11595
}
@@ -127,7 +107,34 @@ HdPrman_RenderSettingsFilteringSceneIndexPlugin::_AppendSceneIndex(
127107
const HdSceneIndexBaseRefPtr &inputScene,
128108
const HdContainerDataSourceHandle &inputArgs)
129109
{
130-
return HdsiRenderSettingsFilteringSceneIndex::New(inputScene, inputArgs);
110+
TF_UNUSED(inputArgs);
111+
// Define inputArgs here instead of in the TF_REGISTRY_FUNCTION block.
112+
// In the future, we may consider renaming the inputArgs parameter to
113+
// something like "sceneIndexGraphCreateArgs" to allow the app and renderer
114+
// plugin to provide arguments for scene indices instantiated via the
115+
// scene index plugin system.
116+
//
117+
// Configure the scene index to:
118+
// 1. Filter in settings that have either the ri: or outputs:ri namespaces.
119+
// 2. Insert a fallback render settings prim.
120+
//
121+
// (2) is a workaround to address Riley's requirements around scene options.
122+
// See HdPrman_RenderParam::SetRileyOptions and
123+
// HdPrman_RenderSettings::_Sync for further info.
124+
//
125+
const HdContainerDataSourceHandle localInputArgs =
126+
HdRetainedContainerDataSource::New(
127+
HdsiRenderSettingsFilteringSceneIndexTokens->namespacePrefixes,
128+
HdRetainedTypedSampledDataSource<VtArray<TfToken>>::New(
129+
#if PXR_VERSION >= 2311
130+
{_namespaceTokens->ri, _namespaceTokens->outputsRi}),
131+
HdsiRenderSettingsFilteringSceneIndexTokens->fallbackPrimDs,
132+
_BuildFallbackRenderSettingsPrimDataSource() );
133+
#else
134+
{_namespaceTokens->ri, _namespaceTokens->outputsRi}));
135+
#endif
136+
return HdsiRenderSettingsFilteringSceneIndex::New(
137+
inputScene, localInputArgs);
131138
}
132139

133140
PXR_NAMESPACE_CLOSE_SCOPE

third_party/renderman/plugin/hdPrman/velocityMotionResolvingSceneIndexPlugin.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,20 +1138,14 @@ TF_REGISTRY_FUNCTION(TfType)
11381138

11391139
TF_REGISTRY_FUNCTION(HdSceneIndexPlugin)
11401140
{
1141-
const HdContainerDataSourceHandle inputArgs =
1142-
HdRetainedContainerDataSource::New(
1143-
// TODO: Get the real framerate!
1144-
_tokens->fps,
1145-
HdRetainedTypedSampledDataSource<float>::New(_fallbackFps));
1146-
11471141
// This plugin must come after extcomp but before motion blur
11481142
const HdSceneIndexPluginRegistry::InsertionPhase insertionPhase = 2;
11491143

11501144
for (const auto& rendererDisplayName : HdPrman_GetPluginDisplayNames()) {
11511145
HdSceneIndexPluginRegistry::GetInstance().RegisterSceneIndexForRenderer(
11521146
rendererDisplayName,
11531147
HdPrmanPluginTokens->velocityMotion,
1154-
inputArgs,
1148+
/* inputArgs = */ nullptr,
11551149
insertionPhase,
11561150
HdSceneIndexPluginRegistry::InsertionOrderAtEnd);
11571151
}
@@ -1165,7 +1159,21 @@ HdPrman_VelocityMotionResolvingSceneIndexPlugin::_AppendSceneIndex(
11651159
const HdSceneIndexBaseRefPtr& inputScene,
11661160
const HdContainerDataSourceHandle& inputArgs)
11671161
{
1168-
return HdsiVelocityMotionResolvingSceneIndex::New(inputScene, inputArgs);
1162+
TF_UNUSED(inputArgs);
1163+
// Define inputArgs here instead of in the TF_REGISTRY_FUNCTION block.
1164+
// In the future, we may consider renaming the inputArgs parameter to
1165+
// something like "sceneIndexGraphCreateArgs" to allow the app and renderer
1166+
// plugin to provide arguments for scene indices instantiated via the
1167+
// scene index plugin system.
1168+
const HdContainerDataSourceHandle localInputArgs =
1169+
HdRetainedContainerDataSource::New(
1170+
// TODO: Get the real framerate!
1171+
_tokens->fps,
1172+
HdRetainedTypedSampledDataSource<float>::New(
1173+
_fallbackFps));
1174+
1175+
return HdsiVelocityMotionResolvingSceneIndex::New(
1176+
inputScene, localInputArgs);
11691177
}
11701178

11711179
void

0 commit comments

Comments
 (0)