Ver código fonte

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

Popov72 4 anos atrás
pai
commit
669c1bb636
1 arquivos alterados com 1 adições e 3 exclusões
  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;