Repository navigation
openusd-imaging: Hydra's renderer side (renderers, plugins and their filters) - #239
doubleailes wants to merge 1 commit into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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>, |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
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.
53c9111 to
921901e
Compare
921901e to
21e014c
Compare
- `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
21e014c to
a5236b7
Compare
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.hd::renderer::{Renderer, RendererPlugin, create_renderer}HdRenderer,HdRendererPlugin(Hydra 2.0 API),UsdImagingGLEngine::_CreateSceneIndexChainAndRendererhd::scene_index_plugin::{RendererFilter, InsertionOrder, renderer_filters}HdSceneIndexPluginRegistry(insertion phase and order)hd::schema::RendererCreateArgsSchemaHdRendererCreateArgsSchemahdsi::prim_managing::{PrimManagingObserver, ManagedPrim, PrimFactory}HdsiPrimManagingSceneIndexObserverhdsi::prim_managing::PrimManagingRendererHdsiPrimTypeNoticeBatchingSceneIndexplus the observer, flushed inUpdateNotes for review:
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_phasecovers it. The tag-based ordering of plugin metadata (JsonMetadataOnly,Hybrid) is left out, since there's no plugin metadata to read.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).RendererCreateArgsSchemareadsgpuEnabled.driversholdsHdDriverobjects that avt::Valuecan't carry, so a renderer that needs a device takes it from its plugin.PrimManagingRendererisn'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 keephdsistrictly to C++ classes.HdLegacyRenderControlInterface, whichHdRendereris meant to replace) isn't in this PR. Following Proposal: anopenusd-imagingcrate (Hydra 2.0 scene indices overusd::Stage) #200, it comes next as therendermodule (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 warningscargo fmt --all --check,cargo doc -p openusd-imaging --no-deps🤖 Generated with Claude Code
https://claude.ai/code/session_014ZoN1tXViXSwUKLN6rWKLs