|
@@ -17,7 +17,9 @@ const typedAttributeToVertexFormatPrefix = new Map( [
|
|
|
|
|
|
const typeArraysToVertexFormatPrefixForItemSize1 = new Map( [
|
|
|
[ Int32Array, 'sint32' ],
|
|
|
+ [ Int16Array, 'sint32' ], // patch for INT16
|
|
|
[ Uint32Array, 'uint32' ],
|
|
|
+ [ Uint16Array, 'uint32' ], // patch for UINT16
|
|
|
[ Float32Array, 'float32' ]
|
|
|
] );
|
|
|
|
|
@@ -44,6 +46,22 @@ class WebGPUAttributeUtils {
|
|
|
|
|
|
let array = bufferAttribute.array;
|
|
|
|
|
|
+ // patch for INT16 and UINT16
|
|
|
+ if ( array.constructor === Int16Array || array.constructor === Uint16Array ) {
|
|
|
+
|
|
|
+ const tempArray = new Uint32Array( array.length );
|
|
|
+ for ( let i = 0; i < array.length; i ++ ) {
|
|
|
+
|
|
|
+ tempArray[ i ] = array[ i ];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ array = tempArray;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ bufferAttribute.array = array;
|
|
|
+
|
|
|
if ( ( bufferAttribute.isStorageBufferAttribute || bufferAttribute.isStorageInstancedBufferAttribute ) && bufferAttribute.itemSize === 3 ) {
|
|
|
|
|
|
bufferAttribute.itemSize = 4;
|
|
@@ -149,6 +167,13 @@ class WebGPUAttributeUtils {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // patch for INT16 and UINT16
|
|
|
+ if ( geometryAttribute.array.constructor === Int16Array || geometryAttribute.array.constructor === Uint16Array ) {
|
|
|
+
|
|
|
+ arrayStride = 4;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
vertexBufferLayout = {
|
|
|
arrayStride,
|
|
|
attributes: [],
|