=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3d9: Refuse to reset a lost device.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Dec 2 13:40:21 CST 2014
Module: wine
Branch: master
Commit: aa9bc4c509e5956ea276020da733c2f6345aa140
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aa9bc4c509e5956ea276020da733c2f6345aa140
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Mon Dec 1 22:46:46 2014 +0100
d3d9: Refuse to reset a lost device.
---
dlls/d3d9/device.c | 6 ++++++
dlls/d3d9/tests/d3d9ex.c | 17 +++++++++++++++++
dlls/d3d9/tests/device.c | 11 +++++++++++
3 files changed, 34 insertions(+)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 67a5629..e2e3504 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -635,6 +635,12 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_Reset(IDirect3DDevice9Ex *if
TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
+ if (!device->d3d_parent->extended && device->device_state == D3D9_DEVICE_STATE_LOST)
+ {
+ WARN("App not active, returning D3DERR_DEVICELOST.\n");
+ return D3DERR_DEVICELOST;
+ }
+
wined3d_mutex_lock();
if (device->vertex_buffer)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 226e338..0ac9db7 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -1374,6 +1374,23 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ hr = IDirect3DDevice9Ex_Present(device, NULL, NULL, NULL, NULL);
+ ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
+ hr = reset_device(device, &desc);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9Ex_TestCooperativeLevel(device);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9Ex_Present(device, NULL, NULL, NULL, NULL);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9Ex_PresentEx(device, NULL, NULL, NULL, NULL, 0);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9Ex_CheckDeviceState(device, window);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
+ ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
+
refcount = IDirect3DDevice9Ex_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index cd6a9bd..a5cab96 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -9751,6 +9751,17 @@ static void test_lost_device(void)
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+ ret = SetForegroundWindow(GetDesktopWindow());
+ ok(ret, "Failed to set foreground window.\n");
+ hr = reset_device(device, &device_desc);
+ ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr);
+ ret = ShowWindow(window, SW_RESTORE);
+ ok(ret, "Failed to restore window.\n");
+ ret = SetForegroundWindow(window);
+ ok(ret, "Failed to set foreground window.\n");
+ hr = reset_device(device, &device_desc);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
done:
More information about the wine-cvs
mailing list