When setting constant buffers to a shader, does DirectX assignn it to the specific shader that is currently loaded, and remember it is for that shader? Or does it keep the same buffer applied through shader changes, and the buffer must be changed as well?
As an example, say I have two different vertex shaders, and each has it's own constant buffer, like the simplified snippet below.
To expand the answer above, I believe it works this way: (I'm 4 months into DirectX, so take this for what it is worth).
There are a number of constant buffer registers, to which you can bind constant buffers. These registers need to be bound for each shader stage explicitly.
What this means is that you bind the constant buffers to the shader stages, not the particular shader. You can bind one shader to the pixel stage, bind the constant buffer to a constant buffer register, draw, and then bind another shader to the pixel shader. If you don't explicitly change what is bound to a constant buffer register, it will remain bound.
Any renderstates stay set untill you explicitly set a new one. The fastest instruction is always the one you don't have to execute, and thats exactly how the DX runtime operates