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

What prevents to precompile shaders on windows, in a similar way it's done on those other platforms?


Technically, nothing. It's perfectly possible to precompile shaders on Windows - it's just not convenient or logical for most PC users.

On console, precompiling makes sense because you know exactly what hardware a user will have and you can optimize for one or two sets of hardware. The effort required to automatically package and download these shaders for users on their first load is worth it, so it's a viable fix to shader stutter in games where it crops up.

On Linux, precompiling makes sense because shaders take an extra long time to process due to the DirectX -> Vulkan translation. Since this causes stutter in every game, a precompilation step is pretty much mandatory for everything but conveniently also solves the UE5 stutter issue at it's roots.

On PC, it's basically a maelstrom of worst case scenarios. You don't know what hardware a user will have, so you can't package precompiled shaders. You're not translating shader calls so you have to rely on each version of DirectX's specific DXIL features instead of the unified Vulkan 1.2+ SPIR-V that you get from DXVK. And of course, even if you did get a magic "Compile the Shaders!" program working most users wouldn't bother since they're impatient. Some games try adding optional precompilation screens, but I wager most people just skip them when given the opportunity.


Thank you for the explanation! Honestly, it feels like precompiling all the shaders should be done during loading the assets initially, with the in place option being optional.


I thought that it could be done at install time.




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

Search: