DX10: HLSL semantic must be the same?

Started by
3 comments, last by e5431 16 years, 8 months ago
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; };
Advertisement
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).
OK, thanks.
it makes sence to me.. more or less
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

jollyjeffers:
Arrrghhh!!!
Have no idea how did I miss it??? :)
Thank you for pointing this out.

This topic is closed to new replies.

Advertisement