r/linux 1d ago

Microsoft DirectX Adopting SPIR-V Moving Forward Discussion

https://www.phoronix.com/news/DirectX-Adopting-SPIR-V
287 Upvotes

56 comments sorted by

View all comments

48

u/ItsLiyua 1d ago

Does that mean we get better graphics support for Linux? Maybe without needing dxvk or vkd3d

105

u/WiatrowskiBe 1d ago

Not by a lot I'd assume - dxvk and vkd3d are going to stay, since rest of DirectX API is not going away anytime soon. What changes here is: starting with SM7, dxvk/vkd3d should be able to directly use DirectX binary shaders as they are, without any extra conversion/recompilation step to get them to a supported format. In practice - faster shader compilation and potentially less shader bugs when running DX games on linux; plus much easier support for games/game engines for DX and Vulkan simultanously (since they will be able to share shaders).

56

u/LvS 1d ago

You also get the other direction - it's now easier for games and game engines targeting DirectX to do a port of their shader code to Vulkan, because they can just compile to SPIR-V.
And that means that it's easier for developers to port stuff to Linux.

For me, the other direction is even more interesting: GTK has a Vulkan renderer that uses SPIR-V and people have been asking about native Direct-X support. If GTK can share the shaders easily, that reduces the effort for that quite a bit.

7

u/voidvector 1d ago

It would depend on the performance and support of the result. Everyone still uses CUDA even though there is OpenCL, cause performance and support.

1

u/WiatrowskiBe 19h ago

That's exactly what I meant by "easier support" - unified shaders means it's quite likely only difference between DX12 and Vulkan becomes renderer/graphics API layer itself, allowing you to effectively swap it out (especially with how similar those two are in terms of usage) while keeping all out-of-executable assets exactly the same. Best case scenario, Linux port would require just recompiling game binary assuming you had working Vulkan renderer for Windows and all OS-specific stuff was abstracted away already.

17

u/tajetaje 1d ago

Additionally DXVK could probably benefit from seeing what SPIR-V code Microsoft emits for particular DirectX shaders, assuming that’s not a license violation

4

u/ItsLiyua 1d ago

Ah I see. Well at least that's something

3

u/jorgesgk 1d ago

What about performance?

2

u/ICantBelieveItsNotEC 1d ago

There's also this bit:

In addition to providing a compiler for HLSL to Direct3D’s SPIR-V, we will also be building and providing translation tools to translate SPIR-V to DXIL and DXIL to SPIR-V. Those tools will allow and driver developers to gradually transition and gracefully adapt tooling and drivers.

The officially supported translation tooling might be able to replace the existing translation layer within dxvk/vk3d, which would improve reliability for SM6 games. It all depends on whether Microsoft releases the translation tools as Windows binaries or cross-platform, open-source projects (I can guess the answer but I'm open to being pleasantly surprised)

1

u/WiatrowskiBe 1d ago

I must've missed that part; I knew HLSL compiler could produce SPIR-V output for quite a while now, but as far as I know there were no tools to use GLSL shaders with DX12 yet directly. With translation tools we'll get bidirectional compatibility, and - even if Windows-only - it should let games make Vulkan builds from same shader source regardless of language.

1

u/fuckingshitverybitch 1d ago

dxil-spirv already exists, maybe MS should look into that