Branch vs Texture Read
In shaders, which one is usually cheaper, branching (if, etc) or a te开发者_StackOverflow社区xture read?
Texture read, usually. Branches are typically prohibitively expensive. Of course, so are anisotropic texture reads from extremely large textures that don't have mip-maps, so you need to profile it accordingly.
Btw, you can also use the [predicated] directive in some instances.
EDIT: I should mention the obvious - in your output, look at the numbers to see if you're sequencer-bound or texture-bound.
精彩评论