There is an issue when passing typed arrays to the writeBuffer function of pc.StorageBuffer. Currently, the documentation defines the parameter as:
@param {ArrayBufferView} data - The data to write to the storage buffer
In practice, this is misleading and may cause confusion or errors, since the API actually supports a broader range of input types.
It is proposed to update the documentation to use GPUAllowSharedBufferSource as the parameter type. This aligns with the WebGPU specification and allows passing not only ArrayBufferView, but also other compatible buffer sources.
This change would:
- Resolve the mismatch between documentation and actual API behavior
- Reduce developer confusion and potential bugs
- Improve clarity and accuracy of the documentation
|
writeStorageBuffer(storageBuffer, bufferOffset = 0, data, dataOffset = 0, size) { |
|
read(device, offset, size, data, immediate) { |
|
write(bufferOffset = 0, data, dataOffset = 0, size) { |
There is an issue when passing typed arrays to the
writeBufferfunction ofpc.StorageBuffer. Currently, the documentation defines the parameter as:@param {ArrayBufferView} data - The data to write to the storage bufferIn practice, this is misleading and may cause confusion or errors, since the API actually supports a broader range of input types.
It is proposed to update the documentation to use
GPUAllowSharedBufferSourceas the parameter type. This aligns with the WebGPU specification and allows passing not onlyArrayBufferView, but also other compatible buffer sources.This change would:
engine/src/platform/graphics/webgpu/webgpu-graphics-device.js
Line 1467 in 44512e5
engine/src/platform/graphics/webgpu/webgpu-buffer.js
Line 103 in 44512e5
engine/src/platform/graphics/storage-buffer.js
Line 120 in 44512e5