Dispose geometry and material in SparkRenderer.dispose() - #410
Dispose geometry and material in SparkRenderer.dispose()#410ArisLiWind wants to merge 2 commits into
Conversation
There is no need to specifically keep track of the constructor-created geometry. Replacing the geometry of the Also no need to include the unit tests in this PR. While ultimately we should have extensive tests covering things like this, the required bootstrapping isn't ideal. |
|
I see, got it! @ArisLiWind how would you like to make these changes so we can merge the PR? We can also take over this PR and apply these finishing touches. |
|
Thanks! Feel free to take over the PR and apply the remaining changes needed for the merge.@asundqui |
2eb7ee0 to
6030f83
Compare
|
Took this over as discussed, thanks @ArisLiWind. Simplified according to the discussion above and rebased on main to resolve the conflict with #413. |
|
Fixes #408 |
|
@dmarcos This should be ready to merge. |
Summary
Fixes a GPU resource leak in
SparkRenderer.dispose()by releasing the renderer-ownedSplatGeometrycreated in the constructor.Root cause
SparkRendererconstructs its ownSplatGeometry:That geometry is owned by the renderer instance, but
dispose()previously released render targets, textures, workers, accumulators, and pager state without disposing the geometry itself.Because
SplatGeometryallocates both apositionattribute and anindexbuffer, each create/dispose lifecycle could leave two WebGL buffers behind.Fix
Store the constructor-created geometry as renderer-owned state and dispose it during
SparkRenderer.dispose().Regression coverage
Added tests to verify that:
SparkRenderer.dispose()releases its internal geometrydispose()is safe to call multiple timesValidation
npm testnpm run lint -- --reporter=summary