본문 바로가기

Library/Computer Graphics

DirectX HLSL Semantics

시멘틱(semantics)이란, 파라미터가 어떤 의도를 가지는지 알려주는, 쉐이더의 입력, 출력에 추가적으로 붙는 문자열이다. 시멘틱은 쉐이더 스테이지들 사이에서 전달되는 모든 변수들에 반드시 존재해야 한다. Direct3D 9와 Direct3D 10의 버텍스 쉐이더, 픽셀 쉐이더에서 지원되는 시멘틱은 다음과 같다.


Vertex Shader Input Semantics (Input / Description / Type)
BINORMAL[n] / Binormal / float4
BLENDINDICES[n] / Blend indices / uint
BLENDWEIGHT[n] / Blend weight / float
COLOR[n] / Diffuse and specular color / float4
NORMAL[n] / Normal vector / float4
POSITION[n] Vertex position in object space / float4
POSITIONT / Transformed vertex position / float4
PSIZE[n] / point size / float
TANGENT[n] : Tangent / float4
TEXCOORD[n] / Texture coordinates / float4

Vertex Shader Output Semantics (Output / Description / Type)
COLOR[n] / Diffuse or specular color / float4
FOG / Vertex fog / float
POSITION[n] / Position of a vertex in homegenous space. Compute position in screen space by dividing (x, y, z) by w. Every vertex shader must write out a parameter with this semantics / float4

PSIZE[n] : Point size / float
TESSFACTOR[n] / Tessellation factor / float
TEXCOORD[n] / Texture coordinates / float4


Pixel Shader Input Semantics (Input / Description / Type)
COLOR[n] / Diffuse or specular color / float4
TEXCOORD[n] / Texture coordinates / float4
VFACE / Floating-point scalar that indicates a back-facing primitive. A negative value faces backwards, while a positive value faces the camera / float

VPOS / The pixel location (x, y) in screen space. To convert a Direct3D 9 shader (that uses this semantic) to a Direct3D 10 shader/ float2

Pixel Shader Output Semantics (Output / Description / Type)
COLOR[n] / Output color / float4
DEPTH[n] / Output depth / float


픽셀 쉐이더 출력 시멘틱에서, COLOR 시멘틱은 쉐이더 호환 모드(shader compatibility mode)에서만 유효하다.


Reference
http://msdn.microsoft.com/en-us/library/ee418355(VS.85).aspx