-
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
Optimize SPIR-V code #904
Optimize SPIR-V code #904
Conversation
[skip ci]
I suppose that |
@tomaka It removes some metadata required for reflection, but I think it's OK, since the driver would throw it away anyway. There are other options we could enable over time, described in this white paper. |
glsl-to-spirv is no more #947 |
Related to this, since we already include the whole copy of SPIRV-Tools in Shaderc, it should be natural to extend the current shaderc-rs API to also expose SPIRV-Tools ones, if there is a need. |
This pull request adds an additional tool (spirv-opt) to the shader building pipeline. It is used to optimize the shader modules even further.
glslangValidator
is good at compiling code, but it is meant to be a reference compiler, not an optimizer, therefore it lacks advanced optimizations.The SPIRV-Tools repository contains a tool called
spirv-opt
which can be used to optimize shader binaries. I haven't run any advanced benchmarks, but on the examples, this tool reduces shader code size by about 33% (by eliminating dead / unnecessary code).This will also open the way to even more advanced optimizations as
spirv-opt
gets improved.The pull request includes the
x64-Release
Windows binary from CI, available here. I understand if you want to remove it and add it yourself since I could've potentialy included malicious code.In order to enable to use additional tools I had to change
glsl-to-spirv
. I refactored both thebuild.rs
and thelib.rs
files, it should be easier to chain more tools in the future.To do:
Fix building on Linux.CI works now.I tried adding theWon't enable it, unnecessary.--strip-debug
flag but it prevents shader reflection from working. @tomaka do you want to investigate or is it alright to merge without it?