Jump to content

  • Log In with Google      Sign In   
  • Create Account


HLSL semantics POSITION vs SV_POSITION


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Sujal   Members   -  Reputation: 123

Like
0Likes
Like

Posted 14 August 2010 - 10:37 AM

I am new to directX and HLSL. I have some experience with openGL,GLSL, and CG shaders.

I do not understand the difference between some of the semantics used in HLSL.
What is the difference between POSITION and SV_POSITION Semantics? It is explained in http://msdn.microsoft.com/en-us/library/bb509647(VS.85).aspx. But I do not understand it well. Is there a precision or speed difference?

DirectX SDK has a sample called DetailTessellation11. It uses semantics WORLDPOS, LIGHTVECTORTS in its shader. Where is it defined? What do they do?

Sujal

Sponsor:

#2 MJP   Moderators   -  Reputation: 10881

Like
1Likes
Like

Posted 14 August 2010 - 11:48 AM

Semantics with the SV prefix are "system value" semantics. This means that they have a specific meaning to the pipeline. In the case of SV_Position, if it's attached to a vertex shader output that means that the output will contain he final transformed vertex position used for rasterization. Or if you use it for a pixel shader input, it will contain the screenspace position of the pixel. All of these SV semantics are described in the SDK documentation, in the HLSL section. Just search for "semantics".

Any other semantics are defined completely by the user, and have no specific meaning. Their only purpose is to match the outputs from one stage of the pipeline to the inputs of another stage.

Prior to DX10, all semantics were essentially system vale semantics and they were all predefined. Back then, the POSITION semantic was used for both the input vertex position as well as the transformed output vertex position. So you'll see it a lot in older shader code, or DX10 code compiled in compatibilty mode.

#3 Sujal   Members   -  Reputation: 123

Like
0Likes
Like

Posted 15 August 2010 - 01:39 PM

Thank you very much Matt. I understand it now.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS