diff --git a/examples/screenshots/webgpu_mesh_batch.jpg b/examples/screenshots/webgpu_mesh_batch.jpg index a143aba78bc6ee..d4ce8c87538e3b 100644 Binary files a/examples/screenshots/webgpu_mesh_batch.jpg and b/examples/screenshots/webgpu_mesh_batch.jpg differ diff --git a/examples/screenshots/webgpu_shadowmap_array.jpg b/examples/screenshots/webgpu_shadowmap_array.jpg index db5178b2ebd74b..990d70608dfe97 100644 Binary files a/examples/screenshots/webgpu_shadowmap_array.jpg and b/examples/screenshots/webgpu_shadowmap_array.jpg differ diff --git a/src/objects/BatchedMesh.js b/src/objects/BatchedMesh.js index 9dc076b34e4480..1f540865d22a3b 100644 --- a/src/objects/BatchedMesh.js +++ b/src/objects/BatchedMesh.js @@ -272,6 +272,7 @@ class BatchedMesh extends Mesh { this._multiDrawCounts = new Int32Array( maxInstanceCount ); this._multiDrawStarts = new Int32Array( maxInstanceCount ); this._multiDrawCount = 0; + this._multiDrawBytesPerElement = 1; // Local matrix per geometry by using data texture this._matricesTexture = null; @@ -1474,6 +1475,7 @@ class BatchedMesh extends Mesh { this._geometryInitialized = source._geometryInitialized; this._multiDrawCounts = source._multiDrawCounts.slice(); this._multiDrawStarts = source._multiDrawStarts.slice(); + this._multiDrawBytesPerElement = source._multiDrawBytesPerElement; this._indirectTexture = source._indirectTexture.clone(); this._indirectTexture.image.data = this._indirectTexture.image.data.slice(); @@ -1678,6 +1680,7 @@ class BatchedMesh extends Mesh { indirectTexture.needsUpdate = true; this._multiDrawCount = multiDrawCount; + this._multiDrawBytesPerElement = bytesPerElement; this._visibilityChanged = false; } diff --git a/src/renderers/webgpu/WebGPUBackend.js b/src/renderers/webgpu/WebGPUBackend.js index 3dba9f86059e4c..b833ccb6956f00 100644 --- a/src/renderers/webgpu/WebGPUBackend.js +++ b/src/renderers/webgpu/WebGPUBackend.js @@ -2114,14 +2114,7 @@ class WebGPUBackend extends Backend { const starts = object._multiDrawStarts; const counts = object._multiDrawCounts; const drawCount = object._multiDrawCount; - - let bytesPerElement = ( hasIndex === true ) ? index.array.BYTES_PER_ELEMENT : 1; - - if ( material.wireframe ) { - - bytesPerElement = object.geometry.attributes.position.count > 65535 ? 4 : 2; - - } + const bytesPerElement = object._multiDrawBytesPerElement; for ( let i = 0; i < drawCount; i ++ ) {