-
Notifications
You must be signed in to change notification settings - Fork 3
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
allow imports from .wgsl (not just .wesl) #26
Comments
Shall we spec that WGSL is valid WESL, and then close this? |
I think this is completed? Or should we explicitly state that WESL is a strict superset of WGSL somewhere in the Readme? |
from the updated imports spec:
My only question/doubt is should we handle If we agree let's close this |
Let's consider changing that spec line on tools rewriting @stefnotch has suggested elsewhere that perhaps libraries don't need file paths at all (and should use module paths), in which case the issue is moot since there won't be file paths anyway. If there are file paths in libraries (perhaps we'll want them for error reporting), then I fear that rewriting the publishers file suffixes will be confusing to users. It will require an extra fs lookup in resolving .wgsl libraries, so there'd be some minor performance cost. |
+1 for that! It's a great thing to explain for ongoing new adoption. Your WGSL code just works. Maybe not quite 'strict' on superset I suppose. Somewhere lower down, we should also discuss the minor differences when bringing wgsl into a wesl project. Everything is the same in the root module, but porting a wgsl module, you'll notice some minor differences (e.g. const_assert in unused modules, #65, etc.). |
ah yes. I think a package should contain the 'untransformed' source code alongside any transformed code (like what you did with random_wgsl). Was there another reason to rename .wgsl to .wesl?
+1 for that too |
Okay, I'm convinced. Let's take that out of the spec, and let's plan for packages to have both
|
agreed, update spec and close issue |
is what https://github.com/wgsl-tooling-wg/wesl-spec/blob/main/Imports.md says today |
wesl code will coexist in the community with vanilla wgsl code for the foreseeable future. To enable easy interop with wgsl, I'd suggest we allow wesl imports to import from vanilla wgsl modules.
A user should be able to take a wgsl file containing a utility functions (e.g. color space conversion), add the wgsl file into their project and immediately be able to import one or more of the utility functions into their wesl application with no editing of the wgsl required. Another scenario, users with existing wgsl projects would be able to incrementally move their wgsl files to wesl with higher confidence since no editing is strictly required.
It would be nice if a wgsl code module is valid wesl, in which case supporting this feature requires no additional implementation effort. But several features we've discussed (e.g. module private by default, required module paths, etc.) would break that assumption.
If wgsl is not valid wesl, we could still teach linkers, language servers, and other tools to understand wgsl as well as wesl. Some additional complexity would ensue of course.
The text was updated successfully, but these errors were encountered: