-
Notifications
You must be signed in to change notification settings - Fork 21
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
CMake structure and CLI #27
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it okay if I fixup the cmake project in this pr, or do you prefer after merging this pr?
@madebr this is great. Do you want to just submit a patch for the CMake config? You know way more about build systems than me. |
I can push to this repo (and to this PR). I just don't want to interfere with your work. |
It looks like you created a |
Issues/questions I have:
|
Thanks for this. I'll push to a fork next time. Working on the warnings now. |
This is looking pretty good, just going to add the HLSL export now. |
@madebr Is there a way to specify that we want to link SDL to the CLI statically? I'd like to be able to distribute the executable standalone. |
Not currently. I'll add an option to make it opt-in. |
You're the best. |
Will review this later tonight - @DanielGibson, how does the README look? If it's all good we should be able to close #18 with this PR too! |
We should probably also start versioning with |
I went ahead with the rename. If unwanted, a revert is easy. |
README.txt
Outdated
This library also provides a command line interface for offline translation of shaders. | ||
|
||
For SPIRV translation, this library depends on SPIRV-Cross: https://github.com/KhronosGroup/SPIRV-Cross | ||
For compiling to DXIL, dxcompiler.dll and dxil.dll are required (or your platform's equivalent). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do those also ship with Windows or else where do you get them?
Should the application using SDL_gpu_shadercross ship dxcompiler.dll and dxil.dll or should it expect the user to install some DirectX runtime?
Does it not need any additional libraries for macOS/Metal support?
(apart from this the README looks good to me :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do those also ship with Windows or else where do you get them? Should the application using SDL_gpu_shadercross ship dxcompiler.dll and dxil.dll or should it expect the user to install some DirectX runtime?
Added a note about this.
Does it not need any additional libraries for macOS/Metal support?
Nope, just SPIRV-Cross.
README.txt
Outdated
@@ -8,6 +8,8 @@ This library also provides a command line interface for offline translation of s | |||
|
|||
For SPIRV translation, this library depends on SPIRV-Cross: https://github.com/KhronosGroup/SPIRV-Cross | |||
For compiling to DXIL, dxcompiler.dll and dxil.dll are required (or your platform's equivalent). | |||
These dependencies can be obtained in the Vulkan SDK: https://vulkan.lunarg.com/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, the Vulkan SDK for Windows doesn't include dxil.dll
Maybe one should use https://github.com/microsoft/DirectXShaderCompiler/releases instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally right, I must have put that dll in my own VulkanSDK dir. I'll add the link to the DXC release page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we now have the symbol list we should probably change the header to always declare the whole API, and return errors when the compiled library doesn't enable the appropriate backend(s). That can be done in a later commit though, this is fine for now.
When configuring with Check the artifacts: https://github.com/libsdl-org/SDL_gpu_shadercross/actions/runs/11535764041?pr=27 |
This project wasn't really structured like a single-header library anyway, so it can now build as a shared library with CMake. This should make it easier to use for interop.
It's also good for performance to offline compile shaders, so I added a CLI that will let you offline compile from HLSL and SPIRV to the formats accepted by the backends. The CLI is statically linked to SDL_gpu_shadercross and SDL, but it still dynamically loads SPIRV-Cross and the DirectX compiler DLLs.
TODO before merge: Add TranspileHLSLFromSPIRV.