Vertex shader needs an input structure in order to request the right data for each vertex. In the vertex input structure, semantics are essential, if I have:
struct vIn{
float4 objPos : POSITION;
float4 texcoord : TEXCOORD0;
}
this means: fill vertex with vertex obj position, texcoord with uv coords of uv set 0.
In the vertex output, semantics are not used in a strict way. Let’s say for example that I have as vertex output structure:
struct v2f{
float4 ClipPos : SV_POSITION;
float4 texcoord : TEXCOORD0;
}
this doesn’t mean that texcoord MUST be filled in with uv coords of uv set 0. I mean, it should, given the variable name and the semantic used, but I can also fill that value with everything that I want the rasterize interpolates from vertex to fragment. Is this right?
On the other way, I DO NEED to output Clip Space position in ClipPos, because of the semantic SV_POSITION. So, in other words, SV_POSITION is the only semantic in vertex output structure that oblige the content of the variable. Is this true? If yes, are there any other shader semantic that oblige the content of the variable when used in the vertex output structure?