DirectX11 遅延コンテキスト (DirectX11 deferred context)
DirectX11 の遅延コンテキストはマルチスレッドによって GPU のコマンドを生成するのに使われます. MSDN のドキュメントに書いてあった擬似コードを以下に載せておきます.
DirectX11 "deferred context" is used for generating GPU commands by multi-threading. The following pseudocode written at MSDN shows how to perform multiple-pass rendering.
{
ImmCtx->SetRenderTarget( pRTViewOfResourceX );
DefCtx1->SetTexture( pSRView1OfResourceX );
DefCtx2->SetTexture( pSRView2OfResourceX );
for () // Traverse the scene graph.
{
// Pass 0: immediate context renders primitives into resource X.
ImmCtx->Draw();
// The following texturing by the deferred contexts occurs after the
// immediate context makes calls to ExecuteCommandList.
// Resource X is then comletely updated by the immediate context.
// Pass 1: deferred context 1 performs texturing from resource X.
DefCtx1->Draw();
// Pass 2: deferred context 2 performs texturing from resource X.
DefCtx2->Draw();
}
// Create command lists and record commands into them.
DefCtx1->FinishCommandList( &pCL1 );
DefCtx2->FinishCommandList( &pCL2 );
ImmCtx->ExecuteCommandList( pCL1 ); // Execute pass 1.
ImmCtx->ExecuteCommandList( pCL2 ); // Exeucte pass 2.
}具体的に自分のプログラムでどう使うのか? については, DirectX SDK ( June 2010 )"MultithreadedRendering11" のサンプルプログラムのソースコードを読むと良いと思います.
To understand how to use it in your program, you should read "MultithreadedRendering11" in DirectX SDK ( June 2010 ).
- DirectX11 : Multipass rendering
- "Your Game Needs Direct3D 11, So Get Started Now!" Bill Bilodeau