Interfaz ID3D12CommandList (d3d12.h)

Interfaz de la que se hereda ID3D12GraphicsCommandList . Representa un conjunto ordenado de comandos que ejecuta la GPU, al tiempo que permite que la extensión admita otras listas de comandos que solo para los gráficos (como proceso y copia).

Herencia

La interfaz ID3D12CommandList hereda de ID3D12DeviceChild. ID3D12CommandList también tiene estos tipos de miembros:

Métodos

La interfaz ID3D12CommandList tiene estos métodos.

 
ID3D12CommandList::GetType

Obtiene el tipo de la lista de comandos, como direct, bundle, compute o copy.

Comentarios

Use ID3D12Device::CreateCommandList para crear un objeto de lista de comandos.

Vea también ID3D12GraphicsCommandList, que deriva de ID3D12CommandList.

Una lista de comandos corresponde a un conjunto de comandos que ejecuta la unidad de procesamiento gráfico (GPU). Los comandos establecen el estado, dibujan, borran, copian, etc.

Las listas de comandos de Direct3D 12 solo admiten estos 2 niveles de direccionamiento indirecto:

  • Una lista de comandos directa corresponde a un búfer de comandos que la GPU puede ejecutar.
  • Un lote solo se puede ejecutar directamente a través de una lista de comandos directo.

Ejemplos

El ejemplo D3D12nBodyGravity usa ID3D12CommandList de la siguiente manera:

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;
}

Consulte el código de ejemplo en la referencia de D3D12.

Requisitos

   
Plataforma de destino Windows
Encabezado d3d12.h

Consulte también

Interfaces principales

ID3D12DeviceChild

ID3D12GraphicsCommandList

Establecimiento de montones de descriptores