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

Add support for break if #1993

Merged
merged 1 commit into from
Jun 25, 2022
Merged

Add support for break if #1993

merged 1 commit into from
Jun 25, 2022

Conversation

JCapucho
Copy link
Collaborator

Adds support for the break if statement that may appear in the continuing block of a loop.

Relevant part of the spec: https://gpuweb.github.io/gpuweb/wgsl/#break-if-statement

Implements parsing in the wgsl frontend, emission on all the backends and validation for it.

Uniformity analysis isn't implemented, following the same behavior as regular breaks (this will be fixed in the uniformity analysis v5 rewrite).

All commits can be reviewed individually and are fully tested

Closes #1831

@JCapucho JCapucho requested a review from jimblandy June 17, 2022 15:05
@JCapucho
Copy link
Collaborator Author

Nightly is changing the formatting of some parts, and if those changes are formatted with stable they are reverted

Copy link
Member

@jimblandy jimblandy left a comment

Choose a reason for hiding this comment

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

Thank you so much for 1) this PR and 2) leaving the SPIR-V front end change to a separate PR so my brain doesn't break.

This also needs some failure case coverage in tests/wgsl-errors.rs:

  • misplaced break if statements
  • non-bool expressions

A few suggestions, too.

src/lib.rs Outdated Show resolved Hide resolved
src/back/wgsl/writer.rs Show resolved Hide resolved
src/back/spv/block.rs Outdated Show resolved Hide resolved
src/back/spv/block.rs Outdated Show resolved Hide resolved
src/back/spv/block.rs Outdated Show resolved Hide resolved
src/back/spv/block.rs Show resolved Hide resolved
src/back/spv/block.rs Outdated Show resolved Hide resolved
src/back/spv/block.rs Show resolved Hide resolved
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-in] Add break-if as optional at end of continuing
2 participants