Skip to content

Initial naga changes for mesh shaders #7930

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

Open
wants to merge 78 commits into
base: trunk
Choose a base branch
from

Conversation

SupaMaggie70Incorporated
Copy link
Contributor

@SupaMaggie70Incorporated SupaMaggie70Incorporated commented Jul 11, 2025

Connections
#7197

Description
This is the initial change for naga mesh shaders. Currently not in a workable state. Issues to work out:

  • Expecting u32 for certain functions, right now you have to explicitly say 0u, etc
  • Actually interpreting mesh shader related things in the IR
  • Validation of shaders
  • Sending back more information about what limits it needs
  • Reflection info
  • SPIR-V writing
  • Testing of SPIR-V output

Testing
There is a test WGSL shader that is parsed and then written to SPIR-V

Squash or Rebase?
Absolutely squash

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.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

 Please enter a commit message to explain why this merge is necessary,
The CI pooped itself, hopefully this fixes that. Will probably be undone either way.
@SupaMaggie70Incorporated SupaMaggie70Incorporated marked this pull request as ready for review July 14, 2025 18:14
@SupaMaggie70Incorporated SupaMaggie70Incorporated requested a review from a team as a code owner July 14, 2025 18:14
@SupaMaggie70Incorporated
Copy link
Contributor Author

I'm marking this as ready for review so that it can generate some eyes to look at the general process. Obviously the PR is 5k lines long so will not be merged in anything like its current state. It also is failing CI due to rspirv not being updated (see #7945 ) and the shader compiling benchmark not respecting the configuration tomls and therefore trying to compile for incompatible backends like GLSL.

The fragment shader input on the test would be invalid to use with the corresponding mesh shader because it doesn't have the not yet implemented @per_primitive attribute for its primitive input.

I'd mainly like for people to check out my SPIRV backend changes, as that is the part I am most unsure about.

The generated mesh and task shaders pass spirv-val, but I haven't yet tried using them in a real mesh pipeline.

@SupaMaggie70Incorporated SupaMaggie70Incorporated marked this pull request as draft July 16, 2025 15:18
@SupaMaggie70Incorporated
Copy link
Contributor Author

SupaMaggie70Incorporated commented Jul 17, 2025

Unmarking as draft (again lol) because I have given it another pass with my own eyes and @cwfitzgerald mentioned he would check it out

Also I'd like to know how you'd prefer to address the benchmark issue

@SupaMaggie70Incorporated SupaMaggie70Incorporated marked this pull request as ready for review July 17, 2025 17:58
@jimblandy
Copy link
Member

@SupaMaggie70Incorporated Would you like to rebase this and address the CI failures?

@SupaMaggie70Incorporated
Copy link
Contributor Author

@jimblandy Rebase onto what exactly? Also, the CI failures are due to shader compiling benchmarks that can't be told "only compile this into SPIRV" since not all output languages are supported yet. So I am actually looking for guidance on how I should address that!

This is marked as a non-draft despite its size because @cwfitzgerald mentioned he wanted to take a look over the whole thing before I split it up and let other people review individual PRs. The PR isn't quite done as is, but I just wanted to give him the chance to look over approximately what it would be.

@andyleiserson
Copy link
Contributor

Also, the CI failures are due to shader compiling benchmarks that can't be told "only compile this into SPIRV" since not all output languages are supported yet. So I am actually looking for guidance on how I should address that!

There are toml files alongside the test shaders that specify which backends they are intended for, although I'm not sure if what's there will match exactly with what the benchmark test needs. But an option to consider is figuring out how to reuse the code in naga/tests/naga/snapshots.rs that parses these toml files for the benchmark.

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.

4 participants