Commit 0885e3f5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Mark surfaces as lost when changing the display mode.

parent dfead1bf
...@@ -695,6 +695,8 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface) ...@@ -695,6 +695,8 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface)
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, NULL))) if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, NULL)))
ddraw->flags &= ~DDRAW_RESTORE_MODE; ddraw->flags &= ~DDRAW_RESTORE_MODE;
InterlockedCompareExchange(&ddraw->device_state, DDRAW_DEVICE_STATE_NOT_RESTORED, DDRAW_DEVICE_STATE_OK);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
...@@ -1129,6 +1131,8 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW ...@@ -1129,6 +1131,8 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode))) if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode)))
ddraw->flags |= DDRAW_RESTORE_MODE; ddraw->flags |= DDRAW_RESTORE_MODE;
InterlockedCompareExchange(&ddraw->device_state, DDRAW_DEVICE_STATE_NOT_RESTORED, DDRAW_DEVICE_STATE_OK);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
switch (hr) switch (hr)
......
...@@ -2783,7 +2783,7 @@ static void test_coop_level_mode_set(void) ...@@ -2783,7 +2783,7 @@ static void test_coop_level_mode_set(void)
hr = IDirectDraw_RestoreDisplayMode(ddraw); hr = IDirectDraw_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary); hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; expect_messages = NULL;
...@@ -2946,7 +2946,7 @@ static void test_coop_level_mode_set(void) ...@@ -2946,7 +2946,7 @@ static void test_coop_level_mode_set(void)
hr = IDirectDraw_RestoreDisplayMode(ddraw); hr = IDirectDraw_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary); hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; expect_messages = NULL;
......
...@@ -2950,7 +2950,7 @@ static void test_coop_level_mode_set(void) ...@@ -2950,7 +2950,7 @@ static void test_coop_level_mode_set(void)
hr = IDirectDraw_RestoreDisplayMode(ddraw); hr = IDirectDraw_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary); hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; expect_messages = NULL;
...@@ -3113,7 +3113,7 @@ static void test_coop_level_mode_set(void) ...@@ -3113,7 +3113,7 @@ static void test_coop_level_mode_set(void)
hr = IDirectDraw2_RestoreDisplayMode(ddraw); hr = IDirectDraw2_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(primary); hr = IDirectDrawSurface_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; expect_messages = NULL;
......
...@@ -3086,7 +3086,7 @@ static void test_coop_level_mode_set(void) ...@@ -3086,7 +3086,7 @@ static void test_coop_level_mode_set(void)
hr = IDirectDraw4_RestoreDisplayMode(ddraw); hr = IDirectDraw4_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(primary); hr = IDirectDrawSurface4_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; expect_messages = NULL;
...@@ -3249,7 +3249,7 @@ static void test_coop_level_mode_set(void) ...@@ -3249,7 +3249,7 @@ static void test_coop_level_mode_set(void)
hr = IDirectDraw4_RestoreDisplayMode(ddraw); hr = IDirectDraw4_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(primary); hr = IDirectDrawSurface4_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; expect_messages = NULL;
......
...@@ -2812,7 +2812,7 @@ static void test_coop_level_mode_set(void) ...@@ -2812,7 +2812,7 @@ static void test_coop_level_mode_set(void)
hr = IDirectDraw7_RestoreDisplayMode(ddraw); hr = IDirectDraw7_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(primary); hr = IDirectDrawSurface7_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; expect_messages = NULL;
...@@ -2975,7 +2975,7 @@ static void test_coop_level_mode_set(void) ...@@ -2975,7 +2975,7 @@ static void test_coop_level_mode_set(void)
hr = IDirectDraw7_RestoreDisplayMode(ddraw); hr = IDirectDraw7_RestoreDisplayMode(ddraw);
ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(primary); hr = IDirectDrawSurface7_IsLost(primary);
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message);
expect_messages = NULL; expect_messages = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment