Skip to content

Allow Naga spv-in and spv-out in no_std #7760

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

Conversation

bushrat011899
Copy link
Contributor

@bushrat011899 bushrat011899 commented Jun 6, 2025

Connections

Description

  • Removed spv-in and spv-out from the std configuration of Naga.
  • Added a fs feature to Naga for integration with std::fs (currently only used to write block context dumps in SPIR-V)
  • Adjusted internal usage of Path and PathBuf to add one layer of indirection, allowing Naga to choose either Path/Buf or str/String for internal storage based on std availability. This is only required in spv::Options and spv::DebugInfo, but the technique may be suitable to extract into wgpu-types if required in other areas.
  • Added spv-in and spv-out to the Naga component of the no_std CI task.

Testing

  • CI

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

@bushrat011899 bushrat011899 requested a review from a team as a code owner June 6, 2025 02:08
@cwfitzgerald cwfitzgerald self-assigned this Jun 11, 2025
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Some notes

Comment on lines 405 to 412
/// Abstraction over `PathBuf` which falls back to [`String`] for `no_std` compatibility.
#[derive(Clone)]
pub struct DumpPrefix {
#[cfg(std)]
inner: PathBuf,
#[cfg(no_std)]
inner: String,
}
Copy link
Member

Choose a reason for hiding this comment

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

Both this and the other struct should be in a common place in naga so it can be re-used throughout the codebase, instead of isolated to spv frontend/backend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I've moved these into naga::path_like (which is a rename of naga::as_diagnostic_file_path). I've kept the types public in a private module as we don't intend for other crates to rely on these types. But I'm happy to move this whole module into wgpu-types and make it public if you'd prefer.

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.

2 participants