Sitelet https://github.com/gpuweb/gpuweb/issues/4807
Skip to content

Make the last 2 arguments to copyBufferToBuffer optional #4807

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions