Skip to content

[naga] Write only the current entrypoint #7626

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 2 commits into
base: trunk
Choose a base branch
from

Conversation

andyleiserson
Copy link
Contributor

@andyleiserson andyleiserson commented Apr 24, 2025

Changes the MSL and HLSL backends to support writing only a single entry point, and uses them that way in wgpu-hal. (The GLSL and SPIR-V backends already provide an entry point selector.)

This is working towards a fix for #5885, but this change doesn't alter override processing or validation, so we will still reject shaders for missing overrides whether or not they are used.

Testing
Both the write-one-entrypoint and write-all-entrypoints cases are exercised either by existing or changed code. Existing tests cover the change in behavior, in that the tests still work, even when no longer writing all entrypoints to the output. Additional partial-output test cases will be added with the complete fix for #5885.

Squash or Rebase? 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.
  • Added a changelog entry.

Changes the MSL and HLSL backends to support writing only a single entry
point, and uses them that way in wgpu-hal.

This is working towards a fix for gfx-rs#5885.
@andyleiserson andyleiserson requested a review from a team as a code owner April 24, 2025 18:23
@cwfitzgerald
Copy link
Member

+1 this for a different reason - it's less code to hand to the driver (for it to just throw out) and less for people looking in shader debuggers to wade through.

@teoxoy teoxoy self-assigned this Apr 25, 2025
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.

Entry points are uniquely identified by (name, stage), that's what the SPIR-V & GLSL backends use as well, I think the MSL & HLSL backends should follow that model to ensure only a single entry point is written.

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.

3 participants