Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/core/Stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,8 @@ export class Stage {
* @remarks
* This method is used to cleanup orphaned textures that are no longer in use.
*/
cleanup() {
this.txMemManager.cleanup();
cleanup(full: boolean = false) {
this.txMemManager.cleanup(full);
}

set clearColor(value: number) {
Expand Down
6 changes: 3 additions & 3 deletions src/core/TextureMemoryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class TextureMemoryManager {
texture.memUsed = 0;
}

cleanup() {
cleanup(full: boolean = false) {
const critical = this.criticalCleanupRequested;
this.lastCleanupTime = this.frameTime;

Expand All @@ -266,7 +266,7 @@ export class TextureMemoryManager {

if (this.debugLogging === true) {
console.log(
`[TextureMemoryManager] Cleaning up textures. Critical: ${critical}.`,
`[TextureMemoryManager] Cleaning up textures. Critical: ${critical}. Full: ${full}`,
);
}

Expand All @@ -279,7 +279,7 @@ export class TextureMemoryManager {

for (let i = 0; i < this.loadedTextures.length; i++) {
// Early exit: target memory reached
if (currentMemUsed < memTarget) {
if (full === false && currentMemUsed < memTarget) {
break;
}

Expand Down