=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: dxgi/tests: Add test for maximum frame latency.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 26 09:58:34 CDT 2015


Module: wine
Branch: master
Commit: 718d35dcd6ef30818cf2bbc20ac2195fc6906c54
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=718d35dcd6ef30818cf2bbc20ac2195fc6906c54

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Oct 26 02:30:24 2015 +0100

dxgi/tests: Add test for maximum frame latency.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/tests/device.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index 9e676b9..8a4b3f3 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -21,6 +21,12 @@
 #include "d3d11.h"
 #include "wine/test.h"
 
+enum frame_latency
+{
+    DEFAULT_FRAME_LATENCY =  3,
+    MAX_FRAME_LATENCY     = 16,
+};
+
 static DEVMODEW registry_mode;
 
 static HRESULT (WINAPI *pCreateDXGIFactory1)(REFIID iid, void **factory);
@@ -1214,6 +1220,57 @@ static void test_swapchain_parameters(void)
     DestroyWindow(window);
 }
 
+static void test_maximum_frame_latency(void)
+{
+    IDXGIDevice1 *device1;
+    IDXGIDevice *device;
+    UINT max_latency;
+    ULONG refcount;
+    HRESULT hr;
+
+    if (!(device = create_device()))
+    {
+        skip("Failed to create device.\n");
+        return;
+    }
+
+    if (SUCCEEDED(IDXGIDevice_QueryInterface(device, &IID_IDXGIDevice1, (void **)&device1)))
+    {
+        hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
+        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        ok(max_latency == DEFAULT_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
+
+        hr = IDXGIDevice1_SetMaximumFrameLatency(device1, MAX_FRAME_LATENCY);
+        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
+        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        todo_wine ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
+
+        hr = IDXGIDevice1_SetMaximumFrameLatency(device1, MAX_FRAME_LATENCY + 1);
+        ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+        hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
+        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        todo_wine ok(max_latency == MAX_FRAME_LATENCY, "Got unexpected maximum frame latency %u.\n", max_latency);
+
+        hr = IDXGIDevice1_SetMaximumFrameLatency(device1, 0);
+        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        hr = IDXGIDevice1_GetMaximumFrameLatency(device1, &max_latency);
+        todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+        /* 0 does not reset to the default frame latency on all Windows versions. */
+        ok(max_latency == DEFAULT_FRAME_LATENCY || broken(!max_latency),
+                "Got unexpected maximum frame latency %u.\n", max_latency);
+
+        IDXGIDevice1_Release(device1);
+    }
+    else
+    {
+        win_skip("IDXGIDevice1 is not implemented.\n");
+    }
+
+    refcount = IDXGIDevice_Release(device);
+    ok(!refcount, "Device has %u references left.\n", refcount);
+}
+
 START_TEST(device)
 {
     pCreateDXGIFactory1 = (void *)GetProcAddress(GetModuleHandleA("dxgi.dll"), "CreateDXGIFactory1");
@@ -1231,4 +1288,5 @@ START_TEST(device)
     test_private_data();
     test_swapchain_resize();
     test_swapchain_parameters();
+    test_maximum_frame_latency();
 }




More information about the wine-cvs mailing list