Skip to content

openusd-imaging: Hydra's renderer side (renderers, plugins and their filters) - #239

Open
doubleailes wants to merge 1 commit into
mxpv:mainfrom
doubleailes:imaging-renderer
Open

doubleailes wants to merge 1 commit into
mxpv:mainfrom
doubleailes:imaging-renderer

Conversation

@doubleailes

@doubleailes doubleailes commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The renderer side of Hydra, as proposed in #200 (point 1 of the latest comment). These pieces exist in C++, so they're within the plan as written. Render control, the part ahead of Hydra, is not in this PR.

One commit on main, now that #235 has merged. It doesn't depend on #236 (the parity test and its two stage index fixes), so the two can merge in either order.

Here C++
hd::renderer::{Renderer, RendererPlugin, create_renderer} HdRenderer, HdRendererPlugin (Hydra 2.0 API), UsdImagingGLEngine::_CreateSceneIndexChainAndRenderer
hd::scene_index_plugin::{RendererFilter, InsertionOrder, renderer_filters} HdSceneIndexPluginRegistry (insertion phase and order)
hd::schema::RendererCreateArgsSchema HdRendererCreateArgsSchema
hdsi::prim_managing::{PrimManagingObserver, ManagedPrim, PrimFactory} HdsiPrimManagingSceneIndexObserver
hdsi::prim_managing::PrimManagingRenderer how hdPrman builds its renderer: HdsiPrimTypeNoticeBatchingSceneIndex plus the observer, flushed in Update

Notes for review:

  • Filter order follows the registry's default policy (CppRegistrationOnly). The host's filters (registered for every renderer) and the renderer's are each sorted by phase, then insertion order, then list position (where C++ sorts by plugin id). The two lists are then merged by phase, with the host's first within a phase whatever their insertion order: C++ keeps this ordering for now, and its comments explain why. host_first_in_phase covers it. The tag-based ordering of plugin metadata (JsonMetadataOnly, Hybrid) is left out, since there's no plugin metadata to read.
  • No registry. Nothing loads at run time: the host passes its filters, and the plugin names its own through RendererPlugin::renderer_filters. The standard filters come with the phases their C++ users register them at: light linking at 4, AtStart (hdPrman, arnold-usd), dependency forwarding at 1000, AtEnd (arnold-usd), and the host's scene globals at 0, AtStart (UsdImagingGLEngine).
  • RendererCreateArgsSchema reads gpuEnabled. drivers holds HdDriver objects that a vt::Value can't carry, so a renderer that needs a device takes it from its plugin.
  • PrimManagingRenderer isn't a Hydra class. It's hdPrman's pattern, kept as a small helper because every Hydra 2.0 renderer built this way needs it. It can move out if you'd rather keep hdsi strictly to C++ classes.
  • Render control (HdLegacyRenderControlInterface, which HdRenderer is meant to replace) isn't in this PR. Following Proposal: an openusd-imaging crate (Hydra 2.0 scene indices over usd::Stage) #200, it comes next as the render module (openusd-imaging: render control (render module) #240), stacked on this one.

Refs #200

Test plan

  • cargo test -p openusd-imaging: 438 tests (21 new: renderer plugins and creation, filter order including the host-first merge, the prim managing observer and renderer, what edits notify through the chain with light linking and dependency forwarding)
  • cargo clippy -p openusd-imaging --all-targets --all-features -- -D warnings
  • cargo fmt --all --check, cargo doc -p openusd-imaging --no-deps

🤖 Generated with Claude Code

https://claude.ai/code/session_014ZoN1tXViXSwUKLN6rWKLs

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T07:59:28.244454Z 53c9111 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53c91116cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// first, nearer the input.
pub phase: i32,
pub order: InsertionOrder,
pub build: Box<dyn Fn(SceneIndexHandle) -> SceneIndexHandle>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass create arguments into renderer filters

When a renderer's scene-index plugin needs to choose or configure a filter from gpuEnabled (or another per-creation argument), there is no supported way to do so: RendererPlugin::renderer_filters receives no arguments and this builder receives only the input index, even though create_renderer accepts the arguments and forwards them to the other plugin hooks. As a result, creating the same plugin with different arguments can change support and renderer creation but cannot change the filter chain; pass the create arguments through when obtaining/building the filters.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++ doesn't pass the renderer create args to scene index plugins. In 26.08, UsdImagingGLEngine gives HdRendererCreateArgsSchema (gpuEnabled, hgi) only to IsSupported and CreateRenderer, which is what create_renderer does here. HdSceneIndexPluginRegistry::AppendSceneIndicesForRenderer gives each plugin a different container: its registration args, overlaid on the scene index create args (HdRendererPlugin::GetSceneIndexCreateArgs plus UsdImaging's: motionBlurSupport, excludedPurposesHint, ...), overlaid on rendererDisplayName, together with the renderInstanceId.

So I'll leave the create args out of the filters, to match C++. The gap is real but different: a filter here only gets its registration args, which its closure captures, and not the scene index create args or the renderer name. Adding those the C++ way, with GetSceneIndexCreateArgs on the plugin and that overlay handed to each filter, is a follow-up.

- `hd::renderer`: `HdRenderer` and `HdRendererPlugin` in Hydra 2.0's shape:
  a renderer's `update` (`HdRenderDelegate::Update`), a plugin's support
  for given create args with the reason why not, its scene index plugins
  and its renderer over a terminal scene index; `create_renderer` ties them
  to a host's input, as `UsdImagingGLEngine` does.
- `hd::scene_index_plugin`: the filters a render index applies over the
  host's input, in `HdSceneIndexPluginRegistry`'s default order: the
  host's and the renderer's each sorted by phase then insertion order,
  merged by phase with the host's first. Light linking, dependency
  forwarding and the scene globals a host sets come as filters at the
  phases hdPrman, arnold-usd and `UsdImagingGLEngine` register them at.
- `hd::schema::RendererCreateArgsSchema`, with `gpuEnabled`.
- `hdsi::prim_managing`: `HdsiPrimManagingSceneIndexObserver`, one managed
  prim per prim made by a factory, and a renderer batching its terminal's
  notices by prim type and managing its prims, flushed in `update`, as
  hdPrman builds its own.

Hydra's render control (`HdLegacyRenderControlInterface`) is not ported:
Hydra has not settled it.

Refs mxpv#200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014ZoN1tXViXSwUKLN6rWKLs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant