[PATCH 1/5] d3d9: Improve d3d9_device_CheckDeviceState() a little.
Henri Verbeet
hverbeet at codeweavers.com
Mon Jun 30 04:17:00 CDT 2014
---
dlls/d3d9/device.c | 22 +++++++++++++++++-----
dlls/d3d9/tests/d3d9ex.c | 10 +++++-----
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 2d9a192..d9aba20 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3147,14 +3147,26 @@ static HRESULT WINAPI d3d9_device_GetMaximumFrameLatency(IDirect3DDevice9Ex *ifa
static HRESULT WINAPI d3d9_device_CheckDeviceState(IDirect3DDevice9Ex *iface, HWND dst_window)
{
- static int i;
+ struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
+ struct wined3d_swapchain_desc swapchain_desc;
+ struct wined3d_swapchain *swapchain;
+
+ TRACE("iface %p, dst_window %p.\n", iface, dst_window);
+
+ wined3d_mutex_lock();
+ swapchain = wined3d_device_get_swapchain(device->wined3d_device, 0);
+ wined3d_swapchain_get_desc(swapchain, &swapchain_desc);
+ wined3d_mutex_unlock();
- TRACE("iface %p, dst_window %p stub!\n", iface, dst_window);
+ if (swapchain_desc.windowed)
+ return D3D_OK;
- if (!i++)
- FIXME("iface %p, dst_window %p stub!\n", iface, dst_window);
+ /* FIXME: This is actually supposed to check if any other device is in
+ * fullscreen mode. */
+ if (dst_window != swapchain_desc.device_window)
+ return device->device_state == D3D9_DEVICE_STATE_OK ? S_PRESENT_OCCLUDED : D3D_OK;
- return D3D_OK;
+ return device->device_state == D3D9_DEVICE_STATE_OK ? D3D_OK : S_PRESENT_OCCLUDED;
}
static HRESULT WINAPI d3d9_device_CreateRenderTargetEx(IDirect3DDevice9Ex *iface,
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 89238c8..0309013 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -1219,7 +1219,7 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, window);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
- todo_wine ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -1230,7 +1230,7 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_PresentEx(device, NULL, NULL, NULL, NULL, 0);
ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_CheckDeviceState(device, window);
- todo_wine ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
@@ -1245,7 +1245,7 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, window);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
- todo_wine ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
hr = reset_device(device, window, FALSE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
@@ -1258,7 +1258,7 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, window);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
- todo_wine ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
hr = reset_device(device, window, TRUE);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
@@ -1323,7 +1323,7 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, window);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
- todo_wine ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
+ ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
refcount = IDirect3DDevice9Ex_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
--
1.7.10.4
More information about the wine-patches
mailing list