Jump to content
  • Advertisement
Sign in to follow this  
janta

HLSL / vertex shader output semantics

This topic is 4240 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello GDNet, I was wondernig about the importance of fields semantic int a vertex shader output struct like:
struct VS_INPUT
{
    float4 vPosition : POSITION;
};

struct VS_OUTPUT
{
    float4  vPosition : POSITION;
    float4  vDiffuse  : COLOR;
};

VS_OUTPUT VS_Main(const VS_INPUT in)
{
    // whatever you like
}

float4 PS_Main(const VS_OUTPUT in)
{
    // whatever you like
}
While I understand how critical it is for the vertex shader to know the semantics of each field in order to be able to map the input vertex stream (that is, raw bytes stream) sent through some DP/DIP call to VS_INPUT structs, I don't see why the same is necessary for the struct that is passed from the vertex shader to the pixel shader. I assume my question is quite noob-ish. the only possible reason I could think about is if there are ny additionnal processing that is to happen between the vertex shader and pixel shader. Thx for your help Cheers, - Janta

Share this post


Link to post
Share on other sites
Advertisement
In DirectX help:
Quote:

...
Vertex shader output semantics are used to link the shader both to the pixel shader and to the rasterizer stage. A vertex shader that is consumed by the rasterizer and not exposed to the pixel shader must generate position data as a minimum. Vertex shaders that generate texture coordinate and color data provide that data to a pixel shader after interpolation is done.
...


Found the reply myself, sorry for posting too fast. Maybe the thread could be helpful to someone else so I will not delete it myself and leave that decision the the moderator.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!