From: Hans-Kristian Arntzen post@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@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);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=69293
Your paranoid android.
=== w1064v1809_he (32 bit report) ===
dxgi: dxgi.c:2482: Test failed: Got unexpected hr 0x887a0022. dxgi.c:2485: Test failed: Got unexpected fullscreen 0. dxgi.c:2488: Test failed: Got unexpected hr 0x887a0022. dxgi.c:2491: Test failed: Got unexpected fullscreen 0.
=== w1064v1809_zh_CN (32 bit report) ===
dxgi: dxgi.c:2482: Test failed: Got unexpected hr 0x887a0022. dxgi.c:2485: Test failed: Got unexpected fullscreen 0. dxgi.c:2488: Test failed: Got unexpected hr 0x887a0022. dxgi.c:2491: Test failed: Got unexpected fullscreen 0.