I've heard something about instancing and understood it's useful for drawing the same object many times with slight changes. It's faster because you call the draw function once per frame and update the buffer (in this case the instance buffer) once per frame too while with constant buffers, for example, if you need a world matrix you have to update your constant buffer once per object.
But if I have only one object, would instancing be faster (or at least as fast as) using a constant buffer? With instancing, you have to call only an update buffer function (for the vertex-instance buffer) while with CB you need two calls: one for the vertex buffer and one for the constant buffer.
Another question about instancing:
Since I have to update the instance buffer once per frame, I need to create it with
DYNAMIC_USAGE and with a byte width representing the maximum number of objects I can draw with one call. For example, if I want to pass a matrix, I need
insBufferdesc.bwitdh= sizeof(matrixtype)*maxNumObjs. Is this right? Given that
maxNumObjs is 20 and I want to render only 10 objs, I've should just update the first 10 matrices of the buffer and call
drawInstanced(..., 10). Will I get some error if I don't use all of the buffer?