The author dives into the misconception about conditional branching in GPUs, using specific shader code examples to show that replacing ternary operations with arithmetic operations is not as efficient as believed. They explain that conditional moves, not branches, are used in GPU code for small register moves. The detailed examination of machine code generated by AMD and Microsoft compilers demonstrates this concept. The author urges readers to correct those who suggest unnecessary optimizations based on incorrect assumptions. The insightful article dispels a long-standing misinformation in computer graphics aficionado circles, shedding light on how GPUs actually function.
https://iquilezles.org/articles/gpuconditionals/