d3d11: Partially implement d3d11_device_CheckFeatureSupport().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-06-24 11:46:01 +02:00 committed by Alexandre Julliard
parent 636ad1fd84
commit 60a799f422
3 changed files with 76 additions and 2 deletions

View File

@ -2689,11 +2689,30 @@ 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);
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,
UINT *data_size, void *data)

View File

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

View File

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