Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

they must have a shader recompiler infra, because all the shaders are shipped precompiled directly for the platform on consoles. so it's a good bit more than what wine does, at the very least in that regard.


Very true. I suppose Wine has to do this as well for Direct3D?


For PC games and applications, Direct3D shaders are supplied in a high-level shader language (not-so-coincidentally called High-Level Shader Language), given that there is no standard GPU architecture on Windows PCs. Wine does still need to translate that to the target graphics library, as well as all the drawing calls themselves, though.

There are also some considerations regarding texture compression, I believe, which is a function usually performed in dedicated GPU hardware, and not all GPUs support all formats.


Not a developer in the field, but I believe generally the HLSL isn’t packaged in the game. Instead an intermediate format called DXIL is produced at build time from the HLSL, and that’s what is packaged.


Ah, sorry, then I carried over an assumption from OpenGL (where GLSL is actually what's packaged, or at least was a couple of years ago when I last looked at it).

In any case, that intermediate representation is probably still easier to compile to hardware-specific code, especially if the hardware has a Direct3D implementation. That's what it's designed for, after all!


OpenGL also supports SPIR-V, a similar intermediate format, since 2017 (it came into core in OpenGL 4.6).


Technically true but if you are going to use SPIR-V you might as well jump over to Vulkan. Do you know of any OpenGL games that actually ship SPIR-V? I can imagine it getting used in CAD applications with huge legacy OpenGL code bases but for Games OpenGL+SPIR-V doesn't really have a good use case.


I guess not a lot of games really use OpenGL at all anymore? But I haven't gone around and tried making a survey. :-)


No, you can’t ship precompiled shaders for desktop easily because there’s no single backend (GPU) to compile for.

Everyone ships either shader code or intermediate languages instead.


Yes, that used to be the weakest part of Wine. Luckily, we have DXVK now.


DXVK doesn’t deal with pre compiled shaders afaik. It needs them in DXIL or HLSL to function.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: