Skip to content
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

Glslang implementation for online shader compilation #154

Merged
merged 38 commits into from
Feb 21, 2021

Conversation

axsaucedo
Copy link
Member

@axsaucedo axsaucedo commented Feb 20, 2021

Fixes #150
FIxes #121
Fixes #155

As per discussion in #112, #153 and #150, this PR is based in #112 and explored the capabilities and limitations of GLSLang vs Shaderc as an option to provide support for online compilation of shaders. A few key insights were discovered when comparing this with the shaderc implementation, which are the following:

  • Shaderc is faster as it implements multithreading to process the shaders, but it ultimately is built on top of glslang so it is also possible to implement the same with glslang
  • Swapping shaderc and glslang can be done without much complexity, so if we start with one and then switch to another one would just be a matter of updating the implementation based on the code provided
  • glslang increases the size of the test binary from 3 to ~8 mb, whereas shaderc increase it to ~11
  • GLSLang doesn't currently have a multi-threading safe interface through their "simpler" C++ interface (eg InitializeProcess / FinalizeProcess) but does through the C interface, when this functionality is required
  • Shaderc currently exposes only a small subset of the functionality through Shader.hpp, including the compilation from source, and the FileCompiler is not currently accessible via the same high level interface (and it's only really covered in how glslc uses it)
  • Compilation times are significantly higher with shaderc (5-10 minutes with 8 cores for shaderc), this seems to be the biggest disadvantage.

@axsaucedo axsaucedo merged commit cb79948 into master Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant