Browse Source

WebGPUAttributeUtils: Use correct buffer offset for `updateRanges`. (#30617)

* WebGPU: use correct destination offset for updateRanges

* Take into account BYTES_PER_ELEMENT for updateRanges

* Update WebGPUAttributeUtils.js

---------

Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
ZonkyPop 1 year ago
parent
commit
eaf72e68af
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/renderers/webgpu/utils/WebGPUAttributeUtils.js

+ 3 - 1
src/renderers/webgpu/utils/WebGPUAttributeUtils.js

@@ -202,9 +202,11 @@ class WebGPUAttributeUtils {
 
 				}
 
+				const bufferOffset = dataOffset * ( isTypedArray ? array.BYTES_PER_ELEMENT : 1 ); // bufferOffset is always in bytes
+
 				device.queue.writeBuffer(
 					buffer,
-					0,
+					bufferOffset,
 					array,
 					dataOffset,
 					size

粤ICP备19079148号