Open cwfitzgerald opened 11 months ago
Firefox can't incorporate this code into our code base. The cost and risk of bringing this in makes FXC preferable for us for the time being.
In the long term, Naga could grow a DXIL backend, and that would be fine for Firefox.
Updated the above plan and pros/cons to reflect recent discussion. Aiming for this potentially being the default native-only solution.
Not sure if this is useful or not anymore, but I've recently updated my Rust bindings to spirv-to-dxil to build with just cc
.
We're not really pursuing it actively anymore due to some priority changes, but I'm very glad this exists, especially building without meson
!
HLSL Compilation Problem
HLSL compilation to DXBC/DXIL is quite a pain right now. We have two main options in HLSL compiler and they both have significant downsides.
FXC (aka D3DCompiler)
Pros:
Con:
DXC (aka DXCompiler)
Pros:
Cons:
Of these, the cons of DXC are show stoppers for many people while FXC's tradeoffs are bad, but tolerable.
spirv_to_dxil
I was recently pointed to the work of spirv-to-dxil. This is a standalone library that's part of mesa which exposes a single function that transpiles spirv directly to dxil. https://gitlab.freedesktop.org/mesa/mesa/-/tree/main/src/microsoft/spirv_to_dxil
I have yet to run it, but I am optimistic that it could at least partially help our shader compilation woes, at least short to medium term. Some pros, cons, and things to be investigated as I see them.
Pros:
Pros (needing investigation):
Cons:
cc
.DXIL naga backend
If we can get a fully functioning DXIL naga backend, this would be the most ideal situation, but it is a significant amount of work which will take a long time to get fully operational. There is reasonable reason to think that DXIL does not need to be optimized as vendor compilers will happily do further optimization paths, similarly to how our spirv-backend does not optimize and we've experienced no major issues.
Plan
We should investigate this option as a native-only option, feature flagging it out for firefox like we do DXC right now. If the investigation proves that it does what it says on the tin, and we see success, we should enable it for default windows workflows.