GPU Texture mgt with HdStRenderBuffer vs. HdRenderIndex

Hi,

When creating two TaskController instances using the same RenderIndex instance, it creates the needed render buffers for the two TaskController instances. But these render buffers are only deleted when the RenderIndex is deleted and not when the corresponding TaskController instance is deleted.

(Note: To make this work the two TaskController instances have a different id).

That seems to be a weakness as the RenderIndex instance keeps useless render buffers if their corresponding TaskController instance is deleted.

Do I misunderstand something?
Is there a reason to do so (i.e., deallocate but no delete)?
Is that a weakness?

As a context the hierarchy is HdBPrim ← HdRenderBuffer ← HdStRenderBuffer. When rendering a list for render tasks, the sync() step allocates the render buffer objects & creates the corresponding GPU textures (using the HgiXX implementation). But the finalize() step only deallocates the render buffer object (i.e., does not delete the GPU textures). When deleting the HdRenderIndex, the HdStResourceRegistry is deleted which then deletes all the GPU Textures.

Allocation & Creation - > OpenUSD/pxr/imaging/hdSt/renderBuffer.cpp at release · PixarAnimationStudios/OpenUSD · GitHub

Deallocation → OpenUSD/pxr/imaging/hdSt/renderBuffer.cpp at release · PixarAnimationStudios/OpenUSD · GitHub

My suggestion is to deallocate and delete the render buffers when the corresponding TaskController instance is deleted i.e., enhance the “HdStRenderBuffer::_Deallocate()” method to also delete the GPU textures.

Is that a right approach? any side-effects?

Thanks for any help.

Regards,
Patrick