You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When in scene index mode, adding a non-empty sublayer causes hydra to invalidate and resync every prim on the stage. This is done by HdSceneIndexAdapterSceneDelegate::PrimsRemoved, which gets called with "/". This triggers a call to HdRenderIndex::_Clear, which clears all prims. Critically this include the HdRenderBuffer bprims. But HdxTaskController is responsible for creating and destroying HdRendreBuffer brpims, normally. So at this point HdxTaskController is holding onto pointers to deleted HdRenderBuffers. Future viewport updates inevitably call functions on these deleted objects and usdview crashes.
Note that the HdRenderBuffers do get recreated as part of the SyncAll call. While this means it might be possible to update the HdxTaskController to point to these new objects (or for HdxTaskController to not hold these pointers in the first place and instead always go to the render index to find the current incarnation of the HdRenderBuffer for each AOV), I think it would be better if the HdRenderBuffers are never deleted, as there's no way to know how expensive this deletion/creation may be.
When not in scene index mode, there is no code path with calls HdPrimIndex::_Clear, and the only place HdRenderBuffers get deleted is from HdxTaskController, so legacy hydra mode never crashes in this situation.
Eep! It's too late to get a fix for this in 25.02 but we'll look at it right away. There might be a fix we can do in the merging scene index, or some sequencing change in HdxTaskController.
I'm quite sure the crash is because the render buffer is getting destroyed while the task controller still holds a pointer to the deleted object. I have no opinion on whether this indicates a problem with the render buffer handling or with the task handling.
I also think (just an opinion) that regardless of the root cause of the crash, it is wrong to delete the render buffers and recreate them just because there is a change to the "/" prim. You could argue that this is a separate bug, but I didn't want to presume what the solution to the crash would be, so I left it as part of this issue.
Description of Issue
When in scene index mode, adding a non-empty sublayer causes hydra to invalidate and resync every prim on the stage. This is done by HdSceneIndexAdapterSceneDelegate::PrimsRemoved, which gets called with "/". This triggers a call to HdRenderIndex::_Clear, which clears all prims. Critically this include the HdRenderBuffer bprims. But HdxTaskController is responsible for creating and destroying HdRendreBuffer brpims, normally. So at this point HdxTaskController is holding onto pointers to deleted HdRenderBuffers. Future viewport updates inevitably call functions on these deleted objects and usdview crashes.
Note that the HdRenderBuffers do get recreated as part of the SyncAll call. While this means it might be possible to update the HdxTaskController to point to these new objects (or for HdxTaskController to not hold these pointers in the first place and instead always go to the render index to find the current incarnation of the HdRenderBuffer for each AOV), I think it would be better if the HdRenderBuffers are never deleted, as there's no way to know how expensive this deletion/creation may be.
When not in scene index mode, there is no code path with calls HdPrimIndex::_Clear, and the only place HdRenderBuffers get deleted is from HdxTaskController, so legacy hydra mode never crashes in this situation.
Steps to Reproduce
usdview --renderer Embree cube.usda
:cube.zip
System Information (OS, Hardware)
Tested on Windows and Linux
Package Versions
Verified on dev branch as of Dec 18, 2024 (270278a)
Build Flags
Build with Embree and usdview. Though any renderer that creates HdRenderBuffers for AOVs will crash.
The text was updated successfully, but these errors were encountered: