Skip to content

Conversation

@andyleiserson
Copy link
Contributor

We were validating storage texture compatibility when creating bindings, but not when creating BGLs. The spec requires both. Extracts the existing validation for bindings into a helper function and calls it when creating a BGL.

I omitted a changelog entry since it seems unlikely that anybody could be accomplishing anything useful by creating such BGLs and not binding them, but, I'd be happy to add one if it seems appropriate. (Not specific to this change, but in general, stricter validation seems likely to break things and thus worth noting in the change log. On the other hand, we have a lot of missing validation so noting absolutely every change to validation could bloat the changelog quite a bit.)

Testing
By the CTS.

Squash or Rebase? Squash

Checklist

  • If this contains user-facing changes, add a CHANGELOG.md entry.


/// Validates that storage texture format features support the requested access mode
/// and returns the corresponding internal TextureUses flags.
fn validate_storage_texture_format_support(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it probably makes sense to move this helper to a free function in conv rather than being an associated method on Device. The reason I haven't is that I briefly considered whether the call to describe_format_features should be inside the helper, in which case a method on Device would be needed. So I thought I would wait and see if there is review feedback.

Comment on lines +62 to +63
#[error(transparent)]
Binding(#[from] BindingError),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this here to avoid match-conversion of errors returned by the helper or introducing a new error type. But I can see a case that it makes more sense to preserve BindingError exclusively for bindings and not binding templates.

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

The spec doesn't seem to require validating this twice. The format is validated when creating the BGL and when creating the BG, the format of the view is checked against the format of the BGL entry.

@andyleiserson andyleiserson marked this pull request as draft December 18, 2025 21:25
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