Skip to content

Commit 4b5c4f0

Browse files
authored
WebGPU: wgpuQueueWriteBuffer workaround passing subarray of HEAPU8 (#17312)
1 parent 1c11590 commit 4b5c4f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/library_webgpu.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,10 @@ var LibraryWebGPU = {
15201520
var queue = WebGPU.mgrQueue.get(queueId);
15211521
var buffer = WebGPU.mgrBuffer.get(bufferId);
15221522
var bufferOffset = {{{ gpu.makeU64ToNumber('bufferOffset_low', 'bufferOffset_high') }}};
1523-
queue["writeBuffer"](buffer, bufferOffset, HEAPU8, data, size);
1523+
// There is a size limitation for ArrayBufferView. Work around by passing in a subarray
1524+
// instead of the whole heap. crbug.com/1201109
1525+
var subarray = HEAPU8.subarray(data, data + size);
1526+
queue["writeBuffer"](buffer, bufferOffset, subarray, 0, size);
15241527
},
15251528

15261529
wgpuQueueWriteTexture: function(queueId,

0 commit comments

Comments
 (0)