Re-upload atlas textures after page merges
This commit is contained in:
@@ -29,13 +29,7 @@ import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from
|
||||
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
|
||||
|
||||
const enum Constants {
|
||||
/**
|
||||
* Upper bound on how many times `renderRows` re-runs `_updateModel` after detecting a
|
||||
* mid-update atlas page merge. A single retry should always suffice once every glyph
|
||||
* needed by the frame is cached; the cap exists purely as a safety net against an
|
||||
* unexpected runaway, not as a tuned value.
|
||||
*/
|
||||
MERGE_RETRY_LIMIT = 3
|
||||
MERGE_RETRY_LIMIT = 32
|
||||
}
|
||||
|
||||
export class WebglRenderer extends Disposable implements IRenderer {
|
||||
@@ -385,13 +379,18 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
||||
this._updateModel(start, end);
|
||||
}
|
||||
|
||||
// A mid-update atlas page merge shifts cached glyphs to new texture pages, leaving
|
||||
// stale texturePage values in the vertex buffer. Re-run a full update if that happened.
|
||||
// A mid-update atlas page merge invalidates vertex data and may not bump the host
|
||||
// page's version, so re-run the update and force a full texture rebind.
|
||||
let merged = false;
|
||||
let mergeRetries = 0;
|
||||
while (this._charAtlas && this._glyphRenderer.value.beginFrame() && mergeRetries++ < Constants.MERGE_RETRY_LIMIT) {
|
||||
merged = true;
|
||||
this._clearModel(true);
|
||||
this._updateModel(0, this._terminal.rows - 1);
|
||||
}
|
||||
if (merged) {
|
||||
this._glyphRenderer.value.invalidateAtlasTextures();
|
||||
}
|
||||
|
||||
// Render
|
||||
this._rectangleRenderer.value.renderBackgrounds();
|
||||
|
||||
Reference in New Issue
Block a user