Skip to content

There is an issue when passing typed arrays to the writeBuffer function of pc.StorageBuffer. #8910

Description

@AlexAPPi

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) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions