> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ExecuteBundle

> Exécute un bundle.

Exécute un bundle.

## Syntaxe

```cpp theme={null}
void ExecuteBundle(
    ID3D12GraphicsCommandList  pCommandList
)
```

### Paramètres

*pCommandList \[in]*\
Type : ID3D12GraphicsCommandList \*

Spécifie le [ID3D12GraphicsCommandList](https://docs.xbox.com/fr/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs.md) qui détermine le bundle à exécuter.

### Valeur de retour

Type : void

Aucune.

## Notes

Les bundles héritent de tout l'état de la liste de commandes parente sur laquelle **ExecuteBundle** est appelée, à l'exception de l'objet d'état de pipeline et de la topologie de primitive.
Tout l'état défini dans un bundle affecte l'état de la liste de commandes parente.
Notez que **ExecuteBundle** n'est pas une opération prédiquée.

Validation à l'exécution
Le runtime vérifie que l'« appelé » est un bundle et que l'« appelant » est une liste de commandes directe. Le runtime vérifie également que le bundle a été fermé. Si ce contrat n'est pas respecté, le runtime ignore l'appel sans le signaler.
Un échec de validation entraîne le renvoi de E\_INVALIDARG par [Close](https://docs.xbox.com/fr/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_close_public.md).

Couche de débogage
La couche de débogage émet un avertissement dans les mêmes cas où le runtime échoue.
La couche de débogage émet un avertissement si un prédicat est défini lorsque [ExecuteCommandList](https://docs.xbox.com/fr/reference/graphics/d3d12_x/interfaces/id3d12commandqueue/methods/id3d12commandqueue_executecommandlists.md) est appelée.
En outre, la couche de débogage émet une erreur si elle détecte qu'une ressource référencée par la liste de commandes a été détruite.

La couche de débogage vérifie également que l'allocateur de commandes associé au bundle n'a pas été réinitialisé depuis l'appel de [Close](https://docs.xbox.com/fr/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_close_public.md) sur la liste de commandes. Cette validation a lieu au moment de l'appel à **ExecuteBundle** et lorsque la liste de commandes parente est exécutée sur une file d'attente de commandes.

#### Exemples

L'exemple [D3D12Bundles](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/working-samples) utilise **ID3D12GraphicsCommandList::ExecuteBundle** comme suit :

```cpp theme={null}
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());
}

```

Consultez [Exemple de code dans la référence D3D12](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/notes-on-example-code).

## Configuration requise

**En-tête :** d3d12\_xs.h ou d3d12\_x.h\
**Bibliothèque :** d3d12\_xs.lib ou d3d12\_x.lib\
**Plateformes prises en charge** : consoles XBOX Series et famille XBOX One

## Voir aussi

[ID3D12GraphicsCommandList](https://docs.xbox.com/fr/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs.md)


## Related topics

- [Execute Inventory Operations](https://docs.xbox.com/api-reference/inventory/execute-inventory-operations.md)
- [PFInventoryExecuteInventoryOperationsAsync](https://docs.xbox.com/fr/services/playfab/api-references/c/pfinventory/functions/pfinventoryexecuteinventoryoperationsasync.md)
- [Exécuter des opérations d'inventaire](https://docs.xbox.com/fr/services/playfab/api-references/rest/economy/inventory/execute-inventory-operations.md)
- [Bundles Economy v2](https://docs.xbox.com/fr/services/playfab/economy-monetization/economy-v2/catalog/bundles.md)
- [Vue d'ensemble d'Economy v2](https://docs.xbox.com/fr/services/playfab/economy-monetization/economy-v2/overview.md)
