Quick Flow
text
unbind target resource from SRV slots
-> OMSetRenderTargets(offscreen RTV/DSV)
-> RSSetViewports(offscreen size)
-> clear and draw
-> unbind offscreen outputs
-> bind back-buffer RTV/DSV + window viewport
-> bind offscreen SRV and compositeRender target를 바꿀 때 viewport가 자동으로 target 크기에 맞춰지지 않습니다. Color와 depth target의 dimensions·sample count도 서로 호환되어야 합니다.
상태 소유권
작은 renderer는 pass 시작 함수가 필요한 output과 viewport를 전부 설정하는 방식이 가장 명확합니다. 임의 함수가 이전 state를 조회해 복원하는 방식은 누락되기 쉬우므로 pass description 또는 알려진 baseline state를 사용합니다.
MSAA target은 일반 texture SRV처럼 바로 읽지 못하고 resolve resource로 복사해야 할 수 있습니다. Mip chain 생성과 UAV write 뒤 read도 resource 생성 flag와 hazard를 확인합니다.
자주 틀리는 점
- Offscreen pass 뒤 작은 viewport가 back buffer에 남지 않게 합니다.
- 같은 texture의 mip·slice가 겹치는 input/output view인지 확인합니다.
- Clear color와 depth를 pass가 소유한 target에 실행합니다.
- Resize 때 모든 크기 의존 offscreen target도 다시 만듭니다.
참고 링크
2 sources