Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/d3d11/device.c | 22 +++++++++++++++++----- dlls/d3d11/tests/d3d11.c | 12 +++++------- 2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 4ae146b11a6..ff628eeaae1 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -4061,15 +4061,20 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateRasterizerState1(ID3D11Devic }
static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeviceContextState(ID3D11Device2 *iface, UINT flags, - const D3D_FEATURE_LEVEL *feature_levels, UINT feature_levels_count, UINT sdk_version, + const D3D_FEATURE_LEVEL *feature_levels, UINT feature_level_count, UINT sdk_version, REFIID emulated_interface, D3D_FEATURE_LEVEL *chosen_feature_level, ID3DDeviceContextState **state) { struct d3d_device *device = impl_from_ID3D11Device2(iface); struct d3d_device_context_state *state_impl; + HRESULT hr = E_INVALIDARG;
FIXME("iface %p, flags %#x, feature_levels %p, feature_level_count %u, sdk_version %u, " - "emulated_interface %s, chosen_feature_level %p, state %p semi-stub!\n", iface, flags, feature_levels, - feature_levels_count, sdk_version, debugstr_guid(emulated_interface), chosen_feature_level, state); + "emulated_interface %s, chosen_feature_level %p, state %p semi-stub!\n", + iface, flags, feature_levels, feature_level_count, sdk_version, + debugstr_guid(emulated_interface), chosen_feature_level, state); + + if (!feature_level_count) + goto fail;
if (chosen_feature_level) FIXME("Device context state feature level not implemented yet.\n"); @@ -4078,8 +4083,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeviceContextState(ID3D11Dev { if (!(state_impl = heap_alloc_zero(sizeof(*state_impl)))) { - *state = NULL; - return E_OUTOFMEMORY; + hr = E_OUTOFMEMORY; + goto fail; }
d3d_device_context_state_init(state_impl, device, emulated_interface); @@ -4089,6 +4094,13 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CreateDeviceContextState(ID3D11Dev device->d3d11_only = FALSE; if (chosen_feature_level) *chosen_feature_level = ID3D11Device2_GetFeatureLevel(iface); return state ? S_OK : S_FALSE; + +fail: + if (chosen_feature_level) + *chosen_feature_level = 0; + if (state) + *state = NULL; + return hr; }
static HRESULT STDMETHODCALLTYPE d3d11_device_OpenSharedResource1(ID3D11Device2 *iface, HANDLE handle, diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 1b35e8f4983..acbd1856b08 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -6876,19 +6876,17 @@ static void test_device_context_state(void) context_state = (void *)0xc0de0001; hr = ID3D11Device1_CreateDeviceContextState(device, 0, &feature_level, 0, D3D11_SDK_VERSION, &IID_ID3D11Device1, &selected_feature_level, &context_state); - todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); - todo_wine ok(!selected_feature_level, "Got unexpected feature level %#x.\n", selected_feature_level); - todo_wine ok(!context_state, "Got unexpected context state %p.\n", context_state); - if (SUCCEEDED(hr)) - ID3DDeviceContextState_Release(context_state); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!selected_feature_level, "Got unexpected feature level %#x.\n", selected_feature_level); + ok(!context_state, "Got unexpected context state %p.\n", context_state);
hr = ID3D11Device1_CreateDeviceContextState(device, 0, &feature_level, 0, D3D11_SDK_VERSION, &IID_ID3D11Device1, NULL, NULL); - todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
hr = ID3D11Device1_CreateDeviceContextState(device, 0, NULL, 0, D3D11_SDK_VERSION, &IID_ID3D11Device1, NULL, NULL); - todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
hr = ID3D11Device1_CreateDeviceContextState(device, 0, &feature_level, 1, D3D11_SDK_VERSION, &IID_ID3D11Device1, NULL, &context_state);
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=87001
Your paranoid android.
=== w1064v1809 (32 bit report) ===
d3d11: d3d11.c:5811: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5812: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5813: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5816: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5817: Test failed: Got unexpected CPrimitives count: 0.
=== w1064 (32 bit report) ===
d3d11: d3d11.c:5658: Test failed: Got unexpected query result 0x0000000000000000. d3d11.c:5811: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5812: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5813: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5816: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5817: Test failed: Got unexpected CPrimitives count: 0.
=== debiant2 (32 bit French report) ===
d3d11: Unhandled exception: page fault on read access to 0x00000077 in 32-bit code (0x7e81873f).