Share via


ID3D12GraphicsCommandList::ExecuteBundle 메서드(d3d12.h)

번들을 실행합니다.

구문

void ExecuteBundle(
  [in] ID3D12GraphicsCommandList *pCommandList
);

매개 변수

[in] pCommandList

형식: ID3D12GraphicsCommandList*

실행할 번들을 결정하는 ID3D12GraphicsCommandList 를 지정합니다.

반환 값

없음

설명

번들은 파이프라인 상태 개체 및 기본 토폴로지를 제외하고 ExecuteBundle 이 호출되는 부모 명령 목록에서 모든 상태를 상속합니다. 번들에 설정된 모든 상태는 부모 명령 목록의 상태에 영향을 미칩니다. ExecuteBundle은 조건자 작업이 아닙니다.

런타임 유효성 검사

런타임은 "호출 수신자"가 번들이며 "호출자"가 직접 명령 목록인지 확인합니다. 또한 런타임은 번들이 닫혔는지 확인합니다. 계약을 위반하면 런타임에서 자동으로 호출을 삭제합니다. 유효성 검사에 실패하면 닫기 에서 E_INVALIDARG 반환됩니다.

디버그 계층

디버그 계층은 런타임이 실패하는 경우와 동일한 경우에 경고를 실행합니다. ExecuteCommandList가 호출될 때 조건자가 설정되면 디버그 계층에서 경고가 발생합니다. 또한 명령 목록의 리소스 참조가 제거되었음을 감지하면 디버그 계층에서 오류가 발생합니다.

또한 디버그 계층은 명령 목록에서 Close 가 호출된 이후 번들과 연결된 명령 할당자가 다시 설정되지 않은지 확인합니다. 이 유효성 검사는 ExecuteBundle 시간 및 명령 큐에서 부모 명령 목록이 실행될 때 발생합니다.

예제

D3D12Bundles 샘플은 다음과 같이 ID3D12GraphicsCommandList::ExecuteBundle을 사용합니다.

void D3D12Bundles::PopulateCommandList(FrameResource* pFrameResource)
{
    // 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_pCurrentFrameResource->m_commandAllocator->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_pCurrentFrameResource->m_commandAllocator.Get(), m_pipelineState1.Get()));

    // Set necessary state.
    m_commandList->SetGraphicsRootSignature(m_rootSignature.Get());

    ID3D12DescriptorHeap* ppHeaps[] = { m_cbvSrvHeap.Get(), m_samplerHeap.Get() };
    m_commandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);

    m_commandList->RSSetViewports(1, &m_viewport);
    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);
    CD3DX12_CPU_DESCRIPTOR_HANDLE dsvHandle(m_dsvHeap->GetCPUDescriptorHandleForHeapStart());
    m_commandList->OMSetRenderTargets(1, &rtvHandle, FALSE, &dsvHandle);

    // Record commands.
    const float clearColor[] = { 0.0f, 0.2f, 0.4f, 1.0f };
    m_commandList->ClearRenderTargetView(rtvHandle, clearColor, 0, nullptr);
    m_commandList->ClearDepthStencilView(m_dsvHeap->GetCPUDescriptorHandleForHeapStart(), D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr);

    if (UseBundles)
    {
        // Execute the prebuilt bundle.
        m_commandList->ExecuteBundle(pFrameResource->m_bundle.Get());
    }
    else
    {
        // Populate a new command list.
        pFrameResource->PopulateCommandList(m_commandList.Get(), m_pipelineState1.Get(), m_pipelineState2.Get(), m_currentFrameResourceIndex, m_numIndices, &m_indexBufferView,
            &m_vertexBufferView, m_cbvSrvHeap.Get(), m_cbvSrvDescriptorSize, m_samplerHeap.Get(), m_rootSignature.Get());
    }

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

D3D12 참조의 예제 코드를 참조하세요.

요구 사항

요구 사항
대상 플랫폼 Windows
헤더 d3d12.h
라이브러리 D3d12.lib
DLL D3d12.dll

추가 정보

ID3D12GraphicsCommandList