ID3D12CommandList-Schnittstelle (d3d12.h)

Eine Schnittstelle, von der ID3D12GraphicsCommandList erbt. Es stellt einen geordneten Satz von Befehlen dar, die von der GPU ausgeführt werden, während die Erweiterung andere Befehlslisten als nur für Grafiken (z. B. Compute und Kopieren) unterstützt.

Vererbung

Die ID3D12CommandList-Schnittstelle erbt von ID3D12DeviceChild. ID3D12CommandList verfügt auch über folgende Membertypen:

Methoden

Die ID3D12CommandList-Schnittstelle verfügt über diese Methoden.

 
ID3D12CommandList::GetType

Ruft den Typ der Befehlsliste ab, z. B. direct, bundle, compute oder copy.

Hinweise

Verwenden Sie ID3D12Device::CreateCommandList , um ein Befehlslistenobjekt zu erstellen.

Siehe auch ID3D12GraphicsCommandList, die von ID3D12CommandList abgeleitet ist.

Eine Befehlsliste entspricht einer Reihe von Befehlen, die von der Grafikverarbeitungseinheit (GPU) ausgeführt werden. Befehle legen Zustand, Zeichnen, Löschen, Kopieren usw. fest.

Direct3D 12-Befehlslisten unterstützen nur diese 2 Dereferenzierungsebenen:

  • Eine direkte Befehlsliste entspricht einem Befehlspuffer, den die GPU ausführen kann.
  • Ein Bundle kann nur direkt über eine direkte Befehlsliste ausgeführt werden.

Beispiele

Im D3D12nBodyGravity-Beispiel wird ID3D12CommandList wie folgt verwendet:

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

Weitere Informationen finden Sie im Beispielcode in der D3D12-Referenz.

Anforderungen

   
Zielplattform Windows
Kopfzeile d3d12.h

Weitere Informationen

Kernschnittstellen

ID3D12DeviceChild

ID3D12GraphicsCommandList

Festlegen von Deskriptorheaps