What is the purpose of semantics?
if I had a vertex layout like this:
struct VS_Input
{
float4 position : COLOR;
float4 color : POSITION;
};
Would it actually matter that I reversed the semantics on the two members?
If I have to send Direct3D a struct per vertex, why couldn't it just copy my data as is?
If I provide direct3D with a vertex with a layout that doesn't match that of the shader, what will happen? for example, if I pass the following vertex into the above shader?
struct MyVertex
{
Vec4 pos;
Vec2 tex;
Vec4 col;
};
In the D3D documentation, it said that a warning will be produced, and that my data will be "reinterpreted"
Does that mean "reinterpreted" as in reinterpret_cast<>? like, my shader will try to use the texture coordinates and half of the color as the color in the shader? or will it search my vertex layout for the element that matches each semantic and shuffle the input into the right places to make the shader work?
And if the above is not true, then why does D3D require an explicit vertex layout?