Skip to content

Commit

Permalink
WebGPUTextures: Monitor number of textures when using render targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Sep 29, 2020
1 parent b1390eb commit d85592a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/jsm/renderers/webgpu/WebGPUTextures.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ class WebGPUTextures {
usage: GPUTextureUsage.OUTPUT_ATTACHMENT | GPUTextureUsage.SAMPLED
} );

this.info.memory.textures ++;

renderTargetProperties.colorTextureGPU = colorTextureGPU;
renderTargetProperties.colorTextureFormat = colorTextureFormat;

Expand All @@ -235,6 +237,8 @@ class WebGPUTextures {
usage: GPUTextureUsage.OUTPUT_ATTACHMENT
} );

this.info.memory.textures ++;

renderTargetProperties.depthTextureGPU = depthTextureGPU;
renderTargetProperties.depthTextureFormat = depthTextureFormat;

Expand Down Expand Up @@ -727,10 +731,14 @@ function onRenderTargetDispose( event ) {
renderTargetProperties.colorTextureGPU.destroy();
properties.remove( renderTarget.texture );

this.info.memory.textures --;

if ( renderTarget.depthBuffer === true ) {

renderTargetProperties.depthTextureGPU.destroy();

this.info.memory.textures --;

if ( renderTarget.depthTexture !== null ) {

properties.remove( renderTarget.depthTexture );
Expand Down

0 comments on commit d85592a

Please sign in to comment.