dxgi: Implement dxgi_factory_CheckFeatureSupport().

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

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans-Kristian Arntzen 2020-04-10 21:33:52 +04:30 committed by Alexandre Julliard
parent 5928da917d
commit bbf2836a85
2 changed files with 18 additions and 7 deletions

View File

@ -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 =

View File

@ -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);