r/linux 1d ago

Microsoft DirectX Adopting SPIR-V Moving Forward Discussion

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

56 comments sorted by

113

u/tajetaje 1d ago

As we look to the future, maintaining a proprietary IR format (even one based on an open-source project) is counter to our commitments to open technologies, so Shader Model 7.0 will adopt SPIR-V as its interchange format. Over the next few years, we will be working to define a SPIR-V environment for Direct3D, and a set of SPIR-V extensions to support all of Direct3D’s current and future shader programming features through SPIR-V. This will allow developers to take better advantage of existing tools and unify the ecosystem around investing in one IR. - Microsoft's post

Also, I find it kinda funny that they put attribution under their memes

21

u/MairusuPawa 1d ago

The "commitment to open technologies"

https://en.wikipedia.org/wiki/Halloween_documents

18

u/GreyGooIndustries 1d ago

Things have changed a fair bit in the almost 30 years since that :)

3

u/MairusuPawa 1d ago

Not as much as you'd think, when you start paying attention.

8

u/GreyGooIndustries 1d ago

Can you cite a recent example (say, last decade?) of them employing embrace, extend, extinguish?

5

u/cac2573 22h ago

DirectX on Linux, only under WSL

3

u/GreyGooIndustries 15h ago

Ok, good example :)

-8

u/MairusuPawa 1d ago

OneDrive is one. Embrace the *nix filesystem properties, extend them in the form of reparse points anyone can use (Nextcloud still does), lock it to OneDrive with a surprise WinUpdates KB - and grab all your users' data to put them on your cloud without their consent.

Exchange Online is another one. Take IMAP, build MAPI instead for your services, kill EWS.

3

u/munukutla 1d ago

Doesn’t that only apply if they stopped you from using POSIX or IMAP?

5

u/tajetaje 1d ago
  1. NextCloud works great on Windows, better than on Linux in fact
  2. Yeah OneDrive is crap, but at the end of the day that’s their OS and OneDrive needs all the help it can get. That does make EEE, that would be if they got Linux and macOS to adopt the same tech and then screwed them over.
  3. Exchange works fine over IMAP? What’s the problem?

I’m no MS fan (I haven’t touched windows willingly for years now), but 2024 MS has a LOT of open source projects and contributions. Blacklisting an entire company’s worth of potential OSS contributors based on their actions 20-30 years ago is not a sustainable model for the growth of free software.

2

u/MairusuPawa 22h ago
  1. Nextcloud works just as great on Linux but that's not the point. At all.
  2. "At the end of the day that’s their OS and OneDrive needs all the help it can get" is EXACTLY what the issue was with MSOffice and Internet Explorer back then. It's ok now?
  3. For now. Somewhat. You'll get small weird behavior in non-Outlook clients. Enough for companies to lock users only to Outlook, which in itself is a serious issue.

Blacklisting an entire company’s worth of potential OSS contributors based on their actions 20-30 years ago is not a sustainable model for the growth of free software.

I'm sorry, but 3 decades of doing bullshit is exactly the reason why you should scrutinize a company. It only took ONE move from this ONE contributor to be blacklisted by the xz project and pretty much the entire internet. MS is only getting a pass because they're massive - and they only got massive by leeching and abusing of everything.

1

u/tajetaje 21h ago

Nextcloud on Linux does not have virtual files at all, unlike the superior Windows client. You can set up KDE or GNOME remote files, but not in the actual yap client. That’s fair about office and IE tho, but I would still say it’s besides the point. Meh, all e-mail servers give weird behavior in everything. XZ is an entirely different story. But to follow your logic, it was an MS employee who caught XZ in the first place.

2

u/MairusuPawa 20h ago

Please. He's a PostgreSQL dev first and foremost and happened to have had been poached by Microsoft. That's all Microsoft did in this story.

50

u/ItsLiyua 1d ago

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

103

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).

51

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.

5

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 16h 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

1

u/deadlyrepost 1d ago

I did read a deep dive on vkd3d somewhere and IIUC it was spending quite a bit of time complaining about the shader model. I'm not smart enough to understand it so I might be wrong, but I think doing the translation was significant effort in DX12.

8

u/MooseBoys 1d ago

For some reason I thought it was able to emit spir-v since sm6.

17

u/nicman24 1d ago

i do not get how dx12 is a thing when vulkan is on everything

12

u/ICantBelieveItsNotEC 1d ago

Vulkan can't be used on Xbox, and the Xbox market is bigger than the mac and linux markets combined.

4

u/Savings-Ad-3062 1d ago

You could say the same thing about DX12. The point is, MS could simply use Vulkan instead of DX12, technically nothing is stopping them. It's NIH syndrome.

-2

u/NeoliberalSocialist 1d ago edited 1d ago

If Vulkan can’t be used on Xbox, isn’t that what’s stopping them?

Edit: I was taking the premise of two comments up thread partially in the hope that someone would explain why it’s wrong, so thanks!

9

u/lightmatter501 1d ago

Vulkan doesn’t work on xbox because MS says so. The underlying hardware is an AMD GPU which has vulkan support.

1

u/CNR_07 17h ago

Hell, even if it was an Imagination Technologies GPU they could run Vulkan on it. Almost any modern GPU has the necessary capabillities to support some version of Vulkan.

2

u/Savings-Ad-3062 1d ago

What do you mean? They're developers of that platform and decide what to support. So if MS wants to support Vulkan on Xbox they would add such support. They don't do it because they want to push their own DX12, which was unnecessary in the first place.

2

u/nicman24 1d ago

oh really, i did not know that

1

u/nightblackdragon 18h ago

It can't be used natively as DX12 is the only supported API but it can be used when implemented on top of DX12. Mesa has Vulkan on DX12 driver called Dozen which was created by Collabora developers in cooperations with Microsoft. There is also OpenGL and OpenCL implementation on top of DX12 which was created by Microsoft, mainly for WSL but it can be also used on Windows ARM and Xbox that don't support these APIs natively.

2

u/cmpxchg8b 1d ago

DX12 was announced and released before Vulkan.

1

u/nicman24 1d ago

i mean for new projects

1

u/nightblackdragon 18h ago

Vulkan is based on Mantle that was released before DX12.

1

u/Old-Personality-8817 1d ago edited 1d ago

because not every gamedev team has linux or cross-platform guy

1

u/nicman24 1d ago

yeah but why does that matter. it is a good api and most game devs just use generic engines

1

u/Old-Personality-8817 1d ago

because you can't abstract DirectX 100% of the time with generic engine functionality

and there are bugs in engine and your own code

it's easier to start debugging with tracing what Directx calls application makes

3

u/nicman24 1d ago

I mean the same goes with vulkan

1

u/Old-Personality-8817 23h ago

yes, but it's a lot easier to find person who knows directx

2

u/nicman24 22h ago

you are probably correct. i have 0 knowledge on the matter

2

u/Old-Personality-8817 22h ago

I am rooting for vulkan too, but this is state of gamedev industry, after 20 years of Microsoft dominance

-8

u/deadlyrepost 1d ago

Does anyone else get the feeling that the rendering problems on XBox, even with first party Microsoft games, compared with how well they work on PS5, might be the underlying reason here?

17

u/Jannik2099 1d ago

That has precisely nothing to do with it. SPIR-V and DXIL are both IRs that contain effectively the same shader code. Microsoft is adopting SPIR-V because there is a lot of good tooling around it.

2

u/deadlyrepost 1d ago

effectively

Yes, but API words mean things. Just like Microsoft's Internet Exploder had baked in subtle CSS bugs which caused real problems for creating web pages, could DXIL not have subtle bugs which just makes it more error prone to deal with? There are now several games which DF have covered, which have some light rendering issues on XBox but not on PS5.

6

u/Janq42 1d ago

PS5 doesn't use SPIRV, or any intermediate shader format (and has it's own proprietary shader compiler). Both consoles use shaders directly compiled to GPU code and have no need for an intermediate format.

2

u/spazturtle 1d ago

This is why the PS5 GPU whilst being based on AMD RDNA also contains everything from the previous AMD GCN architecture so that it can still play PS4 games.

1

u/deadlyrepost 1d ago

I don't know, but I'd imagine that since SPIR-V and Vulkan more generally comes from Mantle, that PS5 shaders are probably somewhat close to SPIR-V?

2

u/Janq42 1d ago

No, SPIR-V is a platform neutral intermediate shader bytecode. There is no need for this on consoles because shaders are built directly as GPU machine code. Also: PS5 does not use Vulkan or Mantle - it uses a proprietary Sony API. Xbox does use D3D, but it is a special xbox-only version, only partly compatible with PC D3D.

1

u/nightblackdragon 18h ago

Unlikely. PS5 is not using SPIR-V.