Henri Verbeet : dxgi: Implement d3d12_swapchain_GetLastPresentCount().

Alexandre Julliard julliard at winehq.org
Thu Jul 1 15:53:50 CDT 2021


Module: wine
Branch: master
Commit: d55348d2b168c6e5727bbde5a887d5881bc2e836
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d55348d2b168c6e5727bbde5a887d5881bc2e836

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Jul  1 16:56:32 2021 +0200

dxgi: Implement d3d12_swapchain_GetLastPresentCount().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/swapchain.c  | 11 +++++++----
 dlls/dxgi/tests/dxgi.c | 23 ++++++++++-------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index a2a85f75bac..5df483f2615 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -2179,10 +2179,9 @@ static HRESULT d3d12_swapchain_present(struct d3d12_swapchain *swapchain,
         return hresult_from_vk_result(vr);
     }
 
+    ++swapchain->frame_number;
     if ((frame_latency_event = swapchain->frame_latency_event))
     {
-        ++swapchain->frame_number;
-
         if (FAILED(hr = ID3D12CommandQueue_Signal(swapchain->command_queue,
                 swapchain->frame_latency_fence, swapchain->frame_number)))
         {
@@ -2505,9 +2504,13 @@ static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetFrameStatistics(IDXGISwapCha
 static HRESULT STDMETHODCALLTYPE d3d12_swapchain_GetLastPresentCount(IDXGISwapChain4 *iface,
         UINT *last_present_count)
 {
-    FIXME("iface %p, last_present_count %p stub!\n", iface, last_present_count);
+    struct d3d12_swapchain *swapchain = d3d12_swapchain_from_IDXGISwapChain4(iface);
 
-    return E_NOTIMPL;
+    TRACE("iface %p, last_present_count %p.\n", iface, last_present_count);
+
+    *last_present_count = swapchain->frame_number;
+
+    return S_OK;
 }
 
 /* IDXGISwapChain1 methods */
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 1e5f9d9cb22..7a4204c61b5 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -7476,29 +7476,28 @@ static void test_swapchain_present_count(IUnknown *device, BOOL is_d3d12)
 
     present_count = ~0u;
     hr = IDXGISwapChain_GetLastPresentCount(swapchain, &present_count);
-    todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-    todo_wine_if(is_d3d12) ok(!present_count, "Got unexpected present count %u.\n", present_count);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ok(!present_count, "Got unexpected present count %u.\n", present_count);
 
     hr = IDXGISwapChain_Present(swapchain, 0, 0);
     ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
     expected = present_count + 1;
     hr = IDXGISwapChain_GetLastPresentCount(swapchain, &present_count);
-    todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-    todo_wine_if(is_d3d12)
-        ok(present_count == expected, "Got unexpected present count %u, expected %u.\n", present_count, expected);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ok(present_count == expected, "Got unexpected present count %u, expected %u.\n", present_count, expected);
 
     hr = IDXGISwapChain_Present(swapchain, 10, 0);
     ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
     expected = present_count;
     hr = IDXGISwapChain_GetLastPresentCount(swapchain, &present_count);
-    todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
     ok(present_count == expected, "Got unexpected present count %u, expected %u.\n", present_count, expected);
 
     hr = IDXGISwapChain_Present(swapchain, 0, DXGI_PRESENT_TEST);
     ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
     expected = present_count;
     hr = IDXGISwapChain_GetLastPresentCount(swapchain, &present_count);
-    todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
     ok(present_count == expected, "Got unexpected present count %u, expected %u.\n", present_count, expected);
 
     ShowWindow(window, SW_MINIMIZE);
@@ -7506,18 +7505,16 @@ static void test_swapchain_present_count(IUnknown *device, BOOL is_d3d12)
     ok(hr == (is_d3d12 ? S_OK : DXGI_STATUS_OCCLUDED), "Got unexpected hr %#x.\n", hr);
     expected = present_count + !!is_d3d12;
     hr = IDXGISwapChain_GetLastPresentCount(swapchain, &present_count);
-    todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-    todo_wine_if(is_d3d12)
-        ok(present_count == expected, "Got unexpected present count %u, expected %u.\n", present_count, expected);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ok(present_count == expected, "Got unexpected present count %u, expected %u.\n", present_count, expected);
 
     ShowWindow(window, SW_NORMAL);
     hr = IDXGISwapChain_Present(swapchain, 0, 0);
     ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
     expected = present_count + 1;
     hr = IDXGISwapChain_GetLastPresentCount(swapchain, &present_count);
-    todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-    todo_wine_if(is_d3d12)
-        ok(present_count == expected, "Got unexpected present count %u, expected %u.\n", present_count, expected);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ok(present_count == expected, "Got unexpected present count %u, expected %u.\n", present_count, expected);
 
     IDXGISwapChain_Release(swapchain);
     DestroyWindow(window);




More information about the wine-cvs mailing list