Skip to content

Make wgpu-core's copy_buffer_to_buffer size parameter optional #7659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

andyleiserson
Copy link
Contributor

@andyleiserson andyleiserson commented May 2, 2025

This makes the size parameter to wgpu-core's copy_buffer_to_buffer implementation optional. When the size is omitted, the copy spans from the source offset to the end of the source buffer.

The goal here is to make the size parameter to copyBufferToBuffer optional in Firefox. https://bugzilla.mozilla.org/show_bug.cgi?id=1959728. We might be able to achieve this without changing the signature of wgpu copy_buffer_to_buffer functions at all, but note that trace::Command::CopyBufferToBuffer is used to serialize the command between the content process and GPU process, so keeping size non-optional in that enum variant would significantly complicate things in Firefox.

I didn't change the signature of copy_buffer_to_buffer on wgpu (non-core). That seemed like a fairly disruptive breaking change.

Testing
No tests, right now, other than not breaking existing tests. This is covered by the WebGPU CTS although that's not currently running in the wgpu repo.

Squash or Rebase? Squash

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@andyleiserson andyleiserson requested review from crowlKats and a team as code owners May 2, 2025 17:53
@@ -188,7 +188,7 @@ impl GPUCommandEncoder {
source_offset,
destination.id,
destination_offset,
size,
Some(size),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldnt be like this, but rather the paramater of the function calling this should have its type be made Option<u64>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants