dxgi: Create frame latency events for d3d12 swapchains if requested.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
682d2fd5e6
commit
86c1ca8760
|
@ -1094,6 +1094,9 @@ struct d3d12_swapchain
|
||||||
IDXGIOutput *target;
|
IDXGIOutput *target;
|
||||||
DXGI_SWAP_CHAIN_DESC1 desc;
|
DXGI_SWAP_CHAIN_DESC1 desc;
|
||||||
DXGI_SWAP_CHAIN_FULLSCREEN_DESC fullscreen_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)
|
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);
|
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)
|
if (swapchain->command_queue)
|
||||||
ID3D12CommandQueue_Release(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);
|
FIXME("Ignoring scaling %#x.\n", swapchain_desc->Scaling);
|
||||||
if (swapchain_desc->AlphaMode && swapchain_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE)
|
if (swapchain_desc->AlphaMode && swapchain_desc->AlphaMode != DXGI_ALPHA_MODE_IGNORE)
|
||||||
FIXME("Ignoring alpha mode %#x.\n", swapchain_desc->AlphaMode);
|
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);
|
FIXME("Ignoring swapchain flags %#x.\n", swapchain_desc->Flags);
|
||||||
|
|
||||||
if (fullscreen_desc->RefreshRate.Numerator || fullscreen_desc->RefreshRate.Denominator)
|
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);
|
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);
|
IWineDXGIFactory_AddRef(swapchain->factory = factory);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
Loading…
Reference in New Issue