Skip to content

Commit e43959d

Browse files
authored
WebGPURenderer: Set labels of some WebGPU objects (#25773)
This commit sets labels of some WebGPU objects for helping debug.
1 parent 018f9a2 commit e43959d

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

examples/jsm/renderers/webgpu/WebGPUAttributes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class WebGPUAttributes {
8181
if ( gpuReadBuffer === null ) {
8282

8383
gpuReadBuffer = device.createBuffer( {
84+
label: attribute.name,
8485
size,
8586
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
8687
} );
@@ -120,6 +121,7 @@ class WebGPUAttributes {
120121
const size = array.byteLength + ( ( 4 - ( array.byteLength % 4 ) ) % 4 ); // ensure 4 byte alignment, see #20441
121122

122123
const buffer = this.device.createBuffer( {
124+
label: attribute.name,
123125
size,
124126
usage: usage | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST,
125127
mappedAtCreation: true

examples/jsm/renderers/webgpu/WebGPUBindings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ class WebGPUBindings {
192192
const byteLength = binding.getByteLength();
193193

194194
binding.bufferGPU = this.device.createBuffer( {
195+
label: 'bindingBuffer',
195196
size: byteLength,
196197
usage: binding.usage
197198
} );

examples/jsm/renderers/webgpu/WebGPURenderer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ class WebGPURenderer {
988988
if ( this._colorBuffer ) this._colorBuffer.destroy();
989989

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

10131014
this._depthBuffer = this._device.createTexture( {
1015+
label: 'depthBuffer',
10141016
size: {
10151017
width: Math.floor( this._width * this._pixelRatio ),
10161018
height: Math.floor( this._height * this._pixelRatio ),

0 commit comments

Comments
 (0)