Skip to content

Conversation

chrisdavidmills
Copy link
Contributor

@chrisdavidmills chrisdavidmills commented Oct 16, 2025

Summary

In Chrome 138, the size requirements for GPUBuffers mapped at creation have changed. During a GPUDevice.createBuffer() call, if mappedAtCreation is set true and size is not a multiple of 4, a RangeError exception is thrown.

See https://developer.chrome.com/blog/new-in-webgpu-138#size_requirement_changes_for_buffers_mapped_at_creation.

This PR adds a data point for the change.

Test results and supporting details

Related issues

@github-actions github-actions bot added data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API size:m [PR only] 25-100 LoC changed labels Oct 16, 2025
Copy link
Contributor

github-actions bot commented Oct 16, 2025

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

Alternatively, could we add subfeatures for the descriptor properties, and note this as part of the support data for size?

/cc @Elchi3

Co-authored-by: Claas Augner <[email protected]>
@chrisdavidmills
Copy link
Contributor Author

Alternatively, could we add subfeatures for the descriptor properties, and note this as part of the support data for size?

I don't think that makes sense, in this case. The exception occurs on the method itself, and it is related to two different descriptor properties.

@caugner
Copy link
Contributor

caugner commented Oct 17, 2025

The exception occurs on the method itself, and it is related to two different descriptor properties.

I think it's rather common for behaviors to relate to multiple features, but you're right that it isn't associated much more to size (which the RangeError refers to) than to mappedAtCreation.

Before merging, I would like a second opinion from @Elchi3 or @ddbeck about this subfeature (throws_RangeError_if_mappedAtCreation_and_size_not_multiple_of_4).

@ddbeck
Copy link
Contributor

ddbeck commented Oct 17, 2025

Honestly, I'm not sure this merits a subfeature. Reading about this, it seems to miss a few qualifiers for a feature:

  • It's a breaking change for developers but in a mostly trivial and transparent way. Code that previously produced an error still produces an error, but synchronously with a clearer error message. The spec authors seemed to think this breakage was not an issue (Synchronously validate size % 4 == 0 on mappedAtCreation gpuweb/gpuweb#5113).
  • It seems straightforwardly detectable (i.e., you can catch the exception whether it's thrown or not, even deliberately attempting to create a buffer that throws it—or you can just size your buffer appropriately, which is probably already happening in practice).
  • This shipped 4 months ago and nobody filed an issue against BCD, WebKit, or Firefox about it. If it's a real compat concern for developers, I found no evidence for it.

This seems more fit for a note, something like "Before version 138, this method does not throw a RangeError exception when mappedAtCreation is true but size is not a multiple of 4 ."

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

Labels

data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API size:m [PR only] 25-100 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants