Skip to content

Naga should support source maps #7463

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
jimblandy opened this issue Apr 1, 2025 · 1 comment
Open

Naga should support source maps #7463

jimblandy opened this issue Apr 1, 2025 · 1 comment
Labels
kind: diagnostics Error message should be better naga Shader Translator type: enhancement New feature or request

Comments

@jimblandy
Copy link
Member

People are generating WGSL from other sources (WESL, for example), and would like to get error messages that refer to their original sources. Naga should help them do that.

This might not really imply sourcemap support within Naga itself. It might be sufficient just to make sure that error types expose spans that a consumer could apply source maps to. But with this approach, the user would then need to use some crate like codespan_reporting themselves.

@jimblandy jimblandy added type: enhancement New feature or request naga Shader Translator kind: diagnostics Error message should be better labels Apr 1, 2025
@kpreid
Copy link
Collaborator

kpreid commented Apr 1, 2025

IMO, it would be nice to have an API which allows simply passing multiple source strings that are each separately line-numbered (and named), for users who want to organize their shader code into multiple files. (WebGL supports this via GLSL #line directives.)

This could be expressed as a wgpu::util (or entirely external) function that constructs a source map for the concatenation. But if source map support increases code size and build time significantly, then it would be nice to have a separate feature. But-but, users concerned with that might actually prefer the option of entirely leaving span mapping and error formatting out of the binary, as you suggest as an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: diagnostics Error message should be better naga Shader Translator type: enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants