frame latency schenangnngngans

This commit is contained in:
Joshua Ashton 2021-02-19 04:00:33 +00:00
parent 19b94899d5
commit aee0445227
No known key found for this signature in database
GPG Key ID: C85A08669126BE8D
1 changed files with 20 additions and 20 deletions

View File

@ -1746,7 +1746,6 @@ static VkResult d3d12_swapchain_queue_present(struct d3d12_swapchain *swapchain,
static HRESULT d3d12_swapchain_present(struct d3d12_swapchain *swapchain,
unsigned int sync_interval, unsigned int flags)
{
HANDLE frame_latency_event;
VkQueue vk_queue;
VkResult vr;
HRESULT hr;
@ -1808,8 +1807,6 @@ static HRESULT d3d12_swapchain_present(struct d3d12_swapchain *swapchain,
return hresult_from_vk_result(vr);
}
if ((frame_latency_event = swapchain->frame_latency_event))
{
++swapchain->frame_number;
if (FAILED(hr = ID3D12CommandQueue_Signal(d3d12_swapchain_queue_iface(swapchain),
@ -1819,8 +1816,11 @@ static HRESULT d3d12_swapchain_present(struct d3d12_swapchain *swapchain,
return hr;
}
if (swapchain->frame_latency_event)
{
if (FAILED(hr = ID3D12Fence_SetEventOnCompletion(swapchain->frame_latency_fence,
swapchain->frame_number - swapchain->frame_latency, frame_latency_event)))
swapchain->frame_number - swapchain->frame_latency,
swapchain->frame_latency_event)))
{
ERR("Failed to enqueue frame latency event, hr %#x.\n", hr);
return hr;
@ -2660,11 +2660,7 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IDXGIFact
swapchain->current_buffer_index = 0;
if (swapchain_desc->Flags & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT)
{
swapchain->frame_number = DXGI_MAX_SWAP_CHAIN_BUFFERS;
swapchain->frame_latency = 1;
if (FAILED(hr = ID3D12Device6_CreateFence(d3d12_swapchain_device_iface(swapchain), DXGI_MAX_SWAP_CHAIN_BUFFERS,
0, &IID_ID3D12Fence, (void **)&swapchain->frame_latency_fence)))
{
@ -2673,6 +2669,10 @@ static HRESULT d3d12_swapchain_init(struct d3d12_swapchain *swapchain, IDXGIFact
return hr;
}
if (swapchain_desc->Flags & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT)
{
swapchain->frame_latency = 1;
if (!(swapchain->frame_latency_event = CreateEventW(NULL, FALSE, TRUE, NULL)))
{
hr = HRESULT_FROM_WIN32(GetLastError());