Fix shared atlas page invalidation per renderer

This commit is contained in:
Anthony Kim
2026-07-04 14:44:23 -07:00
parent 780cbef3cf
commit 6fe6fe1af3
3 changed files with 18 additions and 14 deletions
+6 -10
View File
@@ -132,12 +132,8 @@ export class TextureAtlas implements ITextureAtlas {
}
}
private _requestClearModel = false;
public beginFrame(): boolean {
const result = this._requestClearModel;
this._requestClearModel = false;
return result;
}
private _pagesVersion = 0;
public get pagesVersion(): number { return this._pagesVersion; }
public clearTexture(): void {
if (this._pages[0].currentRow.x === 0 && this._pages[0].currentRow.y === 0) {
@@ -206,8 +202,8 @@ export class TextureAtlas implements ITextureAtlas {
// Add the new merged page to the end
this.pages.push(mergedPage);
// Request the model to be cleared to refresh all texture pages.
this._requestClearModel = true;
// Invalidate renderer models so all texture pages are refreshed.
this._pagesVersion++;
this._onAddTextureAtlasCanvas.fire(mergedPage.canvas);
}
@@ -818,8 +814,8 @@ export class TextureAtlas implements ITextureAtlas {
this._overflowSizePage = new AtlasPage(this._document, this._config.deviceMaxTextureSize);
this.pages.push(this._overflowSizePage);
// Request the model to be cleared to refresh all texture pages.
this._requestClearModel = true;
// Invalidate renderer models so all texture pages are refreshed.
this._pagesVersion++;
this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas);
}
activePage = this._overflowSizePage;