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

# ExecuteBundle

> Ejecuta un lote.

Ejecuta un lote.

## Sintaxis

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

### Parámetros

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

Especifica el [ID3D12GraphicsCommandList](/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs) que determina el lote que se va a ejecutar.

### Valor devuelto

Tipo: void

Ninguno.

## Comentarios

Los lotes heredan todo el estado de la lista de comandos primaria en la que se llama a **ExecuteBundle**, excepto el objeto de estado de canalización y la topología de primitivas.
Todo el estado que se establece en un lote afectará al estado de la lista de comandos primaria.
Tenga en cuenta que **ExecuteBundle** no es una operación con predicados.

<h3><a id="Runtime_validation" /><a id="runtime_validation" /><a id="RUNTIME_VALIDATION" />Validación en tiempo de ejecución</h3>
El runtime validará que el "destinatario de la llamada" sea un lote y que el "autor de la llamada" sea una lista de comandos directa.  El runtime también validará que el lote se haya cerrado.  Si se infringe el contrato, el runtime descartará la llamada de forma silenciosa.
Un error de validación hará que [Close](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_close_public) devuelva E\_INVALIDARG.

<h3><a id="Debug_layer" /><a id="debug_layer" /><a id="DEBUG_LAYER" />Capa de depuración</h3>
La capa de depuración emitirá una advertencia en los mismos casos en los que el runtime producirá un error.
La capa de depuración emitirá una advertencia si hay un predicado establecido cuando se llama a [ExecuteCommandList](/reference/graphics/d3d12_x/interfaces/id3d12commandqueue/methods/id3d12commandqueue_executecommandlists).
Además, la capa de depuración emitirá un error si detecta que se ha destruido algún recurso al que hace referencia la lista de comandos.

La capa de depuración también validará que el asignador de comandos asociado al lote no se haya restablecido desde que se llamó a [Close](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_close_public) en la lista de comandos.  Esta validación se produce en el momento de **ExecuteBundle** y cuando la lista de comandos primaria se ejecuta en una cola de comandos.

#### Ejemplos

El ejemplo [D3D12Bundles](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/working-samples) usa **ID3D12GraphicsCommandList::ExecuteBundle** de la siguiente manera:

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

```

Consulte [Código de ejemplo en la referencia de D3D12](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/notes-on-example-code).

<div class="code" />

## Requisitos

**Encabezado:** d3d12\_xs.h o d3d12\_x.h\
**Biblioteca:** d3d12\_xs.lib o d3d12\_x.lib\
**Plataformas compatibles**: consolas XBOX Series y familia XBOX One

## Consulte también

[ID3D12GraphicsCommandList](/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs)


## Related topics

- [ExecuteFunctionResult](/es/services/playfab/api-references/events/data-types/executefunctionresult.md)
- [XGameStreamingGetTouchBundleVersion](/es/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversion.md)
- [ExecuteCloudScriptResult](/es/services/playfab/api-references/events/data-types/executecloudscriptresult.md)
- [XGameStreamingGetTouchBundleVersionNameSize](/es/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversionnamesize.md)
- [SetPredication](/es/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setpredication_public.md)
