XShaderCompiler vs glslang reflection


#1

Hello!

I’m currently working on extracting information from shaders to use as input when creating the Vulkan pipeline layouts in my own engine, digging a bit into the source code of the low level renderer right now to see how it’s done in bs::framework.

From what I can see you are doing this in two different ways, using XShaderCompiler and glslang reflection. Is there any limitations that each of them has that makes you have have to use both of them and what are their use cases?

By the way, thanks for a great engine that is excellent as a learning resource as well!

Regards,
Axel


#2

XShaderCompiler generates reflection on a shader level, for a single BSL shader, which can include multiple GPU programs. It also generates reflection independently of the render API (DirectX/OpenGL/Vulkan), and in fact requires no underlying render API.

glslang and other render API specific reflection provides information about actual binding points/offsets that the render API expects, which cannot be provided by XShaderCompiler. For completes it also outputs various other reflection information, specific for a single GPU program, in case the user wants to compile gpu programs using raw GLSL or HLSL, instead of using high level BSL.