I'm trying to use an array of cbuffers for instanced rendering. In the shader I set up an array of two structs, like so:
struct MVPBuffer
{
float4x4 MVP;
};
ConstantBuffer<MVPBuffer> Matrices[2] : register(b0);
For creating the root signature, I do the following:
cbufferRange = CD3DX12_DESCRIPTOR_RANGE(D3D12_DESCRIPTOR_RANGE_TYPE_CBV, 2, 0, 0);
rootParams[0].InitAsDescriptorTable(1, &cbufferRange, D3D12_SHADER_VISIBILITY_ALL);
And when I create the constant buffer view, I tell it to use (sizeof(MVPBuffer) * 2). But when I render my mesh with two instances, and try to index the Matrices array with a variable assigned to SV_InstanceID, I only see the first mesh.