DirectX12 - ExecuteCommandLists和Present功能

时间:2015-10-29 14:17:52

标签: directx-12

我在Microsoft示例中找到了:

void D3D12HelloTriangle::OnRender()
{
// Record all the commands we need to render the scene into the command list.
PopulateCommandList();

// Execute the command list.
ID3D12CommandList* ppCommandLists[] = { m_commandList.Get() };
m_commandQueue->ExecuteCommandLists(_countof(ppCommandLists), ppCommandLists);

// Present the frame.
ThrowIfFailed(m_swapChain->Present(1, 0));

WaitForPreviousFrame();
}

实际上是如何运作的? ExecuteCommandLists是一个异步函数调用,因此它意味着代码执行将继续并且它将触及Present函数。

现在的电话会怎么样?让我们说,GPU仍在绘制,工作和呈现被称为。现在是同步通话吗?当gpu仍在绘制时,它不能呈现缓冲区。那是对的吗 ?有人能解释一下这里发生了什么吗?

1 个答案:

答案 0 :(得分:1)

Present也是一个异步命令,它告诉GPU从交换链中的下一个缓冲区开始扫描(显示)。您不必担心GPU在“翻转”发生之前没有完成执行所有先前发布的工作(在图形命令队列上)。