Skip to content
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

fix(wgpu-core)!: use u32 indices for bind group layouts everywhere #3743

Merged

Conversation

ErichDonGubler
Copy link
Member

@ErichDonGubler ErichDonGubler commented May 2, 2023

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Link to the issues addressed by this PR, or dependent PRs in other repositories

See Description.

Description
Describe what problem this is solving, and how it's solved.

See discussions in Mozilla's Bugzilla and wgpu's Matrix chat.

Testing
Explain how this change is tested.

cargo nextest run -- --workspace WFM!

@ErichDonGubler
Copy link
Member Author

ErichDonGubler commented May 2, 2023

CI indicates that wgpu-tests::shader::zero_init_workgroup_mem::zero_init_workgroup_mem is currently failing, but I'm not sure if this PR is the cause yet. 💦

@teoxoy
Copy link
Member

teoxoy commented May 3, 2023

I reran CI, that test keeps failing spuriously.

@ErichDonGubler ErichDonGubler force-pushed the u32-bind-group-idx branch 2 times, most recently from 2778335 to ee9381f Compare May 3, 2023 13:10
@ErichDonGubler ErichDonGubler marked this pull request as ready for review May 3, 2023 13:10
The short description of this bug/fix pair is that, for some reason, we
accept `u32` bind indices in the `wgpu` and `wgpu-core` APIs, narrow to
`u8`, and then use `usize` for bind group indices in `wgpu-core`'s
internals. This artificially narrows the range of bind group indices,
and seems incorrect. Fix this by using `u32`s all the way until we
convert to `usize`s. AFAIK, no supported platforms for `wgpu` have a
`usize` whose size is less than `u32`'s.

For further details, see [Mozilla's Bugzilla] and [`wgpu`'s Matrix chat].

[Mozilla's Bugzilla]: https://bugzilla.mozilla.org/show_bug.cgi?id=1813705#c8
[`wgpu`'s Matrix chat]: https://matrix.to/#/!FZyQrssSlHEZqrYcOb:matrix.org/$0wv-PJgyTTZ7LHtEhzFmAouNYa4VMY0MzVzW0n5J394?via=matrix.org&via=mozilla.org&via=kde.org
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

makes sense!

@ErichDonGubler
Copy link
Member Author

I don't have rights to merge this. 😖 Can somebody do it for me, please?

@cwfitzgerald
Copy link
Member

Yeet

@cwfitzgerald cwfitzgerald merged commit 0f0044f into gfx-rs:trunk May 4, 2023
@ErichDonGubler ErichDonGubler deleted the u32-bind-group-idx branch May 9, 2023 14:54
Wumpf pushed a commit to rerun-io/wgpu that referenced this pull request May 14, 2023
@Wumpf Wumpf mentioned this pull request May 14, 2023
3 tasks
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.

4 participants