-
Notifications
You must be signed in to change notification settings - Fork 437
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
Use shaderc instead of glsl-to-spirv for shader compilation #947
Conversation
Looks like the build timed out 😢 |
Hi! Would also be nice to get any opinions you have on advantages/disadvantages on glsl-to-spirv vs shaderc-rs. Edit: Just found these issues, looks like tomaka and Gabriel agree that using shaderc-rs is a good option. |
Cool! I will try to find time today to resolve the merge conflict, if not some time this week. Some advantages off the top of my head:
|
DocsSomething I failed to realize before, is that merging this PR means that using vulkano would require setting up cmake, a c++ compiler etc. which can be quite painful depending on the platform. To merge this PR I will need extensive docs on how to setup for each platform. The platforms I know to be currently supported are Windows msvc, windows gnu, macOS and Linux. The changelog entry also needs to be expanded, potentially linking to the new setup instructions in the readme. If we cant keep a platform working or the steps to setup a platform are way too painful then we will need to abandon this PR. C++ compiler errorOn another note, when I try to compile your branch of vulkano on Arch Linux I get a C++ compiler error so I have filed a bug google/shaderc-rs#25 |
It's nice to see that shaderc-rs is considered for vulkano. Let me know if any change in shaderc-rs is needed. Happy to help. :) Yes, cmake & C++ compiler is needed. But I think it's the same case for the existing hlsl-to-spirv wrapper around Glslang? But I'm definitely not an expert on vulkano to assert anything. |
PS: google/shaderc-rs#25 is fixed now. :) |
@antiagainst Since it was created hlsl-to-spirv includes a windows .exe in the source, apparently because setting up the build environment was too hard. Hopefully we can just document the setup process well 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.
Sorry for the delay, this all looks good, just two nitpicks.
Once this is rebased and google/shaderc-rs#26 has been addressed then I can merge it. I'm happy to include the steps in the readme, for setting up the shaderc dev environment, after merging this PR.
You might need to also remove the readme I just added /~https://github.com/vulkano-rs/vulkano/blob/master/glsl-to-spirv/readme.md |
So you mentioned that you wanted detailed notes on how to get setup for building shaderc. I added a small paragraph about the required dependencies (CMake and Python).
Since there wasn't really any setup that needed to be done for any platform I didn't feel like more instructions were needed in the README for installing CMake and Python (I added links to the project websites 😄) |
Thanks for the fixes and writing the readme changes. I'm not sure why but github is listing all sorts of irrelevent changes from previous commits under "files changed" which is concerning. I guess it doesnt matter because its not reverting them its just hard to see the actual changes?!? Maybe you should be using rebase instead of merge in the future? |
@rukai Here is a diff from a cleanly rebased (well, cherry-picked) version: master...HadrienG2:shaderc-cleanup . It shows the ~same thing as the PR diff for me, so I'm not sure if this is a GitHub false positive. |
oh huh, must have been a bug with github or a bug with my brain. Files changed looks fine now. |
Github sometimes needs a page refresh, might be that :) |
Only thing I'm waiting on now is figuring out how to build on windows-gnu. I will look into this in a few days hopefully. |
Its a shaderc-rs issue I think. I added some info on google/shaderc-rs#26 |
With google/shaderc-rs#27 I managed to get this building and the tests pass. Here is my full step-by-step for getting tests passing: New-Item C:\Temp -Type Directory
Push-Location C:\Temp
# Install chocolatey package manager
Invoke-WebRequest ((New-Object System.Net.WebClient).DownloadString("https://chocolatey.org/install.ps1"))
# Install required tools
& choco -y install git cmake python 7z
Set-Alias git "C:\Program Files\Git\bin\git.exe"
Set-Alias 7z "C:\Program Files\7-Zip\7z.exe"
$env:Path += "C:\Program Files\CMake\bin\;C:\Python37\;"
# Install a specific version of MinGW that works with Rust
Invoke-WebRequest https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z -OutFile mingw-w64.7z
7z x mingw-w64.7z
$env:Path += "$pwd\mingw64\bin\;"
# Install Rust
Invoke-WebRequest https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
& .\rustup-init.exe -y --default-toolchain stable-gnu
$env:Path += "$HOME\.cargo\bin\;"
# Get Vulkano and run tests
& git clone -b shaderc https://github.com/nlordell/vulkano.git
Push-Location vulkano
cargo test Something that might be worth documenting in the README is that MSYS2 with latest MinGW-w64 toolchain does not work well with Rust and that your best bet is to use the same version Rust uses: |
So I did a bit more digging and any single Windows toolchain can support all of the Windows targets (/~https://github.com/rust-lang-nursery/rustup.rs#working-with-rust-on-windows). I think its might be much easier to actually use the MSVC toolchain and target |
Thanks for ensuring vulkano continues to run on every platform, I'll merge it now. |
Supporting a gnu toolchain is necessary because both Eclipse Corrosion and Intellij Rust only support gnu for debugging. People shouldn't be forced to use VS Code just to debug their code. |
No description provided.