Refactor GSplatRenderer into base class with GSplatQuadRenderer derived class#8520
Merged
mvaligursky merged 1 commit intomainfrom Mar 11, 2026
Merged
Refactor GSplatRenderer into base class with GSplatQuadRenderer derived class#8520mvaligursky merged 1 commit intomainfrom
mvaligursky merged 1 commit intomainfrom
Conversation
…r derived class Refactor GSplatRenderer into a thin base class that holds common state (device, node, cameraNode, layer, workBuffer, renderMode) and a derived GSplatQuadRenderer with all instanced-quad rendering logic (material, mesh instance, blend modes, indirect draw). Prepares the architecture for future compute-shader-based splat renderers. Also fixes a pre-existing bug where switching from GPU to CPU sorting could render frames with stale order data before the CPU worker delivers fresh sort results. Made-with: Cursor
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the unified GSplat rendering implementation by splitting the previous monolithic GSplatRenderer into a shared-state base class and a concrete instanced-quad renderer, while also tightening update logic to avoid rendering with stale sort/order data during GPU→CPU sorting transitions.
Changes:
- Split
GSplatRendererinto a thin base/interface holding shared renderer state and API surface. - Added
GSplatQuadRendererimplementing the existing instanced-quad +MeshInstancerendering path (materials, defines, indirect draw). - Updated
GSplatManagerto constructGSplatQuadRendererand to gate work-buffer/frame updates when the current sorted state hasn’t produced valid sort results yet (sortedBefore === false).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/scene/gsplat-unified/gsplat-renderer.js | Converts renderer into a base class with shared state and stubbed API methods. |
| src/scene/gsplat-unified/gsplat-quad-renderer.js | New derived renderer containing all instanced-quad rendering logic previously in GSplatRenderer. |
| src/scene/gsplat-unified/gsplat-manager.js | Instantiates GSplatQuadRenderer, moves indirect-draw visibility handling into the renderer, and guards updates against stale sorted state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor GSplatRenderer into a thin base class that holds common state (device, node, cameraNode, layer, workBuffer, renderMode) and a derived GSplatQuadRenderer that contains all instanced-quad rendering logic (material, mesh instance, blend modes, indirect draw). This prepares the architecture for future compute-shader-based splat renderers that won't use MeshInstance at all.
The base class defines the public renderer API as stub methods, allowing GSplatManager to work through the base type. GSplatQuadRenderer overrides all methods with the existing instanced-quad implementation.
Also fixes a pre-existing bug where switching from GPU to CPU sorting could render a few frames with stale order data before the CPU worker delivers fresh sort results.
Changes:
GSplatRendererinto a base class with common state and stub API methodsGSplatQuadRendererextending the base with all material/mesh/instancing logicGSplatManagerto type its renderer asGSplatRenderer(base type) while constructingGSplatQuadRendererGSplatQuadRenderer.disableIndirectDraw()instead of external callssortedBefore === false) to prevent incorrect frames during GPU→CPU sort transitions