Explorar o código

WebGPUTextures: Monitor number of textures when using render targets.

Mugen87 %!s(int64=4) %!d(string=hai) anos
pai
achega
d85592acaa
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      examples/jsm/renderers/webgpu/WebGPUTextures.js

+ 8 - 0
examples/jsm/renderers/webgpu/WebGPUTextures.js

@@ -209,6 +209,8 @@ class WebGPUTextures {
 				usage: GPUTextureUsage.OUTPUT_ATTACHMENT | GPUTextureUsage.SAMPLED
 			} );
 
+			this.info.memory.textures ++;
+
 			renderTargetProperties.colorTextureGPU = colorTextureGPU;
 			renderTargetProperties.colorTextureFormat = colorTextureFormat;
 
@@ -235,6 +237,8 @@ class WebGPUTextures {
 					usage: GPUTextureUsage.OUTPUT_ATTACHMENT
 				} );
 
+				this.info.memory.textures ++;
+
 				renderTargetProperties.depthTextureGPU = depthTextureGPU;
 				renderTargetProperties.depthTextureFormat = depthTextureFormat;
 
@@ -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 );