Commit bbf2836a authored by Hans-Kristian Arntzen's avatar Hans-Kristian Arntzen Committed by Alexandre Julliard

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: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 5928da91
...@@ -445,10 +445,21 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumWarpAdapter(IWineDXGIFactory * ...@@ -445,10 +445,21 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumWarpAdapter(IWineDXGIFactory *
static HRESULT STDMETHODCALLTYPE dxgi_factory_CheckFeatureSupport(IWineDXGIFactory *iface, static HRESULT STDMETHODCALLTYPE dxgi_factory_CheckFeatureSupport(IWineDXGIFactory *iface,
DXGI_FEATURE feature, void *feature_data, UINT data_size) 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); 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 = static const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl =
......
...@@ -6164,7 +6164,7 @@ static void test_factory_check_feature_support(void) ...@@ -6164,7 +6164,7 @@ static void test_factory_check_feature_support(void)
} }
hr = IDXGIFactory5_CheckFeatureSupport(factory, 0x12345678, (void *)&data, sizeof(data)); 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. */ /* Crashes on Windows. */
if (0) if (0)
...@@ -6174,15 +6174,15 @@ static void test_factory_check_feature_support(void) ...@@ -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); 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); 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; data = (BOOL)0xdeadbeef;
hr = IDXGIFactory5_CheckFeatureSupport(factory, DXGI_FEATURE_PRESENT_ALLOW_TEARING, &data, sizeof(data)); hr = IDXGIFactory5_CheckFeatureSupport(factory, DXGI_FEATURE_PRESENT_ALLOW_TEARING, &data, sizeof(data));
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
todo_wine ok(data == TRUE || data == FALSE, "Got unexpected data %#x.\n", data); ok(data == TRUE || data == FALSE, "Got unexpected data %#x.\n", data);
ref_count = IDXGIFactory5_Release(factory); ref_count = IDXGIFactory5_Release(factory);
ok(!ref_count, "Factory has %u references left.\n", ref_count); ok(!ref_count, "Factory has %u references left.\n", ref_count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment