DX10: HLSL semantic must be the same?
Hi.
Here is a piece of code from Tutorial 10.
Do semantic names have to be the same?
I mean, Tex parameter in the first structure has marked as TEXCOORD0 and the same one in the second has TEXCOORD1 semantic name.
Isn't more common to use the same semantic for the same values?
And another question: why it works fine? :)
struct VS_INPUT
{
float3 Pos : POSITION; //position
float3 Norm : NORMAL; //normal
float2 Tex : TEXCOORD0; //texture coordinate
};
struct PS_INPUT
{
float4 Pos : SV_POSITION;
float3 Norm : TEXCOORD0;
float2 Tex : TEXCOORD1;
};
If you use the debug layer, I'm guessing you'll see errors/warnings about mismatches. The reason it works is because D3D10 does shader linkage based on registers, not on semantics. The semantics are just there to separate system semantics from user semantics and to assist the user to make sure their shader signatures line up correctly (which is only checked in the debug layer).
Semantics are used to perform matching - the exact name of the semantic doesn't matter unless it's a system generated or interpreted value (starting SV_).
Your code fragments are showing two input declarations; what you actually want to match is the output of the VS and the input of the PS - it's connecting stages that must have matching linkage and its perfectly possible for the input to one stage to be quite different to the input into the next stage.
hth
Jack
Your code fragments are showing two input declarations; what you actually want to match is the output of the VS and the input of the PS - it's connecting stages that must have matching linkage and its perfectly possible for the input to one stage to be quite different to the input into the next stage.
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement