Skip to content

Commit

Permalink
implemenet destroyAttribute()
Browse files Browse the repository at this point in the history
  • Loading branch information
aardgoose committed Dec 15, 2023
1 parent 2b8971b commit a365ac8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/jsm/renderers/webgl/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,9 @@ class WebGLBackend extends Backend {

}

destroyAttribute( /*attribute*/ ) {
destroyAttribute( attribute ) {

console.warn( 'Abstract class.' );
this.attributeUtils.destroyAttribute( attribute );

}

Expand Down
19 changes: 19 additions & 0 deletions examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,25 @@ class WebGLAttributeUtils {

}

destroyAttribute( attribute ) {

const backend = this.backend;
const { gl } = backend;

if ( attribute.isInterleavedBufferAttribute ) {

backend.delete( attribute.data );

}

const attributeData = backend.get( attribute );

gl.deleteBuffer( attributeData.bufferGPU );

backend.delete( attribute );

}

async getArrayBufferAsync( attribute ) {

const backend = this.backend;
Expand Down

0 comments on commit a365ac8

Please sign in to comment.