Closed alienself closed 2 years ago
The reason that dataOffset
is missing is that it is redundant in Wasm, as it can be solved by pointer arithmetic in C side. For example, if you have an array arr
in C side, and wanted to upload byte range [100, 200[
of that array (i.e. dataOffset==100
), then you can call
uint8_t arr[200] = { ... };
wgpu_queue_write_buffer(queue, buffer, bufferOffset, arr + 100, 100);
Oh I see! Totally makes sense thanks for this example.
Hi,
Looks like the write buffer call is missing an argument. The JS API has an extra argument for data offset:
writeBuffer(buffer: GPUBuffer, bufferOffset: GPUSize64, data: BufferSource, dataOffset: GPUSize64, size: GPUSize64): void
this call is missing from
wgpu_queue_write_buffer
:void wgpu_queue_write_buffer(WGpuQueue queue, WGpuBuffer buffer, double_int53_t bufferOffset, const void *data __attribute__((nonnull)), double_int53_t size);