Skip to content

GPU budget, performance presets and a system scan - #2

Merged
clark719664 merged 1 commit into
mainfrom
gpu-budget
Oct 22, 2026
Merged

clark719664 merged 1 commit into
mainfrom
gpu-budget

Conversation

@clark719664

Copy link
Copy Markdown
Owner

Why

Lucent kept the GPU at 100% whatever the settings: with the camera still it raised samples per frame until each frame took ~24 ms, so lowering resolution or bounces just let it pack in more samples. Left open in a tab, it never stopped.

What changes

  • GPU budget. Work is scheduled against a share of wall-clock time with a token bucket: time earns GPU credit, and each frame only starts the samples it can afford. Per-sample cost comes from EXT_disjoint_timer_query_webgl2 when available, otherwise from a synced re-measure every 2 s.
  • Presets. Eco / Balanced / High / Max set budget, frame-rate cap, resolution, bounces and a stop-at sample count. Any edit shows as Custom.
  • Stop when converged. At the stop count nothing is traced, and the canvas isn't redrawn unless something visible changes.
  • System scan. Times a few samples of the current scene (at half resolution first, so a slow GPU never stalls long), scales the cost to the full canvas, and applies the recommended preset. It runs once on a first visit, waits until the canvas has a real size, and saves the result to localStorage.
  • Pause when the window loses focus (on by default except in Max). The HUD and stats show GPU load and cost per sample.

Measured

Windows per-process GPU counters (Claude app's GPU process), RX 7600, Showroom at 1280×720:

Setting GPU load
Before this PR 84%
Balanced (50% budget) 44%
Eco (25% budget) 26%
Converged (stop count reached) 0.3%

The scan on this machine: 37.5 ms per full-resolution sample → Balanced (75% resolution, 50% budget, stop at 2048 spp).

Checks

  • lint, typecheck, test (79, including a scheduler simulation across per-sample costs from 0.5 to 120 ms) and build pass locally.
  • Bundle: 48.6 kB gzipped JS.

Merging deploys GitHub Pages.

🤖 Generated with Claude Code

Lucent used to raise samples per frame until the GPU was saturated, so
lowering resolution or bounces only made it pack in more samples.

- Work is now scheduled against a GPU budget (share of wall-clock time) with
  a token bucket; per-sample cost comes from GPU timer queries, or a synced
  re-measure every 2 s where those are unavailable.
- Eco / Balanced / High / Max presets: budget, frame-rate cap, resolution,
  bounces and a stop-at sample count. Converged scenes stop drawing.
- Scan system times the current scene, scales to the full canvas and applies
  a recommended preset; runs once on first visit, saved to localStorage.
- Optional pause when the window loses focus; HUD and stats show GPU load.

Measured with Windows GPU counters on an RX 7600: Balanced 44%, Eco 26%,
converged 0.3% (previously 84%+).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clark719664
clark719664 merged commit 4a8bfbb into main Oct 22, 2026
2 checks passed
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
Repository owner deleted a comment from chatgpt-codex-connector Bot Oct 22, 2026
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