Selaa lähdekoodia

Improve perf to setSubData when buffer is not a multiple of 4

Popov72 4 vuotta sitten
vanhempi
commit
669c1bb636
1 muutettua tiedostoa jossa 1 lisäystä ja 3 poistoa
  1. 1 3
      src/Engines/WebGPU/webgpuBufferManager.ts

+ 1 - 3
src/Engines/WebGPU/webgpuBufferManager.ts

@@ -56,9 +56,7 @@ export class WebGPUBufferManager {
         if (alignedLength !== byteLength) {
             const tempView = new Uint8Array(src.buffer.slice(chunkStart, chunkEnd));
             src = new Uint8Array(alignedLength);
-            tempView.forEach((element, index) => {
-                (src as Uint8Array)[index] = element;
-            });
+            (src as Uint8Array).set(tempView);
             srcByteOffset = 0;
             chunkStart = 0;
             chunkEnd = alignedLength;