graphicsguy

@graphicsguy@programming.dev
0 Post – 2 Comments
Joined 1 years ago

Also if you branch on a GPU, the compiler has to reserve enough registers to walk through both branches (handwavey), which means lower occupancy.

Often you have no choice, or removing the branch leaves you with just as much code so it's irrelevant. But sometimes it matters. If you know that a particular draw call will always use one side of the branch but not the other, a typical optimization is to compile a separate version of the shader that removes the unused branch and saves on registers

As a graphics programmer in the games industry, it's always exciting to me when people discover how much fun all this stuff is