If you use same semantic for SemanticName, then you need to increase number for SemanticIndex.
I also see that you are increasing InputSlot. This may be correct or not depending on how your data is layed out. If you really have 4 vertex streams (vertex buffers) then it's fine, but I assume that your instance transform is stored in one vertex buffer. Then you need to set same stream number to InputSlot in every instance binding.
assume that:
stream_number = 4;
You'll also need to set this stream:
// most probably offset_in_vertices will be 0 in your case
// vert_buf - contains your instrancing data
IASetVertexBuffers(stream_number, 1, &vert_buf, &stride, &offset_in_vertices);
Also while AlignedByteOffset is optional i suggest at least use D3D11_APPEND_ALIGNED_ELEMENT to specify that data go sequentially one after another.
so, setup code will look like this:
bindings[0] = {
// nothing changed
};
bindings[1] = {
"INSTANCE_TRANSFORM", // SemanticName
0U, // SemanticIndex
stream_number, // InputSlot
0, // AlignedByteOffset: zero because start of a matrix
// ...
};
bindings[2] = {
"INSTANCE_TRANSFORM",
1U, // SemanticIndex
stream_number, // InputSlot
D3D11_APPEND_ALIGNED_ELEMENT, // or 16 (4 float32) AlignedByteOffset
// ...
};
bindings[3] = {
"INSTANCE_TRANSFORM",
2U, // SemanticIndex
stream_number, // InputSlot
D3D11_APPEND_ALIGNED_ELEMENT, //or 32, AlignedByteOffset +4 float32
// ...
};
bindings[4] = {
"INSTANCE_TRANSFORM", // SemanticName
3U, // SemanticIndex
stream_number, // InputSlot
D3D11_APPEND_ALIGNED_ELEMENT, // or 48 AlignedByteOffset +4 float32
// ...
};
Then your vertex shader input structure will look like this:
struct VS_IN
{
float4 Pos : POSITION;
float4 r0 : INSTANCE_TRANSFORM0;
float4 r1 : INSTANCE_TRANSFORM1;
float4 r2 : INSTANCE_TRANSFORM2;
float4 r3 : INSTANCE_TRANSFORM3;
};
Or like this:
struct VS_IN
{
float4 Pos : POSITION;
row_major float4x4 inst_mat : INSTANCE_TRANSFORM;
};