feat: add enableDirtyRepaints toggle for PR861 behaviour, default on - #873
Merged
Conversation
wouterlucas
marked this pull request as ready for review
September 5, 2026 19:19
jfboeve
approved these changes
Sep 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a construction-time
enableDirtyRepaintssetting (defaulttrue) 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, surgicalbufferSubDatauploads, dedicated RTT buffer +renderRTT()split.false: opt-out legacy path — full quad buffer re-upload every frame via a singlebufferData(STATIC_DRAW); all slot/dirty bookkeeping stays inert.WebGL-only:
CanvasRendereralways uses full uploads and is unaffected by this flag.Changes
src/main-api/Renderer.ts— newenableDirtyRepaintsfield onRendererMainSettingswith JSDoc; resolved with?? trueand forwarded toStage.src/core/Stage.ts—requestRenderListUpdate()only callsinvalidateQuadBuffer()when enabled.src/core/CoreNode.ts— bothisQuadDirtywrites (visual-flag block inupdate(), texture setter) gated on the flag.src/core/renderers/webgl/WebGlRenderer.ts— cached readonlyuseDirtyRepaintsflag (set once in the constructor); gates inaddQuad,render,renderRTTNodes,invalidateQuadBuffer. Upload split intouploadFullBuffer(disabled path, no bookkeeping),uploadFullDirty(enabled full upload + bookkeeping reset) anduploadSurgicalQuads.Tests
STATIC_DRAW, nobufferSubData,invalidateQuadBufferno-op, RTT writes into the shared buffer;CoreNodestays clean andStageskips invalidation when disabled.pnpm vitest run— 17 files / 292 tests pass; eslint 0 errors; prettier clean (tsc --buildshows only the pre-existing happy-dom type error, also present on clean HEAD).Refs: #861