レンダリング用のグラフィックス コマンドの一覧をカプセル化します。 コマンド リストの実行をインストルメント化し、パイプラインの状態を設定およびクリアするための API が含まれています。
メモこのインターフェイスの最新バージョンは、Windows 10 Creators Updateで導入された ID3D12GraphicsCommandList1 です。 Windows 10 Creators Updateを対象とするアプリケーションでは、ID3D12GraphicsCommandList ではなく ID3D12GraphicsCommandList1 インターフェイスを使用する必要があります。
継承
ID3D12GraphicsCommandList インターフェイスは ID3D12CommandList から継承されます。 ID3D12GraphicsCommandList には、次の種類のメンバーもあります。
メソッド
ID3D12GraphicsCommandList インターフェイスには、これらのメソッドがあります。
ID3D12GraphicsCommandList::BeginEvent 直接呼び出すためのものではありません。 PIX イベント ランタイムを使用して、コマンド リストにイベントを挿入します。 (ID3D12GraphicsCommandList.BeginEvent) |
ID3D12GraphicsCommandList::BeginQuery 実行中のクエリを開始します。 (ID3D12GraphicsCommandList.BeginQuery) |
ID3D12GraphicsCommandList::ClearDepthStencilView 深度ステンシル リソースをクリアします。 (ID3D12GraphicsCommandList.ClearDepthStencilView) |
ID3D12GraphicsCommandList::ClearRenderTargetView レンダー ターゲット内のすべての要素を 1 つの値に設定します。 |
ID3D12GraphicsCommandList::ClearState 直接コマンド リストの状態を、コマンド リストの作成時の状態に戻します。 (ID3D12GraphicsCommandList.ClearState) |
ID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat 順序指定されていないアクセス ビュー内のすべての要素を、指定された float 値に設定します。 |
ID3D12GraphicsCommandList::ClearUnorderedAccessViewUint 順序なしアクセス ビュー (UAV) 内のすべての要素を、指定した整数値に設定します。 |
ID3D12GraphicsCommandList::Close コマンド リストへの記録が完了したことを示します。 (ID3D12GraphicsCommandList.Close) |
ID3D12GraphicsCommandList::CopyBufferRegion あるリソースから別のリソースにバッファーの領域をコピーします。 |
ID3D12GraphicsCommandList::CopyResource ソース リソースの内容全体をコピー先リソースにコピーします。 |
ID3D12GraphicsCommandList::CopyTextureRegion この方法では、GPU を使用して 2 つの場所間でテクスチャ データをコピーします。 ソースとターゲットの両方で、バッファー リソースまたはテクスチャ リソース内にあるテクスチャ データを参照できます。 |
ID3D12GraphicsCommandList::CopyTiles バッファーからタイル リソースにタイルをコピーするか、タイル リソースにタイルをコピーします。 (ID3D12GraphicsCommandList.CopyTiles) |
ID3D12GraphicsCommandList::D iscardResource リソースを破棄します。 |
ID3D12GraphicsCommandList::D ispatch スレッド グループでコンピューティング シェーダーを実行します。 |
ID3D12GraphicsCommandList::D rawIndexedInstanced インデックス付きインスタンス化されたプリミティブを描画します。 |
ID3D12GraphicsCommandList::DrawInstanced インデックスのないインスタンス化されたプリミティブを描画します。 |
ID3D12GraphicsCommandList::EndEvent 直接呼び出すためのものではありません。 PIX イベント ランタイムを使用して、コマンド リストにイベントを挿入します。 (ID3D12GraphicsCommandList.EndEvent) |
ID3D12GraphicsCommandList::EndQuery 実行中のクエリを終了します。 |
ID3D12GraphicsCommandList::ExecuteBundle バンドルを実行します。 |
ID3D12GraphicsCommandList::ExecuteIndirect アプリは ExecuteIndirect メソッドを使用して間接描画/ディスパッチを実行します。 |
ID3D12GraphicsCommandList::IASetIndexBuffer インデックス バッファーのビューを設定します。 |
ID3D12GraphicsCommandList::IASetPrimitiveTopology プリミティブ型に関する情報と、入力アセンブラー ステージの入力データを記述するデータ順序をバインドします。 (ID3D12GraphicsCommandList.IASetPrimitiveTopology) |
ID3D12GraphicsCommandList::IASetVertexBuffers 頂点バッファーの CPU 記述子ハンドルを設定します。 |
ID3D12GraphicsCommandList::OMSetBlendFactor ピクセル シェーダー、レンダー ターゲット、またはその両方の値を調整するブレンド 係数を設定します。 |
ID3D12GraphicsCommandList::OMSetRenderTargets レンダー ターゲットと深度ステンシルの CPU 記述子ハンドルを設定します。 |
ID3D12GraphicsCommandList::OMSetStencilRef 深度ステンシル テストの参照値を設定します。 |
ID3D12GraphicsCommandList::Reset 新しいコマンド リストが作成されたかのように、コマンド リストを初期状態に戻します。 (ID3D12GraphicsCommandList.Reset) |
ID3D12GraphicsCommandList::ResolveQueryData クエリからデータを抽出します。 ResolveQueryData は、すべてのヒープの種類 (既定、アップロード、およびリードバック) で動作します。 ResolveQueryData は、すべてのヒープの種類 (既定、アップロード、およびリードバック) で動作します。 . |
ID3D12GraphicsCommandList::ResolveSubresource 複数サンプリングされたリソースを非マルチサンプリング リソースにコピーします。 |
ID3D12GraphicsCommandList::ResourceBarrier リソースへの複数のアクセスを同期する必要があることをドライバーに通知します。 (ID3D12GraphicsCommandList.ResourceBarrier) |
ID3D12GraphicsCommandList::RSSetScissorRects ハサミの四角形の配列をラスタライザー ステージにバインドします。 |
ID3D12GraphicsCommandList::RSSetViewports ビューポートの配列をパイプラインのラスタライザー ステージにバインドします。 (ID3D12GraphicsCommandList.RSSetViewports) |
ID3D12GraphicsCommandList::SetComputeRoot32BitConstant コンピューティング ルート署名の定数を設定します。 |
ID3D12GraphicsCommandList::SetComputeRoot32BitConstants コンピューティング ルート署名の定数のグループを設定します。 |
ID3D12GraphicsCommandList::SetComputeRootConstantBufferView コンピューティング ルート署名の定数バッファーの CPU 記述子ハンドルを設定します。 |
ID3D12GraphicsCommandList::SetComputeRootDescriptorTable 記述子テーブルをコンピューティング ルート署名に設定します。 |
ID3D12GraphicsCommandList::SetComputeRootShaderResourceView コンピューティング ルート署名のシェーダー リソースの CPU 記述子ハンドルを設定します。 |
ID3D12GraphicsCommandList::SetComputeRootSignature コンピューティング ルート署名のレイアウトを設定します。 |
ID3D12GraphicsCommandList::SetComputeRootUnorderedAccessView コンピューティング ルート署名の順序付けられていないアクセス ビュー リソースの CPU 記述子ハンドルを設定します。 |
ID3D12GraphicsCommandList::SetDescriptorHeaps コマンド リストに関連付けられている現在バインドされている記述子ヒープを変更します。 |
ID3D12GraphicsCommandList::SetGraphicsRoot32BitConstant グラフィックス ルート署名の定数を設定します。 |
ID3D12GraphicsCommandList::SetGraphicsRoot32BitConstants グラフィックス ルート署名の定数のグループを設定します。 |
ID3D12GraphicsCommandList::SetGraphicsRootConstantBufferView グラフィックス ルート署名の定数バッファーの CPU 記述子ハンドルを設定します。 |
ID3D12GraphicsCommandList::SetGraphicsRootDescriptorTable 記述子テーブルをグラフィックス ルート署名に設定します。 |
ID3D12GraphicsCommandList::SetGraphicsRootShaderResourceView グラフィックス ルート署名のシェーダー リソースの CPU 記述子ハンドルを設定します。 |
ID3D12GraphicsCommandList::SetGraphicsRootSignature グラフィックス ルート署名のレイアウトを設定します。 |
ID3D12GraphicsCommandList::SetGraphicsRootUnorderedAccessView グラフィックス ルート署名の順序付けされていないアクセス ビュー リソースの CPU 記述子ハンドルを設定します。 |
ID3D12GraphicsCommandList::SetMarker 直接呼び出すためのものではありません。 PIX イベント ランタイムを使用して、コマンド リストにイベントを挿入します。 (ID3D12GraphicsCommandList.SetMarker) |
ID3D12GraphicsCommandList::SetPipelineState グラフィックス処理装置 (GPU) パイプラインのほとんどの固定関数状態のすべてのシェーダーとプログラムを設定します。 |
ID3D12GraphicsCommandList::SetPredication レンダリング述語を設定します。 |
ID3D12GraphicsCommandList::SOSetTargets ストリーム出力バッファー ビューを設定します。 |
注釈
このインターフェイスは D3D12 の新機能であり、 ID3D11CommandList インターフェイスの多くの機能をカプセル化し、「 レンダリング」で説明されている新しい機能を含めます。
例
D3D12nBodyGravity サンプルでは、次のように ID3D12GraphicsCommandList を使用します。
パイプライン オブジェクトを宣言します。
D3D12_VIEWPORT m_viewport;
D3D12_RECT m_scissorRect;
ComPtr<IDXGISwapChain3> m_swapChain;
ComPtr<ID3D12Device> m_device;
ComPtr<ID3D12Resource> m_renderTargets[FrameCount];
ComPtr<ID3D12CommandAllocator> m_commandAllocator;
ComPtr<ID3D12CommandQueue> m_commandQueue;
ComPtr<ID3D12RootSignature> m_rootSignature;
ComPtr<ID3D12DescriptorHeap> m_rtvHeap;
ComPtr<ID3D12PipelineState> m_pipelineState;
ComPtr<ID3D12GraphicsCommandList> m_commandList;
UINT m_rtvDescriptorSize;
コマンド リストの設定。
// Fill the command list with all the render commands and dependent state.
void D3D12nBodyGravity::PopulateCommandList()
{
// Command list allocators can only be reset when the associated
// command lists have finished execution on the GPU; apps should use
// fences to determine GPU execution progress.
ThrowIfFailed(m_commandAllocators[m_frameIndex]->Reset());
// However, when ExecuteCommandList() is called on a particular command
// list, that command list can then be reset at any time and must be before
// re-recording.
ThrowIfFailed(m_commandList->Reset(m_commandAllocators[m_frameIndex].Get(), m_pipelineState.Get()));
// Set necessary state.
m_commandList->SetPipelineState(m_pipelineState.Get());
m_commandList->SetGraphicsRootSignature(m_rootSignature.Get());
m_commandList->SetGraphicsRootConstantBufferView(RootParameterCB, m_constantBufferGS->GetGPUVirtualAddress() + m_frameIndex * sizeof(ConstantBufferGS));
ID3D12DescriptorHeap* ppHeaps[] = { m_srvUavHeap.Get() };
m_commandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);
m_commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView);
m_commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_POINTLIST);
m_commandList->RSSetScissorRects(1, &m_scissorRect);
// Indicate that the back buffer will be used as a render target.
m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET));
CD3DX12_CPU_DESCRIPTOR_HANDLE rtvHandle(m_rtvHeap->GetCPUDescriptorHandleForHeapStart(), m_frameIndex, m_rtvDescriptorSize);
m_commandList->OMSetRenderTargets(1, &rtvHandle, FALSE, nullptr);
// Record commands.
const float clearColor[] = { 0.0f, 0.0f, 0.1f, 0.0f };
m_commandList->ClearRenderTargetView(rtvHandle, clearColor, 0, nullptr);
// Render the particles.
float viewportHeight = static_cast<float>(static_cast<UINT>(m_viewport.Height) / m_heightInstances);
float viewportWidth = static_cast<float>(static_cast<UINT>(m_viewport.Width) / m_widthInstances);
for (UINT n = 0; n < ThreadCount; n++)
{
const UINT srvIndex = n + (m_srvIndex[n] == 0 ? SrvParticlePosVelo0 : SrvParticlePosVelo1);
D3D12_VIEWPORT viewport;
viewport.TopLeftX = (n % m_widthInstances) * viewportWidth;
viewport.TopLeftY = (n / m_widthInstances) * viewportHeight;
viewport.Width = viewportWidth;
viewport.Height = viewportHeight;
viewport.MinDepth = D3D12_MIN_DEPTH;
viewport.MaxDepth = D3D12_MAX_DEPTH;
m_commandList->RSSetViewports(1, &viewport);
CD3DX12_GPU_DESCRIPTOR_HANDLE srvHandle(m_srvUavHeap->GetGPUDescriptorHandleForHeapStart(), srvIndex, m_srvUavDescriptorSize);
m_commandList->SetGraphicsRootDescriptorTable(RootParameterSRV, srvHandle);
m_commandList->DrawInstanced(ParticleCount, 1, 0, 0);
}
m_commandList->RSSetViewports(1, &m_viewport);
// Indicate that the back buffer will now be used to present.
m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT));
ThrowIfFailed(m_commandList->Close());
}
要件
要件 | 値 |
---|---|
対象プラットフォーム | Windows |
ヘッダー | d3d12.h |