Skip to content

fix: Change max_*_buffer_binding_size type to match WebGPU spec#9146

Merged
ErichDonGubler merged 3 commits intogfx-rs:trunkfrom
wingertge:fix/max-buffer-binding-size
Mar 9, 2026
Merged

fix: Change max_*_buffer_binding_size type to match WebGPU spec#9146
ErichDonGubler merged 3 commits intogfx-rs:trunkfrom
wingertge:fix/max-buffer-binding-size

Conversation

@wingertge
Copy link
Contributor

@wingertge wingertge commented Mar 3, 2026

Connections
Related to #8105

Description
Changes types of max_uniform_buffer_binding_size and max_storage_buffer_binding_size to u64, following the WebGPU spec.
Updates all uses accordingly.

Testing
Type change, so new tests not applicable.

MetadataEntry assertion had to be changed due to the different types. I don't understand all the implementation details of this, so please review carefully.

Squash or Rebase?

Squash

Checklist

  • Run cargo fmt.
  • Run taplo format. - Triggers massive change log, skipped
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target x86_64-apple-darwin
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@ErichDonGubler ErichDonGubler self-assigned this Mar 4, 2026
@ErichDonGubler ErichDonGubler force-pushed the fix/max-buffer-binding-size branch from 5ddff14 to 2fa305b Compare March 6, 2026 00:08
Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

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

LGTM, minus some nits I resolved on my own. I squashed down your changes, and added some of my own. The fixup! commits are intended to be squashed again. What do you think? If they look good to you, I'll squash 'em, and rebase-and-merge the rest.

@ErichDonGubler ErichDonGubler added type: enhancement New feature or request area: correctness We're behaving incorrectly labels Mar 6, 2026
@ErichDonGubler ErichDonGubler force-pushed the fix/max-buffer-binding-size branch from 2fa305b to b69a79f Compare March 6, 2026 00:14
@ErichDonGubler
Copy link
Member

Rebased onto latest trunk to resolve a conflict in CHANGELOG.md.

@wingertge
Copy link
Contributor Author

@ErichDonGubler looks good

@ErichDonGubler ErichDonGubler force-pushed the fix/max-buffer-binding-size branch from b69a79f to cf76de9 Compare March 7, 2026 15:55
@ErichDonGubler ErichDonGubler enabled auto-merge (rebase) March 9, 2026 22:47
@ErichDonGubler ErichDonGubler merged commit a18abdd into gfx-rs:trunk Mar 9, 2026
60 of 61 checks passed
@wingertge wingertge deleted the fix/max-buffer-binding-size branch March 9, 2026 22:53
github-merge-queue bot pushed a commit to bevyengine/bevy that referenced this pull request Mar 24, 2026
wgpu update for v29.

I have tested on macos m1, m5, and windows. Linux testing is
appreciated.

- [x] before merge, naga_oil and dlss_wgpu need to be published, and the
patches referencing their respective PRs removed from the workspace
Cargo.toml

##### other PRs

- naga_oil: bevyengine/naga_oil#134
- dlss_wgpu: bevyengine/dlss_wgpu#27

##### Source of relevant changes

- `Dx12Compiler::DynamicDxc` no longer has `max_shader_model`
    - gfx-rs/wgpu#8607
- `Dx12BackendOptions::force_shader_model` comes from:
    - gfx-rs/wgpu#8984
- Allow optional `RawDisplayHandle` in `InstanceDescriptor`
    - gfx-rs/wgpu#8012
- Add `GlDebugFns` option to disable OpenGL debug functions
    - gfx-rs/wgpu#8931
- Add a DX12 backend option to force a certain shader model
    - gfx-rs/wgpu#8984
- Migrate validation from maxInterStageShaderComponents to
maxInterStageShaderVariables
    - gfx-rs/wgpu#8652
- gaps are now supported in bind group layouts
    - gfx-rs/wgpu#9034
- depth validation changed to option to match spec
    - gfx-rs/wgpu#8840
- SHADER_PRIMITIVE_INDEX is now PRIMITIVE_INDEX
  - gfx-rs/wgpu#9101
- Support for binding arrays of RT acceleration structures
  - gfx-rs/wgpu#8923
- Make HasDisplayHandle optional in WindowHandle
  - gfx-rs/wgpu#8782
- `QueueWriteBufferView` can no longer be dereferenced to `&mut [u8]`,
so use `WriteOnly`.
  - gfx-rs/wgpu#9042
- ~bevy_mesh currently has an added dependency on `wgpu`, can we move
`WriteOnly` to wgpu-types?~ (it is in wgpu-types now)
- Change max_*_buffer_binding_size type to match WebGPU spec (u32 ->
u64)
  - gfx-rs/wgpu#9146
- raw vulkan init `open_with_callback` takes Limits as argument now
  - gfx-rs/wgpu#8756

## Known Issues

There is currently one known issue with occlusion culling on macos,
which we've decided to disable on macos by checking the limits we
actually require. This makes it so that if wgpu releases a patch fix,
bevy 0.19 users will benefit from occlusion culling re-enabling for
them.

<details><summary>More details</summary>

On macos, the wpgu limits were changed to align with the spec and now
put the early and late GPU occlusion culling `StorageBuffer` limit at 8,
but we currently use 9. [Filed in wgpu
repo](gfx-rs/wgpu#9287)

```
2026-03-19T01:37:10.771117Z ERROR bevy_render::error_handler: Caught rendering error: Validation Error

Caused by:
  In Device::create_bind_group_layout, label = 'build mesh uniforms GPU late occlusion culling bind group layout'
    Too many bindings of type StorageBuffers in Stage ShaderStages(COMPUTE), limit is 8, count was 9. Check the limit `max_storage_buffers_per_shader_stage` passed to `Adapter::request_device`
```

</details>

solari working on wgpu 29:

<img width="1282" height="752" alt="image"
src="https://github.com/user-attachments/assets/4744faec-65c0-4a72-93e1-34a721fc26d8"
/>

---------

Co-authored-by: atlv <email@atlasdostal.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: correctness We're behaving incorrectly type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants