-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Provide flags to configure metal compilation #5823
Comments
Generally, I'm a bit skeptical about adding manifest API for Xcode specific file types. For this issue in particular, I think Xcode should just automatically do the right thing and pass debug-related flags (there's an existing bug tracking that request rdar://79153205). cc @abertelrud |
Boiling the problem down and we're left with "we cannot debug Metal shaders from SPM Packages" I'm not concerned how that's solved. But right now it means folks can't really use SPM & metal together (see https://twitter.com/warrenm/status/1582039539123486721). I've been trying to get it working and have resorted to using my own SPM Plugin to compile .metal https://github.com/schwa/MetalCompilerPlugin - which isn't ideal as I can't overwrite default.metallib and have to build my "debug.metallib" side by side with it. That said I can definitely see a need to send metal compilation flags to metal from SPM - being able to configure -D macros for example seem very useful. |
(As background: One technique folks have been using as well is to put their metal files in a C target, with headers in ./include and a module map to make the headers available to swift.) |
Yes, Xcode should just do automatically the right thing. But it doesn't. We've been hacking around this stupid problem for years now. Throw us a bone. |
It's been almost a year - is there still no way to configure how SPM compiles metal code into .metallibs? |
Looks like rdar://79153205 is still unresolved. |
Checking the pulse on this issue, is there still no way to debug metal shaders with SwiftPM? |
AFAIK, no. I've abandoned SPM for most of my code because of this. It's just too much of a headache. |
I am debugging metal shaders using the SPM plugin I mentioned earlier (https://github.com/schwa/MetalCompilerPlugin). It's not a great solution (development-only plugins suck in general) but it does allow me to debug shaders. I'd still much prefer a proper solution from Apple but this definitely does not seem overly important to them. |
Description
It seems SPM now magically compiles .metal files into a default.metallib (see #5822)
Unfortunately there's no documented way to specify compilation flags to the metal compiler.
This means it is impossible to debug shaders using the Xcode Metal Debugger. When we try we get this error:
I'd like to see .metalFlags or similar available to SPM
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
Swift Package Manager version/commit hash
No response
Swift & OS version (output of
swift --version && uname -a
)No response
The text was updated successfully, but these errors were encountered: