Closed sergmister closed 3 years ago
"cross" enables SPIRV-Cross dependency. If you depend on wgpu
with the default features disabled, you'll have a pure-Rust dependency without SPIRV-Cross.
It's surprising to me to see wgpu
taking 10% of your bloat, given that it's just a wrapper. I wonder if there is anything we can change to compile to less code.
Naga is only built with features that are requested by wgpu and gfx-rs backends.
As for "unused backends", would that be OpenGL for you? I can see that it accounts for 1.6% of bloat in your app. That's not a lot. So even if/when we have an option to disable the backends, it's unlikely going to help you much.
If you depend on wgpu with the default features disabled, you'll have a pure-Rust dependency without SPIRV-Cross.
According to cargo tree
, spirv-cross is also a dependency of gfx-backend-dx12
and gfx-backend-dx11
.
Right, these to can't switch to Naga yet. We are working on this. You can get away from SPIRV-Cross on macOS and Linux so far.
So to be clear is there a way to build without some of these dependencies, and if so, how?
@sergmister there is no way to build without SPIRV-Cross on Windows right now. I suppose that would be one way to push for an ability to disable backends at compile time: to make a build that only works on Vulkan/Windows, and thus doesn't depend on SPIRV-Cross. But honestly, I'd rather ramp up our Naga development to generate HLSL and throw out SPIRV-Cross in a more natural way.
What about Linux?
I answered about linux in https://github.com/gfx-rs/wgpu-rs/issues/841#issuecomment-813108902 Basically, you can disable the "cross" feature there.
Due to the upcoming gfx-hal rethinking, I'm going to close this for now and we can re-evaluate after it.
A small program build with standard release options is 8.4 MB. Running cargo bloat yields:
Is there a way to build a project without including spirv_cross, naga, wgpu_core, unused backends, etc. This would help make binaries smaller and linking faster.