This question already has an answer here:
I've heard a lot that in shader development, you absolutely need to avoid branching and so if statements.
But why? Does this have a real impact on performances on old and modern hardware or is it more a case by case choice depending on your scenario?
When possible, it's better to use preprocessor macros but when it's not, what can we do?
What is the purpose of using
branch attributes? Are there other solutions available?