Quick Reference
Width / Height -> mip 0 크기
MipLevels -> mip 수, 0은 조건에 따라 full chain 요청
ArraySize -> texture array slice 수
Format -> 저장 component와 해석 family
SampleDesc -> MSAA sample count와 quality
BindFlags -> SRV, RTV, DSV, UAV 용도
subresource -> mip slice + array slice의 한 조합Texture resource는 저장 공간이고 view가 특정 format과 subresource 범위를 어떤 pipeline 용도로 읽을지 정합니다.
Format 선택
Color texture는 UNORM·FLOAT와 sRGB view 여부를, normal·data texture는 shader가 기대하는 component와 precision을 확인합니다. Typeless resource는 compatible family의 여러 view를 만들 수 있지만 bit layout이 같은 아무 format으로나 재해석할 수는 없습니다.
Depth texture를 shader에서도 읽으려면 typeless resource와 compatible DSV·SRV format 조합을 사용합니다. Render target과 shader resource를 동시에 bind하지 않도록 hazard를 관리합니다.
Subresource와 Pitch
Initial data는 subresource마다 D3D11_SUBRESOURCE_DATA를 제공합니다. SysMemPitch는 한 row의 byte 간격이고, 압축 texture는 block 단위 규칙을 따릅니다.
자주 틀리는 점
- Texture width와 row pitch를 같은 값으로 보지 않습니다.
- MSAA texture는 일반 mip chain과 조합되지 않는 제약을 확인합니다.
- sRGB color texture와 linear data texture를 같은 format 해석으로 샘플하지 않습니다.
- Mip 생성에는 resource flag, SRV·RTV binding과 format 지원이 필요합니다.
참고 링크
2 sources