=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: d3d8: 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: 8dd44e28013e531293b2e060254684562f7171fc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8dd44e28013e531293b2e060254684562f7171fc

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Dec  1 22:46:47 2014 +0100

d3d8: Refuse to reset a lost device.

---

 dlls/d3d8/device.c       |  6 ++++++
 dlls/d3d8/tests/device.c | 11 +++++++++++
 2 files changed, 17 insertions(+)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 4c17e7c..659cae6 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -647,6 +647,12 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
 
     TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
 
+    if (device->device_state == D3D8_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/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 6a4dcc2..33d3cd5 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -6863,6 +6863,17 @@ static void test_lost_device(void)
     hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
     todo_wine ok(hr == D3DERR_DEVICELOST, "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 = IDirect3DDevice8_Release(device);
     ok(!refcount, "Device has %u references left.\n", refcount);
 done:




More information about the wine-cvs mailing list