Skip to content

Fix spreading black lighting and reduce streaming and instance-update costs - #85

Merged
SamG-Coder merged 2 commits into
mainfrom
codex/performance-history-fixes
Nov 13, 2026
Merged

SamG-Coder merged 2 commits into
mainfrom
codex/performance-history-fixes

Conversation

@SamG-Coder

@SamG-Coder SamG-Coder commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

A single invalid diffuse-GI history sample spreads through neighbouring pixels every frame. The production-shader regression reproduces growth from 4 to 169 invalid pixels over twelve healthy frames. Rejecting invalid history samples stops that growth; homogeneous triangle interpolation also removes a confirmed NaN source when a vertex lies on the eye plane.

This change also reduces CPU work and geometry storage without lowering render quality settings:

  • Replace repeated linear searches and duplicate pending transforms with direct per-instance indexing.
  • Build the streaming priority queue in linear time and store page dependencies contiguously, preserving fetch ordering and retention policy.
  • Share byte-identical vertex payloads and triangle runs within pages, preserving all attributes, sibling sets, and binary compatibility.
  • Spread oversized traversal dispatches across balanced X/Y dimensions. The original dispatch becomes invalid above 2,097,120 entries even though the queue holds 4,194,304.
  • Use the native Windows disk-space API, fixing the existing low-space bake regression in this environment.

Measurements

Release microbenchmarks on a Ryzen 7 9800X3D; these are component timings, not whole-scene FPS:

Workload Before After
Read/update 32,768 transforms 308.51 ms 0.16 ms
Eight updates per object, 32,768 objects 6.18 ms 1.15 ms
Plan requests across 1,048,576 pages 8.94 ms 2.81 ms
Foliage fixture geometry pages 35 33
Foliage raw geometry 3,402,100 bytes 3,159,988 bytes

Movement checksums and a 3,000-frame streaming soak match the original code exactly. The page harness checks every vertex and triangle byte. Deflated foliage improves only 0.36%; connected terrain has little duplication. Existing assets remain compatible and need a re-bake only to gain the packing savings.

Validation

  • 630 non-renderer workspace tests passed; one existing test ignored.
  • 286 renderer unit tests passed; one existing test ignored.
  • New GPU regressions pass on RTX 5080/Vulkan: NaN/±infinity history recovery, whole-image TAA recovery, eye-plane interpolation, and full-capacity traversal.
  • Native workspace/all-target Clippy with warnings denied and formatting checks passed.
  • WASM viewer builds and Clippy passed for minimal, default, and editor configurations; browser baker build and Clippy passed.
  • Final GPU integration run passed: 93 tests, one existing ignored test (354.39 seconds). Native suites total 1,009 passing tests and three existing ignored tests.

The reported street application has not been rebuilt with this checkout, so the exact initiating input in that application remains unconfirmed. A separate depth/ID atomic-write race and further conservative baked-visibility opportunities are documented, not claimed fixed. See the audit and raw measurements.

Authorship

Reviewed by: Claude Sonnet 5.5 (independent review, no blocking bugs found: dispatch index reconstruction, streaming queue order, motion index, builder dedupe against the decoder, and the Windows disk-space FFI all checked). Noted, not blocking: screen-space GI/reflection hits whose history falls off-screen now fall back to the volume instead of edge-clamped history, a small deterministic change near screen edges; heavily duplicated geometry can raise the per-slot cluster-table stride. Locally verified by Claude Opus 5.5 at a07a4b4: bash scripts/check-changed.sh --all (1009 passed, 0 failed, all checks passed) and node apps/viewer/web/editor/test.mjs (all passed).

  • All code, text and comments in this pull request were written by a frontier AI model, with no human-written code, and will be reviewed by a frontier AI model before merging, as the Code of Conduct requires.

@SamG-Coder
SamG-Coder marked this pull request as ready for review November 13, 2026 09:41
@SamG-Coder
SamG-Coder merged commit 06d6267 into main Nov 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant