这是indexloc提供的服务,不要输入任何密码
Skip to content

Make the last 2 arguments to copyBufferToBuffer optional #4807

@greggman

Description

@greggman

copyBufferToBuffer currently has this signature:

encoder.copyBufferToBuffer(source, sourceOffset, destination, destinationOffset, size)

Where all 5 parameters are required. So far, 9 times out of 10 I'm copying one entire buffer to another entire buffer, so I'm wondering, could we make destinationOffset default to 0 and size default to min(sourceBuffer.size - sourceOffset, destinationBuffer.size - destinationOffset)?

Then I could just do

encoder.copyBufferToBuffer(someStorageBuffer, 0, someMappableBuffer)

vs what I have to do now

encoder.copyBufferToBuffer(someStorageBuffer, 0, someMappableBuffer, 0, someMappableBuffer.size)

It's really only a minor inconvenience so not a big deal but I thought I'd ask anyway. writeBuffer has defaults for offset and size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU APIapi resolvedResolved - waiting for a change to the API specification

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions