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

Validate against the maximum binding index #2892

Merged
merged 2 commits into from
Aug 1, 2022

Conversation

nical
Copy link
Contributor

@nical nical commented Jul 18, 2022

Checklist

  • Run cargo clippy.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections

WebGPU spec: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbindgrouplayout

Description

This PR validates that binding indices in create_bind_group_layout aren't larger than the maximum binding index from teh WebGPU specification, so it's another baby step towards WebGPU compliance.

This also sort of mitigates driver issues with very large binding indices on vulkan. The vulkan spec is made with the expectation that the driver allocates a contiguous buffer of descriptors at least as large as the maximum binding index. Binding indices are expected to be small, and some drivers don't expect that allocation to fail (which is fairly easy to trigger by repeatedly creating bind group layouts with enormous binding indices.

Note that Dawn internally renames all binding indices to compact them, including in their vulkan backend. That's a much stronger mitigation against that source of driver issues.

Testing

None

@nical nical changed the title Binding idx limit Validate against the maximum binding index Jul 18, 2022
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

LGTM, just the one question

@nical
Copy link
Contributor Author

nical commented Jul 26, 2022

Ok removed the unwanted commit. Sorry about that!

@cwfitzgerald cwfitzgerald enabled auto-merge (squash) July 26, 2022 06:41
@cwfitzgerald cwfitzgerald merged commit e59c330 into gfx-rs:master Aug 1, 2022
@nical nical deleted the binding-idx-limit branch August 2, 2022 07:54
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.

2 participants