HLSL semantics POSITION vs SV_POSITION

Started by
1 comment, last by Sujal 11 years, 10 months ago
Advertisement
Sujal
Author
129
August 14, 2010 04:37 PM
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
20,283
August 14, 2010 05:48 PM
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
Author
129
August 15, 2010 07:39 PM
Thank you very much Matt. I understand it now.
Share:

This topic is closed to new replies.

Advertisement