Skip to content

Refactor GSplatRenderer into base class with GSplatQuadRenderer derived class#8520

Merged
mvaligursky merged 1 commit intomainfrom
mv-gsplat-renderer-base-class
Mar 11, 2026
Merged

Refactor GSplatRenderer into base class with GSplatQuadRenderer derived class#8520
mvaligursky merged 1 commit intomainfrom
mv-gsplat-renderer-base-class

Conversation

@mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Mar 11, 2026

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:

  • Split GSplatRenderer into a base class with common state and stub API methods
  • Create GSplatQuadRenderer extending the base with all material/mesh/instancing logic
  • Update GSplatManager to type its renderer as GSplatRenderer (base type) while constructing GSplatQuadRenderer
  • Move visibility hiding into GSplatQuadRenderer.disableIndirectDraw() instead of external calls
  • Guard work buffer updates and frame updates against stale sorted state (sortedBefore === false) to prevent incorrect frames during GPU→CPU sort transitions

…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
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 GSplatRenderer into a thin base/interface holding shared renderer state and API surface.
  • Added GSplatQuadRenderer implementing the existing instanced-quad + MeshInstance rendering path (materials, defines, indirect draw).
  • Updated GSplatManager to construct GSplatQuadRenderer and 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.

@mvaligursky mvaligursky merged commit e8bb5ad into main Mar 11, 2026
12 checks passed
@mvaligursky mvaligursky deleted the mv-gsplat-renderer-base-class branch March 11, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants