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
8 changes: 8 additions & 0 deletions src/renderers/common/Backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,14 @@ class Backend {

}

/**
* Delete GPU data associated with a bind group.
*
* @abstract
* @param {BindGroup} bindGroup - The bind group.
*/
deleteBindGroupData( /*bindGroup*/ ) { }

/**
* Frees internal resources.
*
Expand Down
2 changes: 2 additions & 0 deletions src/renderers/common/Bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class Bindings extends DataMap {

for ( const bindGroup of bindings ) {

this.backend.deleteBindGroupData( bindGroup );
this.delete( bindGroup );

}
Expand All @@ -181,6 +182,7 @@ class Bindings extends DataMap {

for ( const bindGroup of bindings ) {

this.backend.deleteBindGroupData( bindGroup );
this.delete( bindGroup );

}
Expand Down
16 changes: 15 additions & 1 deletion src/renderers/webgpu/WebGPUBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,9 @@ class WebGPUBackend extends Backend {

data[ 0 ] = i;

const bindGroupIndex = this.bindingUtils.createBindGroupIndex( data, bindingsData.layout );
const { layoutGPU } = bindingsData.layout;

const bindGroupIndex = this.bindingUtils.createBindGroupIndex( data, layoutGPU );

indexesGPU.push( bindGroupIndex );

Expand Down Expand Up @@ -2159,6 +2161,17 @@ class WebGPUBackend extends Backend {

}

/**
* Delete data associated with the current bind group.
*
* @param {BindGroup} bindGroup - The bind group.
*/
deleteBindGroupData( bindGroup ) {

this.bindingUtils.deleteBindGroupData( bindGroup );

}

// attributes

/**
Expand Down Expand Up @@ -2488,6 +2501,7 @@ class WebGPUBackend extends Backend {

dispose() {

this.bindingUtils.dispose();
this.textureUtils.dispose();

if ( this.occludedResolveCache ) {
Expand Down
Loading