Interface ID3D12CommandList (d3d12.h)
Interface dont l’ID3D12GraphicsCommandList hérite. Il représente un ensemble ordonné de commandes exécutées par le GPU, tout en autorisant l’extension à prendre en charge d’autres listes de commandes que celles uniquement pour les graphiques (par exemple, le calcul et la copie).
Héritage
L’interface ID3D12CommandList hérite de ID3D12DeviceChild. ID3D12CommandList a également les types de membres suivants :
Méthodes
L’interface ID3D12CommandList utilise ces méthodes.
ID3D12CommandList::GetType Obtient le type de la liste de commandes, par exemple direct, bundle, calcul ou copie. |
Notes
Utilisez ID3D12Device::CreateCommandList pour créer un objet de liste de commandes.
Consultez également ID3D12GraphicsCommandList, qui dérive de ID3D12CommandList.
Une liste de commandes correspond à un ensemble de commandes que l’unité de traitement graphique (GPU) exécute. Les commandes définissent l’état, dessinent, effacent, copient, etc.
Les listes de commandes Direct3D 12 prennent uniquement en charge ces 2 niveaux d’indirection :
- Une liste de commandes directes correspond à une mémoire tampon de commandes que le GPU peut exécuter.
- Un bundle peut être exécuté directement via une liste de commandes directes.
Exemples
L’exemple D3D12nBodyGravity utilise ID3D12CommandList comme suit :
DWORD D3D12nBodyGravity::AsyncComputeThreadProc(int threadIndex)
{
ID3D12CommandQueue* pCommandQueue = m_computeCommandQueue[threadIndex].Get();
ID3D12CommandAllocator* pCommandAllocator = m_computeAllocator[threadIndex].Get();
ID3D12GraphicsCommandList* pCommandList = m_computeCommandList[threadIndex].Get();
ID3D12Fence* pFence = m_threadFences[threadIndex].Get();
while (0 == InterlockedGetValue(&m_terminating))
{
// Run the particle simulation.
Simulate(threadIndex);
// Close and execute the command list.
ThrowIfFailed(pCommandList->Close());
ID3D12CommandList* ppCommandLists[] = { pCommandList };
pCommandQueue->ExecuteCommandLists(1, ppCommandLists);
// Wait for the compute shader to complete the simulation.
UINT64 threadFenceValue = InterlockedIncrement(&m_threadFenceValues[threadIndex]);
ThrowIfFailed(pCommandQueue->Signal(pFence, threadFenceValue));
ThrowIfFailed(pFence->SetEventOnCompletion(threadFenceValue, m_threadFenceEvents[threadIndex]));
WaitForSingleObject(m_threadFenceEvents[threadIndex], INFINITE);
// Wait for the render thread to be done with the SRV so that
// the next frame in the simulation can run.
UINT64 renderContextFenceValue = InterlockedGetValue(&m_renderContextFenceValues[threadIndex]);
if (m_renderContextFence->GetCompletedValue() < renderContextFenceValue)
{
ThrowIfFailed(pCommandQueue->Wait(m_renderContextFence.Get(), renderContextFenceValue));
InterlockedExchange(&m_renderContextFenceValues[threadIndex], 0);
}
// Swap the indices to the SRV and UAV.
m_srvIndex[threadIndex] = 1 - m_srvIndex[threadIndex];
// Prepare for the next frame.
ThrowIfFailed(pCommandAllocator->Reset());
ThrowIfFailed(pCommandList->Reset(pCommandAllocator, m_computeState.Get()));
}
return 0;
}
Reportez-vous à l’exemple de code dans la référence D3D12.
Spécifications
Plateforme cible | Windows |
En-tête | d3d12.h |
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour