Procházet zdrojové kódy

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

Popov72 před 4 roky
rodič
revize
669c1bb636
1 změnil soubory, kde provedl 1 přidání a 3 odebrání
  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) {
         if (alignedLength !== byteLength) {
             const tempView = new Uint8Array(src.buffer.slice(chunkStart, chunkEnd));
             const tempView = new Uint8Array(src.buffer.slice(chunkStart, chunkEnd));
             src = new Uint8Array(alignedLength);
             src = new Uint8Array(alignedLength);
-            tempView.forEach((element, index) => {
-                (src as Uint8Array)[index] = element;
-            });
+            (src as Uint8Array).set(tempView);
             srcByteOffset = 0;
             srcByteOffset = 0;
             chunkStart = 0;
             chunkStart = 0;
             chunkEnd = alignedLength;
             chunkEnd = alignedLength;