Commit 86c1ca87 authored by Philip Rebohle's avatar Philip Rebohle Committed by Alexandre Julliard

dxgi: Create frame latency events for d3d12 swapchains if requested.

parent 682d2fd5
......@@ -1094,6 +1094,9 @@ struct d3d12_swapchain
IDXGIOutput *target;
DXGI_SWAP_CHAIN_DESC1 desc;
DXGI_SWAP_CHAIN_FULLSCREEN_DESC fullscreen_desc;
ID3D12Fence *frame_latency_fence;
HANDLE frame_latency_event;
};
static DXGI_FORMAT dxgi_format_from_vk_format(VkFormat vk_format)
......@@ -1887,6 +1890,12 @@ static void d3d12_swapchain_destroy(struct d3d12_swapchain *swapchain)
d3d12_swapchain_destroy_buffers(swapchain, TRUE);
if (swapchain->frame_latency_event)
CloseHandle(swapchain->frame_latency_event);
if (swapchain->frame_latency_fence)
ID3D12Fence_Release(swapchain->frame_latency_fence);
if (swapchain->command_queue)
ID3D12CommandQueue_Release(swapchain->command_queue);
......@@ -2906,7 +2915,7 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
FIXME("Ignoring scaling %#x.\n", swapchain_desc->Scaling);
if (swapchain_desc->AlphaMode && swapchain_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE)
FIXME("Ignoring alpha mode %#x.\n", swapchain_desc->AlphaMode);
if (swapchain_desc->Flags)
if (swapchain_desc->Flags & ~(DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT))
FIXME("Ignoring swapchain flags %#x.\n", swapchain_desc->Flags);
if (fullscreen_desc->RefreshRate.Numerator || fullscreen_desc->RefreshRate.Denominator)
......@@ -2983,6 +2992,25 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IWineDXGI
return hresult_from_vk_result(vr);
}
if (swapchain_desc->Flags & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT)
{
if (FAILED(hr = ID3D12Device_CreateFence(device, DXGI_MAX_SWAP_CHAIN_BUFFERS,
0, &IID_ID3D12Fence, (void **)&swapchain->frame_latency_fence)))
{
WARN("Failed to create frame latency fence, hr %#x.\n", hr);
d3d12_swapchain_destroy(swapchain);
return hr;
}
if (!(swapchain->frame_latency_event = CreateEventW(NULL, FALSE, TRUE, NULL)))
{
hr = HRESULT_FROM_WIN32(GetLastError());
WARN("Failed to create frame latency event, hr %#x.\n", hr);
d3d12_swapchain_destroy(swapchain);
return hr;
}
}
IWineDXGIFactory_AddRef(swapchain->factory = factory);
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment