Hacker News new | ask | show | jobs
by smallstepforman 757 days ago
I’m suprised to see that Ubershaders still exist, most game engines have settled on a set of fit-for-purpose custom shaders with almost no conditionals (for performance reasons), which is the opposite of UberShaders.
2 comments

Why would a lack of conditionals remove the need for uber shaders..? Or why would the presence of conditionals cause a need for uber shaders? How are these connected?

It's common to have many shader variants exactly because you want to avoid 'if' statements; conditionals are turned into shader-compile-time options. Uber shaders are about turning those compile-time options back into runtime options to have a fallback shader to run while the right shader variant is being compiled.

The wins here are probably not as large as one might think https://advances.realtimerendering.com/s2016/s16_ramy_final....

The fact is that a branch that the whole warp takes or does not take is relatively cheap on modern hw. Even if it is per thread dependent.