CommandList와 CommandQueue를 이용한 Batch Processing은 멋지다.
D3D12는 모든 작업을 CommandList에 기록하고 나중에 CommandQueue에서 여러개의 CommandList를 한번에 execute한다.
그림자 처리를 예로 들면 ShadowMap생성을 위한 Caster Object렌더링과 그림자를 받는 Receiver Object의 렌더링 사이에 wait가 필요없다.
이런식으로 그 모든 작업을 한방에 처리. 게다가 어플리케이션은 execute()결과가 완료될때까지 딴짓을 해도 된다.
// Execute the command list. UINT CommandListCount = 0; ID3D12CommandList* ppCommandLists[COMMAND_LIST_TYPE_COUNT] = {}; // for shadowmap if (m_pShadowMapResource) { ppCommandLists[CommandListCount] = m_pCommandList[COMMAND_LIST_TYPE_SHADOW_MAP]; CommandListCount++; } // for mirror // for default , be must last ppCommandLists[CommandListCount] = m_pCommandList[COMMAND_LIST_TYPE_DEFAULT]; CommandListCount++; m_pCommandQueue->Execute(CommandListCount, ppCommandLists);
이전같으면 그림자를 렌더링하기 위해 DrawCall에 대해 얼마나 wait를 해야하는가.
초반에 적응하기 힘든점을 제외하면 그래픽 API는 이 방향으로 가는게 맞는것 같다.