开发者

directx/HLSL what are input and output semantics for?

开发者 https://www.devze.com 2023-02-20 03:51 出处:网络
i was wondering what those input and output semantics in HLSL are for? i.e. why do i have to write that TEXCOORD0;

i was wondering what those input and output semantics in HLSL are for? i.e. why do i have to write that TEXCOORD0;

struct VS_OUTPUT 
{
   float2 tc : TEXCOORD0; 
};

when the开发者_JAVA百科 type and the name are already given?


Semantics let the shader know where to read or write data from. They correspond to parts of the vertex structure or certain values.

In your example above, the value of tc comes from the first texture coordinate component.

For info on semantics and what they mean, check here: http://msdn.microsoft.com/en-us/library/bb509647(v=vs.85).aspx

In the vertex shader, the data will be coming from the FVF or vertex declaration.

0

精彩评论

暂无评论...
验证码 换一张
取 消