Suppose i have a following HLSL vertex shader fragment with constant buffers:
cbuffer matrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
cbuffer matrixBuffer2
{
matrix worldMatrix2;
matrix viewMatrix2;
matrix projectionMatrix2;
};
Variables from constant buffers are then used in acctual vs function, so i need to set them.
And in C++ i declared following struct:
struct MatrixType
{
D3DMATRIX world;
D3DXMATRIX view;
D3DXMATRIX projection;
};
In my app on initialization i create constant buffer pointer ID3D11Buffer*.
Later on per frame method i update constant buffer, that is i map buffer, update subresource, unmap buffer, and set buffer in vertex shader.
Everything is fine when i have just one constant buffer, but here is my question.
How does directx diffrentiate between buffers ? For example i want to set worldMatrix2 how to achieve this ?
I read msdn reference but i got no answer.
Is it allowed to have two or more constant buffers with same size and elements ? Are they stored in continuous piece of memory, so when i set buffers they are set in order they are declared in HLSL ?