Description
Qt Shader Tools: how to expand the pre-compilation story.
qsb can be requested to invoke fxc or the Metal command-line tools to include DXBC or .metallib binaries instead of source in the .qsb. This only works when building on Windows/macOS of course.
-c, --fxc In combination with --hlsl invokes fxc to store DXBC instead of HLSL. -t, --metallib In combination with --msl builds a Metal library with xcrun metal(lib) and stores that instead of the source.
The Metal and D3D11 backends of QRhi are already prepared for picking the intermediate format from the QShader package, if such a version of the shader is available in it.
When manually doing the processing and calling qsb this is not ideal (because one may want to do it on Linux where the external tools are not available). If the build system integration happens however, that is a great opportunity because we can then invoke the right tools (so we could always include DX bytecode in the .qsb instead of HLSL sources)
The goal here is to ensure that the build system integration runs qsb with the parameters that are best suited for the platform we are building for. May also tie in to QTBUG-78592 to some extent (as post-processing the SPIR-V binary output by glslang is conceptually the same from shadertool's perspective as post-processing the GLSL/HLSL/MSL source output by SPIRV-Cross)
Note: This does not include the vendor-specific mess APIs like OpenGL. Only the well-tooled, vendor-controlled APIs are in scope here: Metal and Direct3D. Vulkan does not need this by nature.
Attachments
Issue Links
- depends on
-
QTBUG-78590 Build time shader processing support
- Closed
- relates to
-
QTBUG-78592 Shadertools: investigate using other tools from the open source ecosystem to include more optimized SPIR-V in the .qsb files
- Closed