News for hackers. Stuff that matters.
Re:Adding HLSL and DirectX Support to Clang and LLVM by rjeli on Friday March 11, 2022 @11:26PM (#30648990)
> DXIL, the intermediate representation used for DirectX 12, is based on LLVM-3.7 IR encoded as bitcode. For many reasons that have been discussed at length within the LLVM community in the past, this is not great, but it has already shipped and is the driver interface for all DirectX 12 GPU drivers.

ouch!

Re:Adding HLSL and DirectX Support to Clang and LLVM by mijoharas on Saturday March 12, 2022 @03:37AM (#30649972)
Could someone expand upon the reasons?

I can think of a few off the top of my head (it ties you to an old llvm version) but at the same time, presumably you need to reduce the size on the wire of this format so you need some kind of bitcode, and since it seems to be a binary interface for GPU drivers which can't be changing regularly the choice seems as good as any other?

Note: these are all naive uneducated assumptions on my part, as I'm not well informed in this area.

Re:Adding HLSL and DirectX Support to Clang and LLVM by TazeTSchnitzel on Saturday March 12, 2022 @04:15AM (#30650136)
LLVM IR is a complex, unstable, implementation-defined internal format used by LLVM with lots of quirks. While LLVM can consume LLVM bitcode made by previous versions of LLVM, it must be quite painful to use for any non-LLVM-based tooling. It's also not a portable format: the IR encodes many target-specific assumptions.
Re:Adding HLSL and DirectX Support to Clang and LLVM by saagarjha on Saturday March 12, 2022 @03:59AM (#30650073)
Your tooling needs to continue to support an old LLVM version that nobody really cares about. It’s generally not a great place to be in.
Re:Adding HLSL and DirectX Support to Clang and LLVM by ruph123 on Saturday March 12, 2022 @02:42AM (#30649731)
Can someone please explain why this is is problematic?
Re:Adding HLSL and DirectX Support to Clang and LLVM by pjmlp on Saturday March 12, 2022 @03:30AM (#30649935)
On most 3D APIs, with exception of OpenGL (and its Web variants), shaders are shipped as binaries, so if the driver expects another version that game won't play.
Re:Adding HLSL and DirectX Support to Clang and LLVM by hyperman1 on Saturday March 12, 2022 @03:25AM (#30649916)
I assume they can't upgrade to more recent LLVM versions, as the 3.7 bitcode is now found in a ton of published games. If they move to, say, 3.8, they need a LLVM 3.7 to 3.8 bitcode translator.

Basically, microsoft published someone else's unstable, unsupported API.

Re:Adding HLSL and DirectX Support to Clang and LLVM by my123 on Saturday March 12, 2022 @04:38AM (#30650239)
> they need a LLVM 3.7 to 3.8 bitcode translator.

LLVM IR provides upwards compatibility, that’s not what the issue is.

The issue is rather having your game binaries not work at all on older OS/driver releases when built with a newer LLVM version.

Re:Adding HLSL and DirectX Support to Clang and LLVM by pjmlp on Saturday March 12, 2022 @03:31AM (#30649939)
Apple does the same with LLVM bitcode for watchOS, but apparently Microsoft doesn't want to control the whole stack.