5 ms·
Shipping compiled shaders is a feature request that pops up from time to time in gfx-rs land [1]. So far, we have been skeptical about this. Something like a se
by kvark 6y ago
Shipping compiled shaders is a feature request that pops up from time to time in gfx-rs land [1]. So far, we have been skeptical about this. Something like a serializable pipeline cache would help, but not entirely solve the shipping binary size. Although, is it really important? "Hello Triangle" may be a few megs, but the code for shader translation is a constant addition to it, so extrapolating this 5.2Mb value is not useful.
Currently, both Dawn and wgpu-native use SPIRV-Cross for translation of shaders. The plan is for both is to migrate to in-house translation. In case of wgpu, that would be Naga [2]. Sometime in the future, you could be able to include it with only WGSL -> AIR (Apple's shader IR) code path compiled in, without anything else. Could be good enough for the code size? :)
[1] https://github.com/gfx-rs/gfx/issues/3117
[2] https://github.com/gfx-rs/naga
- flohofwoe 6y agoYeah it will be interesting to see whether a different set of libraries for the shader translation will cut down the size a bit. Of course in a "big" application like a 3D modeller or many games, 4..5 MB added to the exe size isn't critical, but for smaller applications it seems a bit excessive TBH. And if there's already an offline shader compilation step in a game-engine's asset pipeline anyway, why not do the whole backend-specific shader preprocessing there as well. Not a show-stopper of any kind of course ;)
- Jasper_ 6y agoAIR is not a documented or supported endpoint. MSL is the supported endpoint. You will hear from Apple's lawyers if toy reverse engineer AIR, as one of my colleagues knows from experience.
- monocasa 6y agoI thought AIR was just LLVM bitcode.
- raphlinus 6y agoIt is, but that won't do anything about overeager lawyers.
- kvark 6y agoLawyers know how to fight corporate entities. This tech doesn't have to be a corporate product. It could be a separate community repository somewhere, used only by those native gfx/wgpu users who opt into it.
- monocasa 6y agoLawyers have no problem fighting non corporate entities. If anything they thrice in that power imbalance.