diff --git a/src/renderers/webgpu/utils/WebGPUAttributeUtils.js b/src/renderers/webgpu/utils/WebGPUAttributeUtils.js index b4fb74d2d551b2..f98f4e9a3b9872 100644 --- a/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +++ b/src/renderers/webgpu/utils/WebGPUAttributeUtils.js @@ -69,16 +69,27 @@ class WebGPUAttributeUtils { let array = bufferAttribute.array; // patch for INT16 and UINT16 - if ( attribute.normalized === false && ( array.constructor === Int16Array || array.constructor === Uint16Array ) ) { + if ( attribute.normalized === false ) { - const tempArray = new Uint32Array( array.length ); - for ( let i = 0; i < array.length; i ++ ) { + if ( array.constructor === Int16Array ) { - tempArray[ i ] = array[ i ]; + array = new Int32Array( array ); - } + } else if ( array.constructor === Uint16Array ) { + + array = new Uint32Array( array ); + + if ( usage & GPUBufferUsage.INDEX ) { + + for ( let i = 0; i < array.length; i ++ ) { - array = tempArray; + if ( array[ i ] === 0xffff ) array[ i ] = 0xffffffff; // use correct primitive restart index + + } + + } + + } }