SPIRV Support via GLSLang
- Author: Pavel Rojtberg
- Link: The issue
- Status: Draft
- Platforms: GLES2, GL3Plus
- Complexity: 3 man-months
Introduction and Rationale
Support for loading/ compiling to binary SPIRV shaders is a prerequisite for supporting Vulkan at some point.
Furthermore glslang would allow cross-compiling existing HLSL shaders for OpenGL.
Additionally using SPIRV is very handy on mobile where shader compiler quality is mediocre at best.
Similar to Cg, add a Plugin for generating SPIRV shaders as well as support for loading SPIRV shaders in GL3Plus and/ or GLES2. The plugin would leverage glslang.
Also add SPIRV compatible sources to the RTShaderLib to demo on-the fly translation from Fixed-Function.
Impact on existing code, compatibility
This is purely a new feature, so exiting code should not be affected. Some changes to the GLES2/ GL3Plus RenderSystems have to be made so they can load precompiled low-level shaders. However we already have a boilerplate for this in the legacy GL RenderSystem as this is how the first ARB shader programs worked.
The Plugin will need to build glslang which is a beast. However this will only affect the Plugin build and it is fine when it only works on Linux at first, where the build is more tractable.
Just implement the loading part in the RenderSystems. However this will result in a much smaller coverage and testing which on-the-fly compilation of existing shaders would give us.