I can't seem to find a conclusive answer to this anywhere, so perhaps someone here can help. I am building a vertex shader (HLSL Shader Model 4.1) for Direct3D 11, and to reduce the number of draw calls I need to do, I want this shader to execute either of two branches, based on a flag.
Pseudo code:
if (flag)
calculate corners of axis aligned quad
else
calculate corners of rotated quad
end if
I keep reading that shaders execute both branches and select the appropriate result afterwards (which means it's costly and that using two different shaders (and more draw calls) might be better after all), but that this might be different in newer shader models (where only the relevant branch will be executed, meaning I get the flexibility practically for free). Which is the case for Shader Model 4.1?
When it comes to pixel shaders, apparently branches are executed per groups of pixels (which might affect what branches are executed), but how would this work in a vertex shader?