[PATCH 2/2] dxgi: Implement IDXGIFactory5::CheckFeatureSupport().
Zhiyi Zhang
zzhang at codeweavers.com
Fri Apr 10 04:16:19 CDT 2020
From: Hans-Kristian Arntzen <post at arntzen-software.no>
Enable certain D3D12 games to use vsync off, since they gate their use
of swap_interval == 0 on this feature being present.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
v2: Supersede 182386. Return DXGI_ERROR_INVALID_CALL when a feature is invalid.
dlls/dxgi/factory.c | 14 ++++++++++++--
dlls/dxgi/tests/dxgi.c | 10 +++++-----
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c
index 3f41df9e366..0b2ac263b1f 100644
--- a/dlls/dxgi/factory.c
+++ b/dlls/dxgi/factory.c
@@ -445,10 +445,20 @@ 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:
+ 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 75c989cfe0b..034d375d86d 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -6166,7 +6166,7 @@ static void test_factory_check_feature_support(void)
hr = IDXGIFactory5_CheckFeatureSupport(factory, DXGI_FEATURE_PRESENT_ALLOW_TEARING + 1,
(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);
/* Crash on Windows */
if (0)
@@ -6178,17 +6178,17 @@ 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