gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 549 forks source link

Make spirv-cross optional #3641

Closed kvark closed 3 years ago

kvark commented 3 years ago

SPIRV-Cross is a big foreign dependency, which often cause issues, such as https://github.com/denoland/rusty_v8/issues/465 and #3389, #3117, #2520, and many others. Previously in #3445 and #3520 we implemented Naga code path as an alternative, but hidden behind an optional feature. Now it's time to flip the table and say that Naga is permanent, but SPIRV-Cross is optional until completely phased out.

Most of the changes here are from re-routing the main shader creation logic from using SPIRV-Cross types to using Naga types. The "cross" stuff is just getting derived from Naga types if necessary.

The change only applies to Metal and OpenGL backends so far. D3D will come on board once https://github.com/gfx-rs/naga/pull/408 is operational.

Note: it's going to be a long while for Naga to mature, most users need to keep the "cross" dependency enabled for now! Even the included examples don't run on Naga yet, since the SPIR-V generated by glslang is quite specific, and Naga's SPV frontend doesn't like it yet.

kvark commented 3 years ago

Thank you for the review! Let's keep the option to enable it by default on the table. I'm still thinking about this. bors r=grovesNL

bors[bot] commented 3 years ago

Build succeeded: