Efficiency of branching in shaders

前端 未结 5 739
感动是毒
感动是毒 2020-12-07 22:58

I understand that this question may seem somewhat ungrounded, but if someone knows anything theoretical / has practical experience on this topic, it would be great

5条回答
  •  执念已碎
    2020-12-07 23:27

    I don't know about the if-based optimizations, but how about just creating all the permutations of the texture-lookups that you think you'll need, each its own shader, and just use the right shader for the right situation (depending on which texture lookups a particular model, or part of your model, needed). I think we did something like this on Bully for Xbox 360.

提交回复
热议问题