google / shaderc

A collection of tools, libraries, and tests for Vulkan shader compilation.
Other
1.83k stars 358 forks source link

Shaderc as library for glsl / hlsl -> optimized SPIR-V with reflection #415

Open Sairony opened 6 years ago

Sairony commented 6 years ago

It would seem libshaderc is the way to go, but it doesn't seem to possible to produce this combination.

In games, at least for desktop, one usually have some sort of material system which produces different permutations depending on user settings & hardware, as such one can't ship SPIR-V. It doesn't make sense to spawn a new process of glslangValidator then, optimization on / off is a given.

dneto0 commented 6 years ago

Currently libshaderc is only a compilation API. It does not produce reflection information as a side effect of compilation. Experience with HLSL compilation through Glslang shows that Glslang's reflection API is not accurate since HLSL "legalization" transforms will throw away bindings, and so the reflection information is out of date.
The plan is to write a standalone API & utility in SPIRV-Tools to do reflection on a SPIR-V module in isolation. See https://github.com/KhronosGroup/SPIRV-Tools/issues/859