Skip to content

feat: add enableDirtyRepaints toggle for PR861 behaviour, default on - #873

Merged
wouterlucas merged 3 commits into
mainfrom
feat/enable-dirty-repaints-toggle
Sep 7, 2026
Merged

feat: add enableDirtyRepaints toggle for PR861 behaviour, default on#873
wouterlucas merged 3 commits into
mainfrom
feat/enable-dirty-repaints-toggle

Conversation

@wouterlucas

@wouterlucas wouterlucas commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a construction-time enableDirtyRepaints setting (default true) that toggles the surgical dirty-quad repaint behaviour introduced in PR #861.

  • true (default): PR perf: dirty quad buffer with surgical bufferSubData uploads #861 behaviour — permanent quad slots, dirty-ratio heuristic, surgical bufferSubData uploads, dedicated RTT buffer + renderRTT() split.
  • false: opt-out legacy path — full quad buffer re-upload every frame via a single bufferData(STATIC_DRAW); all slot/dirty bookkeeping stays inert.

WebGL-only: CanvasRenderer always uses full uploads and is unaffected by this flag.

Changes

  • src/main-api/Renderer.ts — new enableDirtyRepaints field on RendererMainSettings with JSDoc; resolved with ?? true and forwarded to Stage.
  • src/core/Stage.tsrequestRenderListUpdate() only calls invalidateQuadBuffer() when enabled.
  • src/core/CoreNode.ts — both isQuadDirty writes (visual-flag block in update(), texture setter) gated on the flag.
  • src/core/renderers/webgl/WebGlRenderer.ts — cached readonly useDirtyRepaints flag (set once in the constructor); gates in addQuad, render, renderRTTNodes, invalidateQuadBuffer. Upload split into uploadFullBuffer (disabled path, no bookkeeping), uploadFullDirty (enabled full upload + bookkeeping reset) and uploadSurgicalQuads.

Tests

  • Dirty-quad suites run enabled by default, matching the new default.
  • Coverage for the disabled opt-out path: full upload with STATIC_DRAW, no bufferSubData, invalidateQuadBuffer no-op, RTT writes into the shared buffer; CoreNode stays clean and Stage skips invalidation when disabled.
  • Verification: pnpm vitest run — 17 files / 292 tests pass; eslint 0 errors; prettier clean (tsc --build shows only the pre-existing happy-dom type error, also present on clean HEAD).

Refs: #861

@wouterlucas
wouterlucas requested a review from jfboeve September 5, 2026 19:18
@wouterlucas
wouterlucas marked this pull request as ready for review September 5, 2026 19:19
@wouterlucas wouterlucas changed the title feat: add enableDirtyRepaints toggle for PR861 behaviour, default off feat: add enableDirtyRepaints toggle for PR861 behaviour, default on Sep 6, 2026
@wouterlucas
wouterlucas merged commit de11ac5 into main Sep 7, 2026
2 checks passed
@wouterlucas
wouterlucas deleted the feat/enable-dirty-repaints-toggle branch September 7, 2026 08:55
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.

2 participants