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
14 changes: 13 additions & 1 deletion src/renderers/common/Backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,19 @@ class Backend {
*
* @abstract
*/
dispose() { }
async dispose() {

for ( const queryPool of Object.values( this.timestampQueryPool ) ) {

if ( queryPool !== null ) {

await queryPool.dispose();

}

}

}

}

Expand Down
10 changes: 2 additions & 8 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2696,7 +2696,7 @@ class Renderer {
* Frees all internal resources of the renderer. Call this method if the renderer
* is no longer in use by your app.
*/
dispose() {
async dispose() {

if ( this._initialized === true ) {

Expand All @@ -2718,13 +2718,7 @@ class Renderer {

}

Object.values( this.backend.timestampQueryPool ).forEach( queryPool => {

if ( queryPool !== null ) queryPool.dispose();

} );

this.backend.dispose();
await this.backend.dispose();

}

Expand Down
4 changes: 3 additions & 1 deletion src/renderers/webgl-fallback/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,9 @@ class WebGLBackend extends Backend {
/**
* Frees internal resources.
*/
dispose() {
async dispose() {

await super.dispose();

if ( this.textureUtils !== null ) this.textureUtils.dispose();

Expand Down
14 changes: 3 additions & 11 deletions src/renderers/webgpu/WebGPUBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -3245,7 +3245,9 @@ class WebGPUBackend extends Backend {

}

dispose() {
async dispose() {

await super.dispose();

this.bindingUtils.dispose();
this.textureUtils.dispose();
Expand All @@ -3262,16 +3264,6 @@ class WebGPUBackend extends Backend {

}

if ( this.timestampQueryPool ) {

for ( const queryPool of Object.values( this.timestampQueryPool ) ) {

if ( queryPool !== null ) queryPool.dispose();

}

}

if ( this.parameters.device === undefined && this.device !== null ) {

this.device.destroy();
Expand Down