[PATCH 4/4] dxgi: Implement dxgi_factory_CheckFeatureSupport().

Henri Verbeet hverbeet at codeweavers.com
Fri Apr 10 12:03:52 CDT 2020


From: Hans-Kristian Arntzen <post at arntzen-software.no>

Some d3d12 games gate their use of sync interval 0 on support for
DXGI_FEATURE_PRESENT_ALLOW_TEARING.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
This supersedes patch 183171; minor style changes only. Thank you Zhiyi.

 dlls/dxgi/factory.c    | 15 +++++++++++++--
 dlls/dxgi/tests/dxgi.c | 10 +++++-----
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c
index 3f41df9e366..39c9e10f7a4 100644
--- a/dlls/dxgi/factory.c
+++ b/dlls/dxgi/factory.c
@@ -445,10 +445,21 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumWarpAdapter(IWineDXGIFactory *
 static HRESULT STDMETHODCALLTYPE dxgi_factory_CheckFeatureSupport(IWineDXGIFactory *iface,
         DXGI_FEATURE feature, void *feature_data, UINT data_size)
 {
-    FIXME("iface %p, feature %#x, feature_data %p, data_size %u stub!\n",
+    TRACE("iface %p, feature %#x, feature_data %p, data_size %u.\n",
             iface, feature, feature_data, data_size);
 
-    return E_NOTIMPL;
+    switch (feature)
+    {
+        case DXGI_FEATURE_PRESENT_ALLOW_TEARING:
+            if (data_size != sizeof(BOOL))
+                return DXGI_ERROR_INVALID_CALL;
+            *(BOOL *)feature_data = TRUE;
+            return S_OK;
+
+        default:
+            WARN("Unsupported feature %#x.\n", feature);
+            return DXGI_ERROR_INVALID_CALL;
+    }
 }
 
 static const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl =
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index cb6ef6c0ec6..3887982634f 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -6164,7 +6164,7 @@ static void test_factory_check_feature_support(void)
     }
 
     hr = IDXGIFactory5_CheckFeatureSupport(factory, 0x12345678, (void *)&data, sizeof(data));
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     /* Crashes on Windows. */
     if (0)
@@ -6174,15 +6174,15 @@ static void test_factory_check_feature_support(void)
     }
 
     hr = IDXGIFactory5_CheckFeatureSupport(factory, DXGI_FEATURE_PRESENT_ALLOW_TEARING, &data, sizeof(data) - 1);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     hr = IDXGIFactory5_CheckFeatureSupport(factory, DXGI_FEATURE_PRESENT_ALLOW_TEARING, &data, sizeof(data) + 1);
-    todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
 
     data = (BOOL)0xdeadbeef;
     hr = IDXGIFactory5_CheckFeatureSupport(factory, DXGI_FEATURE_PRESENT_ALLOW_TEARING, &data, sizeof(data));
-    todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-    todo_wine ok(data == TRUE || data == FALSE, "Got unexpected data %#x.\n", data);
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ok(data == TRUE || data == FALSE, "Got unexpected data %#x.\n", data);
 
     ref_count = IDXGIFactory5_Release(factory);
     ok(!ref_count, "Factory has %u references left.\n", ref_count);
-- 
2.20.1




More information about the wine-devel mailing list