d3d9: Refuse to reset a lost device.
This commit is contained in:
parent
d68b81cacb
commit
aa9bc4c509
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user