Semantics & System Values
A semantic is a string attached to a shader input/output that tells the pipeline how to connect data: between the input layout and the VS, between stages, and to fixed-function hardware.
9.1 What semantics do
A semantic is a string attached to a shader input/output that tells the pipeline how to connect data: between the input layout and the VS, between stages, and to fixed-function hardware. User semantics are arbitrary names with an optional index (TEXCOORD0, NORMAL, MYDATA3). System-value semantics start with SV_ and have special meaning.
struct VSIn { float3 pos : POSITION; float3 n : NORMAL; float2 uv : TEXCOORD0; };
struct VSOut { float4 pos : SV_Position; float3 n : NORMAL; float2 uv : TEXCOORD0; };
// Inter-stage matching is by semantic name+index (with DXIL, also by signature order — keep VS output and PS input structs identical, ideally shared in a .hlsli).9.2 Common system values
VS/DS/GS/MS out; PS in out: clip-space position; PS in: pixel center (x+0.5, y+0.5), z = depth, w = clip-space w float4 (or int/uint) render target n (0–7) override depth (disables early-Z)
SV_DepthGreaterEqual / SV_DepthLessEqual conservative depth (keeps some early-Z) instance index (starts at 0, ignores StartInstanceLocation)
SV_StartVertexLocation, SV_StartInstanceLocation draw base values (SM 6.8) GS/HS/DS/PS in front-facing triangle?
MSAA sample (forces per-sample shading) MSAA coverage mask SV_ClipDistance[n], SV_CullDistance[n] user clip planes layered rendering (cube maps, CSM) view instancing (SM 6.1) barycentric coordinates (SM 6.1) VS/GS out, PS in variable rate shading (SM 6.4) global thread id = GroupID × numthreads + GroupThreadID thread group id thread id within group control point being produced SV_TessFactor, SV_InsideTessFactor HS patch constant out UV / barycentric in patch MS primitive out cull this primitive
9.3 Legacy semantics (SM 3 and earlier / FXC compatibility)
POSITION, COLOR0, DEPTH, VPOS, VFACE were D3D9 system semantics. With /Gec (backwards compatibility) FXC maps COLOR → SV_Target and POSITION → SV_Position in some stages. Always use SV_ names in new code.
9.4 Interpolation modifiers
linear (default) screen-space linear interpolation (UI, screen-space effects) value from the provoking vertex (required for integers, IDs) sample inside the covered area (avoids MSAA edge artifacts) interpolate per MSAA sample (forces per-sample shading)
For explicit attribute evaluation: EvaluateAttributeAtSample(v, i), EvaluateAttributeAtCentroid(v), EvaluateAttributeSnapped(v, offset), and with SM 6.1 GetAttributeAtVertex(v, vertexIndex) (requires nointerpolation input).
struct VSOut
{
float4 pos : SV_Position;
nointerpolation uint matId : MATERIAL_ID;
centroid float2 uv : TEXCOORD0;
noperspective float2 screenUV : TEXCOORD1;
};