2
0
Эх сурвалжийг харах

WebGPURenderer: Set labels of some WebGPU objects (#25773)

This commit sets labels of some WebGPU objects for
helping debug.
Takahiro 2 жил өмнө
parent
commit
e43959d88a

+ 2 - 0
examples/jsm/renderers/webgpu/WebGPUAttributes.js

@@ -81,6 +81,7 @@ class WebGPUAttributes {
 		if ( gpuReadBuffer === null ) {
 
 			gpuReadBuffer = device.createBuffer( {
+				label: attribute.name,
 				size,
 				usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
 			} );
@@ -120,6 +121,7 @@ class WebGPUAttributes {
 		const size = array.byteLength + ( ( 4 - ( array.byteLength % 4 ) ) % 4 ); // ensure 4 byte alignment, see #20441
 
 		const buffer = this.device.createBuffer( {
+			label: attribute.name,
 			size,
 			usage: usage | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST,
 			mappedAtCreation: true

+ 1 - 0
examples/jsm/renderers/webgpu/WebGPUBindings.js

@@ -192,6 +192,7 @@ class WebGPUBindings {
 					const byteLength = binding.getByteLength();
 
 					binding.bufferGPU = this.device.createBuffer( {
+						label: 'bindingBuffer',
 						size: byteLength,
 						usage: binding.usage
 					} );

+ 2 - 0
examples/jsm/renderers/webgpu/WebGPURenderer.js

@@ -988,6 +988,7 @@ class WebGPURenderer {
 			if ( this._colorBuffer ) this._colorBuffer.destroy();
 
 			this._colorBuffer = this._device.createTexture( {
+				label: 'colorBuffer',
 				size: {
 					width: Math.floor( this._width * this._pixelRatio ),
 					height: Math.floor( this._height * this._pixelRatio ),
@@ -1011,6 +1012,7 @@ class WebGPURenderer {
 			if ( this._depthBuffer ) this._depthBuffer.destroy();
 
 			this._depthBuffer = this._device.createTexture( {
+				label: 'depthBuffer',
 				size: {
 					width: Math.floor( this._width * this._pixelRatio ),
 					height: Math.floor( this._height * this._pixelRatio ),