Interface ID3D12GraphicsCommandList (d3d12.h)

Encapsule une liste de commandes graphiques pour le rendu. Inclut des API pour l’instrumentation de l’exécution de la liste de commandes, ainsi que pour la définition et l’effacement de l’état du pipeline.

Note La dernière version de cette interface est ID3D12GraphicsCommandList1 introduite dans le Windows 10 Creators Update. Les applications ciblant Windows 10 Creators Update doivent utiliser l’interface ID3D12GraphicsCommandList1 au lieu de ID3D12GraphicsCommandList.
 

Héritage

L’interface ID3D12GraphicsCommandList hérite de ID3D12CommandList. ID3D12GraphicsCommandList a également les types de membres suivants :

Méthodes

L’interface ID3D12GraphicsCommandList utilise ces méthodes.

 
ID3D12GraphicsCommandList ::BeginEvent

Non destinée à être appelée directement.  Utilisez le runtime d’événements PIX pour insérer des événements dans une liste de commandes. (ID3D12GraphicsCommandList.BeginEvent)
ID3D12GraphicsCommandList ::BeginQuery

Démarre une requête en cours d’exécution. (ID3D12GraphicsCommandList.BeginQuery)
ID3D12GraphicsCommandList ::ClearDepthStencilView

Efface la ressource de gabarit de profondeur. (ID3D12GraphicsCommandList.ClearDepthStencilView)
ID3D12GraphicsCommandList ::ClearRenderTargetView

Définit tous les éléments d’une cible de rendu sur une seule valeur.
ID3D12GraphicsCommandList ::ClearState

Réinitialise l’état d’une liste de commandes directes à l’état dans lequel elle était lors de la création de la liste de commandes. (ID3D12GraphicsCommandList.ClearState)
ID3D12GraphicsCommandList ::ClearUnorderedAccessViewFloat

Définit tous les éléments d’une vue d’accès non ordonné sur les valeurs float spécifiées.
ID3D12GraphicsCommandList ::ClearUnorderedAccessViewUint

Définit tous les éléments d’une vue d’accès non ordonné (UAV) sur les valeurs entières spécifiées.
ID3D12GraphicsCommandList ::Close

Indique que l’enregistrement dans la liste de commandes est terminé. (ID3D12GraphicsCommandList.Close)
ID3D12GraphicsCommandList ::CopyBufferRegion

Copie une région d’une mémoire tampon d’une ressource vers une autre.
ID3D12GraphicsCommandList ::CopyResource

Copie l’intégralité du contenu de la ressource source vers la ressource de destination.
ID3D12GraphicsCommandList ::CopyTextureRegion

Cette méthode utilise le GPU pour copier des données de texture entre deux emplacements. La source et la destination peuvent faire référence à des données de texture situées dans une ressource de mémoire tampon ou une ressource de texture.
ID3D12GraphicsCommandList ::CopyTiles

Copie les vignettes de la mémoire tampon vers la ressource en mosaïque ou vice versa. (ID3D12GraphicsCommandList.CopyTiles)
ID3D12GraphicsCommandList ::D iscardResource

Ignore une ressource.
ID3D12GraphicsCommandList ::D ispatch

Exécute un nuanceur de calcul sur un groupe de threads.
ID3D12GraphicsCommandList ::D rawIndexedInstanced

Dessine des primitives indexées et instanceées.
ID3D12GraphicsCommandList ::D rawInstanced

Dessine des primitives non indexées et instanceées.
ID3D12GraphicsCommandList ::EndEvent

Non destinée à être appelée directement.  Utilisez le runtime d’événements PIX pour insérer des événements dans une liste de commandes. (ID3D12GraphicsCommandList.EndEvent)
ID3D12GraphicsCommandList ::EndQuery

Termine une requête en cours d’exécution.
ID3D12GraphicsCommandList ::ExecuteBundle

Exécute un bundle.
ID3D12GraphicsCommandList ::ExecuteIndirect

Les applications effectuent des tirages/distributions indirects à l’aide de la méthode ExecuteIndirect.
ID3D12GraphicsCommandList ::IASetIndexBuffer

Définit la vue de la mémoire tampon d’index.
ID3D12GraphicsCommandList ::IASetPrimitiveTopology

Lier des informations sur le type primitif et l’ordre des données qui décrit les données d’entrée pour l’étape de l’assembleur d’entrée. (ID3D12GraphicsCommandList.IASetPrimitiveTopology)
ID3D12GraphicsCommandList ::IASetVertexBuffers

Définit un handle de descripteur de processeur pour les mémoires tampons de vertex.
ID3D12GraphicsCommandList ::OMSetBlendFactor

Définit le facteur de fusion qui module les valeurs d’un nuanceur de pixels, d’une cible de rendu ou des deux.
ID3D12GraphicsCommandList ::OMSetRenderTargets

Définit les handles de descripteur de processeur pour les cibles de rendu et le gabarit de profondeur.
ID3D12GraphicsCommandList ::OMSetStencilRef

Définit la valeur de référence pour les tests de gabarit de profondeur.
ID3D12GraphicsCommandList ::Reset

Réinitialise une liste de commandes à son état initial comme si une nouvelle liste de commandes venait d’être créée. (ID3D12GraphicsCommandList.Reset)
ID3D12GraphicsCommandList ::ResolveQueryData

Extrait des données d’une requête. ResolveQueryData fonctionne avec tous les types de tas (par défaut, chargement et lecture).  ResolveQueryData fonctionne avec tous les types de tas (par défaut, chargement et lecture). .
ID3D12GraphicsCommandList ::ResolveSubresource

Copiez une ressource à échantillonnage multiple dans une ressource non multi-échantillonnées.
ID3D12GraphicsCommandList ::ResourceBarrier

Avertit le pilote qu’il doit synchroniser plusieurs accès aux ressources. (ID3D12GraphicsCommandList.ResourceBarrier)
ID3D12GraphicsCommandList ::RSSetScissorRects

Lie un tableau de rectangles en ciseaux à l’étape de rastériseur.
ID3D12GraphicsCommandList ::RSSetViewports

Liez un tableau de fenêtres d’affichage à l’étape de rastériseur du pipeline. (ID3D12GraphicsCommandList.RSSetViewports)
ID3D12GraphicsCommandList ::SetComputeRoot32BitConstant

Définit une constante dans la signature racine de calcul.
ID3D12GraphicsCommandList ::SetComputeRoot32BitConstants

Définit un groupe de constantes dans la signature racine de calcul.
ID3D12GraphicsCommandList ::SetComputeRootConstantBufferView

Définit un handle de descripteur de processeur pour la mémoire tampon constante dans la signature racine de calcul.
ID3D12GraphicsCommandList ::SetComputeRootDescriptorTable

Définit une table de descripteur dans la signature racine de calcul.
ID3D12GraphicsCommandList ::SetComputeRootShaderResourceView

Définit un handle de descripteur de processeur pour la ressource de nuanceur dans la signature racine de calcul.
ID3D12GraphicsCommandList ::SetComputeRootSignature

Définit la disposition de la signature racine de calcul.
ID3D12GraphicsCommandList ::SetComputeRootUnorderedAccessView

Définit un handle de descripteur de processeur pour la ressource unordered-access-view dans la signature racine de calcul.
ID3D12GraphicsCommandList ::SetDescriptorHeaps

Modifie les tas de descripteurs actuellement liés qui sont associés à une liste de commandes.
ID3D12GraphicsCommandList ::SetGraphicsRoot32BitConstant

Définit une constante dans la signature racine du graphique.
ID3D12GraphicsCommandList ::SetGraphicsRoot32BitConstants

Définit un groupe de constantes dans la signature racine du graphique.
ID3D12GraphicsCommandList ::SetGraphicsRootConstantBufferView

Définit un handle de descripteur de processeur pour la mémoire tampon constante dans la signature racine du graphique.
ID3D12GraphicsCommandList ::SetGraphicsRootDescriptorTable

Définit une table de descripteur dans la signature racine du graphique.
ID3D12GraphicsCommandList ::SetGraphicsRootShaderResourceView

Définit un handle de descripteur de processeur pour la ressource de nuanceur dans la signature racine du graphique.
ID3D12GraphicsCommandList ::SetGraphicsRootSignature

Définit la disposition de la signature racine du graphique.
ID3D12GraphicsCommandList ::SetGraphicsRootUnorderedAccessView

Définit un handle de descripteur de processeur pour la ressource unordered-access-view dans la signature graphique racine.
ID3D12GraphicsCommandList ::SetMarker

Non destinée à être appelée directement.  Utilisez le runtime d’événements PIX pour insérer des événements dans une liste de commandes. (ID3D12GraphicsCommandList.SetMarker)
ID3D12GraphicsCommandList ::SetPipelineState

Définit tous les nuanceurs et programmes la majeure partie de l’état de fonction fixe du pipeline d’unité de traitement graphique (GPU).
ID3D12GraphicsCommandList ::SetPredication

Définit un prédicat de rendu.
ID3D12GraphicsCommandList ::SOSetTargets

Définit les vues de mémoire tampon de sortie de flux.

Remarques

Cette interface est une nouveauté dans D3D12, qui encapsule une grande partie des fonctionnalités de l’interface ID3D11CommandList et inclut les nouvelles fonctionnalités décrites dans Rendu.

Exemples

L’exemple D3D12nBodyGravity utilise ID3D12GraphicsCommandList comme suit :

Déclarez les objets de pipeline.

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;

Remplissage des listes de commandes.

// 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());
}

Reportez-vous à l’exemple de code dans la référence D3D12.

Configuration requise

Condition requise Valeur
Plateforme cible Windows
En-tête d3d12.h

Voir aussi

Interfaces principales

ID3D12CommandList

ID3D12GraphicsCommandList1