Skip to content

Replace interval texture binary search with instanced quad rendering for GSplat work buffer copy#8456

Merged
mvaligursky merged 1 commit intomainfrom
mv-optimize-gsplat-copy-indexing
Feb 13, 2026
Merged

Replace interval texture binary search with instanced quad rendering for GSplat work buffer copy#8456
mvaligursky merged 1 commit intomainfrom
mv-optimize-gsplat-copy-indexing

Conversation

@mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Feb 13, 2026

Replaces the two-pass interval texture expansion (GSplatIntervalTexture class + binary search
fragment shader) with a single instanced draw call when copying GSplat data to the work buffer.

Functionality:

  • Each LOD interval is split into row-aligned rectangles on the CPU and stored in a small
    RGBA32U data texture. One instanced quad is drawn per rectangle, with the fragment shader
    computing the original source index arithmetically from flat varyings — eliminating the
    binary search texture lookup entirely.
  • QuadRender unified to always use indexed PRIMITIVE_TRIANGLES via the shared quadIndexBuffer,
    with a new numInstances parameter for instanced draws.

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

This PR replaces the two-pass GPU-based interval texture expansion (using binary search) with a more efficient single-pass instanced rendering approach for copying GSplat data to the work buffer. The new implementation computes source indices arithmetically in the fragment shader, eliminating the need for the intermediate interval texture and binary search lookup.

Changes:

  • Removed GSplatIntervalTexture class and associated binary search fragment shaders
  • Added instanced quad vertex shaders that split LOD intervals into row-aligned rectangles on the CPU
  • Modified fragment shaders to compute original splat indices arithmetically from flat varyings
  • Unified QuadRender to always use indexed PRIMITIVE_TRIANGLES with a new shared quadIndexBuffer
  • Added numInstances parameter to QuadRender for instanced drawing support

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatCopyInstancedQuad.js New WGSL vertex shader for instanced quad rendering with per-instance rectangle parameters
src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplatCopyInstancedQuad.js New GLSL vertex shader for instanced quad rendering with per-instance rectangle parameters
src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatIntervalTexture.js Removed - binary search interval expansion no longer needed
src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplatIntervalTexture.js Removed - binary search interval expansion no longer needed
src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js Updated to compute source index arithmetically from flat varyings instead of texture lookup
src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplatCopyToWorkbuffer.js Updated to compute source index arithmetically from flat varyings instead of texture lookup
src/scene/gsplat-unified/gsplat-work-buffer.js Updated to select instanced vertex shader for LOD path, removed unused device field
src/scene/gsplat-unified/gsplat-work-buffer-render-pass.js Updated to use instanced rendering with sub-draw data texture instead of interval texture
src/scene/gsplat-unified/gsplat-interval-texture.js Removed - entire class replaced by simpler sub-draw data texture approach
src/scene/gsplat-unified/gsplat-info.js Added updateSubDraws method to split intervals into row-aligned rectangles and pack into texture
src/scene/graphics/quad-render.js Unified to use indexed triangles, added numInstances parameter for instanced rendering
src/platform/graphics/graphics-device.js Added quadIndexBuffer for indexed quad rendering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mvaligursky mvaligursky merged commit 5376911 into main Feb 13, 2026
14 checks passed
@mvaligursky mvaligursky deleted the mv-optimize-gsplat-copy-indexing branch February 13, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue performance Relating to load times or frame rate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant