-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Precompiled Shaders Tracking Issue
This is a tracking issue for all things precompiled shaders, as well as making naga an optional dependency.
Current open PRs
Motivation
Precompiled shaders will greatly reduce the startup time for apps, something which linebender/vello for example has expressed interest in. Removing naga as a dependency will also reduce binary size significantly, which is useful for web or mobile applications.
Wgpu already has passthrough shaders, which technically allow using precompiled shaders already, but these have some downsides:
- Naga is still part of the binary, even though its unused
- Wgpu's compilation logic is hidden and must be reimplemented
- No validation can be dond. This means that users may compile shaders that require features not available on all hardware, and wgpu won't be able to catch this.
Prior work
The previous issue for this was #3103. There was lots of discussion there.
I've also been chipping away quietly at parts of this for a while now. Relevant PRs:
- DXIL & HLSL passthrough #7831
- Initial precompiled shaders implementation #7834
- Add more complete MSL passthrough #8140
- Changed wgpu to default to static dxc when the feature is enabled #8882
- Add metallib passthrough #8886
- Add a DX12 backend option to force a certain shader model #8984
Todo list
Below are some tasks, generally in order, that must happen for precompiled shaders to be considered "complete" in my opinion.
- GLSL passthrough #8524 - Add GLSL passthrough #9064
- Split shader compilation into wgpu-shaders crate #8842 - Split shader compilation logic into new wgpu-shaders crate #9080
- Naga backend supported capability detection #9006 - Add supported caps info to naga backends #9068
- Naga GLSL backend cross-platform output #9007 - probably will simply be part of
wgpu-shaders - Make said
wgpu-shadershave a user-friendly public API - Use passthrough shaders in wgpu-core internal shaders #9010
- Passthrough shader context & validation #9009
- Make the features
spv,wgsl,glslornaga-irall enablenaga, so thatnagacan be removed as dependency
Here are some other tasks that should also happen at some point
- Metal passthrough shaders have limitations #8330
- Allow use of and experiment with spirv-opt #8843 - at least in wgpu-shaders