Ok,
so i have a shader which expects two constant buffers, but when I use
ID3D11DeviceContext::UpdateSubresource
And I set the SubResource to 1 (the second buffer), then I’m warned (error…):
D3D11: ERROR: ID3D11DeviceContext::UpdateSubresource: DstSubresource index (1) out of range, must be less than 1. [ RESOURCE_MANIPULATION ERROR #287: UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE ]
I understand the error, but just not why it appears, i.e. why it happens?
Thank You
SubResource is designed for TextureArrays/Mipmaps, so you can for example read/write a specific mip slice. In case of buffers the SubResource is always zero (since it’s just more or less raw data).
You can find some info about SubResources here
So you can use 0 to update each of your constant buffer, then you need to assign each constant buffer to the shader slot, using PSSetConstantBuffers (and for each stage where it is needed), then choose the startslot accordingly (which should match the register number in your shader).