I was wondering what the InputAssembler does if the size of the bound buffers does not match the vertex count of the Draw() call.
I've seen the example at http://msdn.microsoft.com/en-us/library/windows/desktop/bb232912%28v=vs.85%29.aspx where the InputAssembler is used without any buffers, however, the vertex shader input is simply defined as
struct VSIn
{
uint vertexId : SV_VertexID;
};
and I understand that SV_VertexID is filled in by the InputAssembler.
But what if I define the input as follows?
struct VSIn
{
uint vertexId : SV_VertexID;
float4 color : COLOR;
};
I tested this and it appears that input.color always returns the default value float4(0, 0, 0, 0). Is this expected behavior or might other drivers produce different results?
A more elaborate example: If I bind a buffer with ten positions to slot 0 and a buffer with five colors to slot 1 and render ten vertices, will the first five vertices have the color as defined in the color buffer and the other five have color zero? I tested this as well and this seems to be the case. Again, Is this expected behavior or might other drivers produce different results?
And even if i can to this, should I?
Background: I have "regular" vertex data which I bind to slot 0. In some (rare) cases I have additional data which I bind to slot 1. At the moment if I don't have additional data I will still generate a secondary buffer of equal size as the "regular" buffer filling it all with zeros. I was wondering if this is necessary or if I can simply set the secondary buffer to null and let the InputAssembler do the work.
Bonus question: Can I change the default value the InputAssembler uses if there is no buffer value?