Skip to main content
GameDev.net gamedev.net
🔒 Locked

HLSL semantics POSITION vs SV_POSITION

Started by Sujal Aug 14, 2010 at 4:37 PM 1 replies 48.6k views
Original Post
Sujal
Sujal
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
MJP
MJP
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.
Sujal
Sujal
Thank you very much Matt. I understand it now.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.