Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/tree/TextureManager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class TextureManager {
for (let i = 0, n = this._uploadedTextureSources.length; i < n; i++) {
this._nativeFreeTextureSource(this._uploadedTextureSources[i]);
}

this.textureSourceHashmap.clear();
this._usedMemory = 0;
}
Expand Down Expand Up @@ -95,7 +95,7 @@ export default class TextureManager {
nativeTexture.update = this.stage.frameCounter;

this._uploadedTextureSources.push(textureSource);

this.addToLookupMap(textureSource);

// add VRAM tracking if using the webgl renderer
Expand Down Expand Up @@ -140,7 +140,7 @@ export default class TextureManager {
gc() {
this.freeUnusedTextureSources();
}

freeUnusedTextureSources() {
let remainingTextureSources = [];
for (let i = 0, n = this._uploadedTextureSources.length; i < n; i++) {
Expand Down Expand Up @@ -190,11 +190,14 @@ export default class TextureManager {
if (textureSource.isLoaded()) {
if (managed) {
this._addMemoryUsage(-textureSource.w * textureSource.h);
this._updateVramUsage(textureSource, -1);
this._uploadedTextureSources.splice(index, 1);
}
this._nativeFreeTextureSource(textureSource);
}

this.textureSourceHashmap.delete(textureSource.lookupId);

// Should be reloaded.
textureSource.loadingSince = null;
}
Expand Down