Original Post
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.
Now, if I then swap back to Shader1...
Does DirectX remember to use CBuff1, or do I need to reset it 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.
ID3D11Device* Device;
ID3D11DeviceContext* DevCon;
ID3D11VertexShader* Shader1;
ID3D11VertexShader* Shader2;
ID3D11Buffer* CBuff1;
ID3D11Buffer* CBuff2;
//initialization code
//Render Routine
DevCon->VSSetShader(Shader1, NULL, 0);
DevCon->VSSetConstantBuffers(0, 1, CBuff1);
//Draw stuff with shader1
DevCon->VSSetShader(Shader2, NULL, 0);
DevCon->VSSetConstantBuffers(0, 1, CBuff2);
//Draw stuff with shader2
Now, if I then swap back to Shader1...
DevCon->VSSetShader(Shader1, NULL, 0);
Does DirectX remember to use CBuff1, or do I need to reset it as well?