Skip to content

Viewer: cap the frame rate on software renderers - #1220

Merged
wass08 merged 1 commit into
mainfrom
wawa/software-renderer-fps
Nov 6, 2026
Merged

wass08 merged 1 commit into
mainfrom
wawa/software-renderer-fps

Conversation

@wass08

@wass08 wass08 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Caps the viewer's frame rate at 20 fps when the device renders on the CPU (a software WebGPU adapter, SwiftShader, llvmpipe), detected with the existing device tier. GPUs are unaffected.

On a software rasterizer the usual 50 fps cadence is out of reach, and chasing it starves the app of the cores it renders on. The daylight look from #1217 has heavier frames, which made this bite: editor E2E specs ran about 1.6× slower on CI's GPU-less browser and timed out.

Measured locally on SwiftShader (undo/redo E2E spec): 64 s before, 47 s with the cap (41 s in monochrome). The paint spec passes in 21 s.

How to test

  1. In a browser with hardware acceleration off (or headless Chromium with --use-angle=swiftshader), open a project: the device is detected as a software renderer, and frames are capped at 20 fps.
  2. With a GPU, nothing changes.

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

🤖 Generated with Claude Code


Note

Low Risk
Render-loop cadence change only when a software rasterizer is detected; GPU users and persisted preferences are unaffected.

Overview
When WebGPU init completes, the viewer now records whether rendering is CPU/software (fallback adapter, SwiftShader, llvmpipe, etc.) via new isSoftwareRenderer in device-tier, stored as transient softwareRenderer in the viewer store alongside detected quality tier.

<FrameLimiter> then uses min(maxFps, 20) instead of the default 50 fps cap on those devices, so the loop does not burn CPU chasing an unreachable cadence. Hardware GPU paths are unchanged.

Unit tests cover software vs GPU detection strings.

Reviewed by Cursor Bugbot for commit 0712548. Bugbot is set up for automated code reviews on this repo. Configure here.

On a CPU rasterizer (a software adapter, SwiftShader, llvmpipe) the usual 50 fps
cadence is out of reach and chasing it starves the app of the cores it renders
on. The daylight look's heavier frames made that bite: editor E2E specs ran ~1.6×
slower on CI's GPU-less browser and timed out. Detected with the device tier,
software renderers now cap at 20 fps (SwiftShader undo/redo spec: 64 s → 47 s;
monochrome 41 s). GPUs are unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wass08
wass08 force-pushed the wawa/software-renderer-fps branch from 16476ae to 0712548 Compare November 6, 2026 00:48
@wass08
wass08 merged commit 3d5675c into main Nov 6, 2026
4 checks passed
@wass08
wass08 deleted the wawa/software-renderer-fps branch November 6, 2026 01:13
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