Skip to content

Fixes for dual-source blending validation#9200

Open
andyleiserson wants to merge 5 commits intogfx-rs:trunkfrom
andyleiserson:dual-src-validation
Open

Fixes for dual-source blending validation#9200
andyleiserson wants to merge 5 commits intogfx-rs:trunkfrom
andyleiserson:dual-src-validation

Conversation

@andyleiserson
Copy link
Contributor

Supersedes #8939. Fixes #9111.

  • Validate @blend_src structs in type validation. The spec requires validating any struct with @blend_src attributes, whether or not it is used by an entry point.
  • Remove @blend_src-related interface validation that is redundant with the type validation.
  • Dual-source blending requires that there be a single color attachment.

Re: IO_SHAREABLE: The concept of "I/O shareable" was removed from the spec at some point. A type flag is mostly unnecessary here, we could instead use a is_numeric_scalar_or_vector helper. @blend_src structs seem to be the only case where it is still useful (to be able to mark structs that passed @blend_src validation in type validation). For that purpose naming the flag BLEND_SRC might be clearer, although using up one of 8 type flags just for @blend_src structs seems a bit unfortunate. (I was initially going to add a new type flag for BLEND_SRC, until I realized it's only a u8 and doesn't have any free bits.) As of this change, a struct consisting of only @location-bound members is no longer marked IO_SHAREABLE. We validate the members individually in interface validation anyways, there isn't a check anywhere of something like "this struct appears in I/O so must be IO_SHAREABLE". While we could use that strategy to check the members once in type validation instead of during interface validation, (1) any savings from doing so is negligible, (2) @location bindings within the struct still need to be inspected during interface validation for conflicts among all of the I/O. @jimblandy this paragraph seems like it might interest you even if you don't review the whole PR.

Testing
Enables CTS tests and adds/updates wgsl_errors tests.

Squash or Rebase? Probably squash the last three commits and then rebase.

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • Need to add a CHANGELOG.md entry, or there may already be one in this release for dual-source blending that can be updated.

- Validate `@blend_src` structs in type validation. The spec requires
  validating any struct with `@blend_src` attributes, whether or not
  it is used by an entry point.
- Remove `@blend_src`-related interface validation that is
  redundant with the type validation.
- Dual-source blending requires that there be a single color
  attachment.
Including a regression test for gfx-rs#9111.
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.

WGSL dual source blending validation issues with multiple fragment entry points

1 participant