[naga spv-in] Add support for memory barriers#7630
Merged
teoxoy merged 3 commits intogfx-rs:trunkfrom Jun 16, 2025
Merged
Conversation
c867f55 to
cf1d916
Compare
de56a4a to
d1ec6c8
Compare
Contributor
|
This looks great, can't wait for it to land! |
d1ec6c8 to
20d22a5
Compare
20d22a5 to
15fb018
Compare
15fb018 to
6eed94b
Compare
teoxoy
approved these changes
Jun 16, 2025
robtfm
added a commit
to bevyengine/naga_oil
that referenced
this pull request
Jan 22, 2026
This is a working naga 28 update. I noticed some tests haven't passed (specifically cargo test --all-features) since before 0.14, so this PR doesn't attempt to make them pass. ## enumerate_adaptors `instance.enumerate_adapters` is async now (and available on webgpu): gfx-rs/wgpu#8230 . more details in the wgpu release notes. ## ControlBarrier & MemoryBarrier Barrier was split in two to support MemoryBarriers: gfx-rs/wgpu#7630 From the PR, it seems like falling back to ControlBarrier is fine so that's what I did. ## Ray Query enable ray queries require `enable wgpu_ray_query;`: gfx-rs/wgpu#8545 This doesn't currently seem to make it through, and the relevant test fails. ## ImageAtomic Image atomics were added in gfx-rs/wgpu#6706 ## Mesh Shaders Mesh shaders are a major feature of wgpu 28, ~~but I've set their fields to None here in the interest of doing an upgrade and not a feature add at the same time~~ https://github.com/gfx-rs/wgpu/releases/tag/v28.0.0 update: I found some time and built a wgpu mesh/task shader demo and used that to validate some of the mesh shader functionality. I've used this to successfully compile a task shader with naga-oil and run it, but there's still something missing from the mesh shader module output here. --------- Co-authored-by: robtfm <50659922+robtfm@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Naga's SpirV ingest currently has support for control barriers, but not memory-only barriers. This PR endeavors to add this support for SpirV in as well as any language out that may make proper use of them. Languages that don't support memory barriers without an execution barrier will follow the existing Control Barrier path.
Additionally, Control Barriers for SpirV in and out have no distinction between workgroup and subgroup memory scopes. Support for that has been added as a separate commit, which can easily be pulled out into a separate pull request if desired.
Testing
I've compiled a simple shader with rust-gpu that utilizes their memory_barrier function. These changes allow the compiled shader to be parsed and executed, where previously the validator would panic that OpMemoryBarrier was unsupported. I've also added a spvasm file to
naga/tests/in/spvthat compiles to all backends.Squash or Rebase
Both commits should be able to stand on their own if whoever does the merge prefers to rebase. Either way is fine.
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.