Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified examples/screenshots/webgpu_mesh_batch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/screenshots/webgpu_shadowmap_array.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/objects/BatchedMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1678,6 +1680,7 @@ class BatchedMesh extends Mesh {

indirectTexture.needsUpdate = true;
this._multiDrawCount = multiDrawCount;
this._multiDrawBytesPerElement = bytesPerElement;
this._visibilityChanged = false;

}
Expand Down
9 changes: 1 addition & 8 deletions src/renderers/webgpu/WebGPUBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ++ ) {

Expand Down