diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index dfdd0d2f007..03fafc62040 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2689,10 +2689,29 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckCounter(ID3D11Device *iface, static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFeatureSupport(ID3D11Device *iface, D3D11_FEATURE feature, void *feature_support_data, UINT feature_support_data_size) { - FIXME("iface %p, feature %u, feature_support_data %p, feature_support_data_size %u stub!\n", + TRACE("iface %p, feature %u, feature_support_data %p, feature_support_data_size %u.\n", iface, feature, feature_support_data, feature_support_data_size); - return E_NOTIMPL; + switch (feature) + { + case D3D11_FEATURE_THREADING: + { + D3D11_FEATURE_DATA_THREADING *threading_data = feature_support_data; + if (feature_support_data_size != sizeof(*threading_data)) + { + WARN("Invalid data size.\n"); + return E_INVALIDARG; + } + + threading_data->DriverConcurrentCreates = FALSE; + threading_data->DriverCommandLists = FALSE; + return S_OK; + } + + default: + FIXME("Unhandled feature %#x.\n", feature); + return E_NOTIMPL; + } } static HRESULT STDMETHODCALLTYPE d3d11_device_GetPrivateData(ID3D11Device *iface, REFGUID guid, diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 8626b6892db..62c119ab0af 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -8468,6 +8468,54 @@ static void test_null_sampler(void) release_test_context(&test_context); } +static void test_check_feature_support(void) +{ + D3D11_FEATURE_DATA_THREADING threading[2]; + ID3D11Device *device; + ULONG refcount; + HRESULT hr; + + if (!(device = create_device(NULL))) + { + skip("Failed to create device.\n"); + return; + } + + memset(threading, 0xef, sizeof(threading)); + + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, NULL, 0); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, 0); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading) - 1); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading) / 2); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading) + 1); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading) * 2); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + ok(threading[0].DriverConcurrentCreates == 0xefefefef, + "Got unexpected concurrent creates %#x.\n", threading[0].DriverConcurrentCreates); + ok(threading[0].DriverCommandLists == 0xefefefef, + "Got unexpected command lists %#x.\n", threading[0].DriverCommandLists); + ok(threading[1].DriverConcurrentCreates == 0xefefefef, + "Got unexpected concurrent creates %#x.\n", threading[1].DriverConcurrentCreates); + ok(threading[1].DriverCommandLists == 0xefefefef, + "Got unexpected command lists %#x.\n", threading[1].DriverCommandLists); + + hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading)); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(threading->DriverConcurrentCreates == TRUE || threading->DriverConcurrentCreates == FALSE, + "Got unexpected concurrent creates %#x.\n", threading->DriverConcurrentCreates); + ok(threading->DriverCommandLists == TRUE || threading->DriverCommandLists == FALSE, + "Got unexpected command lists %#x.\n", threading->DriverCommandLists); + + refcount = ID3D11Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +} + START_TEST(d3d11) { test_create_device(); @@ -8513,4 +8561,5 @@ START_TEST(d3d11) test_sm4_breakc_instruction(); test_input_assembler(); test_null_sampler(); + test_check_feature_support(); } diff --git a/include/d3d11.idl b/include/d3d11.idl index 9d4d8fdbed6..cd177c2c495 100644 --- a/include/d3d11.idl +++ b/include/d3d11.idl @@ -439,6 +439,12 @@ typedef enum D3D11_FEATURE D3D11_FEATURE_D3D9_SHADOW_SUPPORT } D3D11_FEATURE; +typedef struct D3D11_FEATURE_DATA_THREADING +{ + BOOL DriverConcurrentCreates; + BOOL DriverCommandLists; +} D3D11_FEATURE_DATA_THREADING; + typedef struct D3D11_FEATURE_DATA_D3D11_OPTIONS { BOOL OutputMergerLogicOp;