Fix webgl rendering corruption from atlas page merges
Two bugs in the webgl renderer cause the corruption from #5847.
1. Texture binding stale after a same-index page swap. GlyphRenderer.render only rebinds a texture unit on version mismatch, but after _createNewPage merges 4 pages into 1, the page object at the merged index swaps to a fresh mergedPage. With per-page counters the new page's version often coincided with the version we last bound at that index (the freshly-pushed mergedPage always landed on 1). The rebind was skipped and the texture kept the old page's canvas, so glyphs sampling that unit got garbage.
Make AtlasPage.version monotonic across all pages and the existing comparison detects a same-index swap, no extra bookkeeping required.
2. Stale texturePage in the vertex buffer after a mid-update merge. When a merge fires inside _updateModel, cached glyphs get a new texturePage. Cells already written in this pass (or carried over via the model-unchanged early-exit) still point at the pre-merge index. _requestClearModel was set on merge but beginFrame never reset it, so it stayed true forever; and renderRows only checked it before _updateModel, so a mid-pass merge went unhandled.
- reset
_requestClearModelwhenbeginFramereads it - after
_updateModel, re-run a full update if a merge fired during the pass (capped atMERGE_RETRY_LIMIT)
Before:
After:
Stress repro with the script from #5847 (full-screen rewrite, many colors, frequent merges):
Before this PR:
After this PR: