perf: release GPU resources correctly and reuse render targets
Dispose scene resources before renderer allocation records are cleared and release the bloom high-pass material. Avoid unused bloom depth buffers and the final screen pass swap, keeping the same visual output and quality. Batch sign-stage layout reads before applying existing masks. Validated approved assets, types, client and SSR builds, prerendered content, artifacts and transfer budgets. Checked 32 matching transition renders, 66 browser interactions and repeated quality-change resource cleanup.
This commit is contained in:
@@ -146,7 +146,15 @@ export class SceneResourceBag {
|
||||
this.listeners.clear();
|
||||
for (const observer of this.observers) observer.disconnect();
|
||||
this.observers.clear();
|
||||
for (const resource of this.resources.keys()) resource.dispose();
|
||||
// Texture, target and material disposal needs the renderer's allocation
|
||||
// records. Disposing the renderer first clears those records before the
|
||||
// resources can release their WebGL handles during a quality change.
|
||||
for (const [resource, kind] of this.resources) {
|
||||
if (kind !== "renderer") resource.dispose();
|
||||
}
|
||||
for (const [resource, kind] of this.resources) {
|
||||
if (kind === "renderer") resource.dispose();
|
||||
}
|
||||
this.resources.clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user