Command List Clone Extension

Command List Clone

A command list created with the cloneable flag may be cloned only after it has been closed.

// Create a command list that may be cloned
ze_command_list_desc_t commandListDesc = {
    ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC,
    nullptr,
    0,
    ZE_COMMAND_LIST_FLAG_EXP_CLONEABLE
};
ze_command_list_handle_t hCommandList = nullptr;
zeCommandListCreate(hContext, hDevice, &commandListDesc, &hCommandList);

// { ...[construct command list]... }

// Close the command list
zeCommandListClose(hCommandList);

// Execute the command list
zeCommandQueueExecuteCommandLists(hCommandQueue, 1, &hCommandList, nullptr);

// Clone the command list, no synchronization required
ze_command_list_handle_t hClonedCommandList = nullptr;
zeCommandListCreateCloneExp(hCommandList, &hClonedCommandList);

// ...