why can't shaders come precompiled?
buy a console then
>>747518170>have 1200 different GPU/CPU configurations>they all compile shaders differently>anon on some backwater mongolian basketweaving forum bitches about precompiling when the alternative is a non-stop stutter festGame devs are right. Gamers are entitled and stupid
>>747518170why can't splines come pre-reticulated?
>>747518170Because jeets
>>747518170Notice that some games (like Doom) don't need to do this. That's because their engines were developed by competent rendering engineers and therefore don't generate different shader pipelines based on every value an artist might tweak. They use a few ubershaders instead. So it's a completely solvable problem.Putting that aside, if a game does ship 3943243245342532 separate shader pipelines then there's no getting around the need to compile them. That's because the game can only ship them in an intermediate form that still needs to be converted into the code your GPU can run.Although if you play on a steam deck or steam machine then you'll usually get pre-built shaders for each game from valve and skip the wait.
>>747522469>Doom uses an open source renderer>competentPick one.
>>747518170>>747522469Why do I need to recompile every time I update my drivers?>pre-built shaders for each gameHow does this work? In fact, why does this work if I need to compile shaders every driver update on games that don't pre-build their shaders?
>>747520389this isn't actually trueThere are generally ~12 different real hardware capability configs. The shaders dont give a fuck if you're running a GTX 480 or an RX9070. What matters is the high level feature stuff like when you open CPU-Z and see all the shit the CPU does and doesnt support.HLSL shaders are inherently programmatically neutral, the GPU driver takes care of the rest.User compile time shaders mostly is only saving the game maker a couple hours and $10, basically, but that's why they do it.
>>747525570Shaders are built to work at the driver level. When the driver updates, they no longer work with said driver.
>>747525465I'm not sure what you mean. Recent versions of idtech aren't open source.>>747525570>Why do I need to recompile every time I update my drivers?This seems to just be how the Windows drivers of the major GPU vendors have decided to do it. Compiled shaders are cached, but that cache is only valid for a specific driver version.I'm not privy to the details of why NV and AMD have done that way. If I had to guess, they want the freedom to change details about how shaders are built and stored.>How does this work?Just install a game and usually you'll see it downloading a "shader pre-caching update" too.There are only two hardware configurations to worry about and Valve controls the OS and driver, so they can just do whatever and decide for themselves whether/when a recompile or redownload is needed.
You compiling your own shaders is free for the dev.
>>747526531That doesn't sound quite right.A programmer writes HLSL and then runs a tool which compiles it into an intermediary format (DXIL, DXBC, or SPIR-V). That intermediate format ships with the game.When the game loads that intermediate format and tries to use it, the driver then needs to convert it to a different format that the hardware can understand. This will be different for different architectures (Pascal, Turing, Ampere, RDNA2, RDNA4, whatever).If you're writing a console game then you can, and do, ship the actual final code that the hardware uses and there's no extra step.
>>747526779>I'm not sure what you mean. Recent versions of idtech aren't open source.Vulkan is. Vulkan is cancer, and it nearly guarantees a game will flop because gamers can smell the Progesterone and body odor on it.
>>747527108Mate if the HLSL is shader model 5.0 it works on all GPUs that can operate SM5.0 or newer.A pixel shader made on SM5.0 will function on a GTX 480, a Radeon 7950, and everything in between.We're talking about fucking ancient hardware here 15+ years old now.
>>747520389All I know is we never had to deal with Compiling Shaders bullshit pre-2015, even though the thousands of different CPU/GPU configurations issue was always there.So I'm far more inclined to believe this is devs laziness/incompetence rather than something that actually needs to be done now.
>Reticulating Splines
>>747520389And yet Steam have no issue doing that on Linux.
>>747518170i understand why it has to be done but i wonder if it can be done when the game itself is downloading and installing, would rather wait +20 minutes for install than launch a game and have to wait
As graphics have become more detailed and realistic, the shaders used to render them have also become more complex, which means that they require more advanced GPU hardware to execute efficiently. This has led to a greater need for shader compilation, as it allows developers to take advantage of the capabilities of modern GPUs.
>>747526531GPUs don't execute HLSL
>>747520389I tried the alternative and it was absolutely aids beyond belief. With almost every interaction the game would stutter, with every new item equipped and every change of lighting it would omegastutter. It's better if the shaders are compiled in advance.
>>747528062you seriously think that all gpus, Nvidia, Amd and Intel, natively run dxbc?
>>747527635You're confused.Vulkan is a specification, an interface. It doesn't have any code by itself, so it can't be open (or closed) source.If you play Doom Eternal on Windows, the code on both sides of that interface (game and driver) is closed source.Vulkan and D3D12 each have their own quirks. The choice of one or the other is mostly a preference of the engineer. Most AAA games choose D3D12 but that's mostly so that they can reuse most of that code for the Xbox version.I'm not a fan of the gameplay of the new Doom games but they're very well programmed and run great.>>747528062Let's say you write some HLSL that's compatible with SM5.0, and you build it with dxc.exe and you end up with my_shader.fxc which contains SM5.0 DXBC bytecode. You ship that DXBC file with your game.When your game starts up and tries to use that shader, the driver must first take that DXBC and convert it to something the GPU hardware can work with.>>747528317Shader stutter was sometimes an issue even in older games, although definitely less so than nowadays for a few reasons>older APIs like DX11 were higher-level which gave drivers more freedom to do some magic tricks to speed things up>shaders were simpler>older bytecode formats like DXBC were simpler and quicker to convert to the hardware format compared to DXIL/SPIR-V>games were more restrained in the number of shaders they used, instead of exposing countless options to artists that internally result in separate shaders being generated