d3d9: Improve d3d9_device_CheckDeviceState() a little.

This commit is contained in:
Henri Verbeet 2014-06-30 11:17:00 +02:00 committed by Alexandre Julliard
parent 1aafcbab92
commit ae25b1eca5
2 changed files with 22 additions and 10 deletions

View file

@ -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 stub!\n", iface, dst_window);
TRACE("iface %p, dst_window %p.\n", iface, dst_window);
if (!i++)
FIXME("iface %p, dst_window %p stub!\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();
if (swapchain_desc.windowed)
return D3D_OK;
/* 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 device->device_state == D3D9_DEVICE_STATE_OK ? D3D_OK : S_PRESENT_OCCLUDED;
}
static HRESULT WINAPI d3d9_device_CreateRenderTargetEx(IDirect3DDevice9Ex *iface,

View file

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