From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- This supersedes patch 189881. Call ddraw_update_lost_surfaces() before the device state check.
dlls/ddraw/surface.c | 6 +++++- dlls/ddraw/tests/ddraw1.c | 12 ++++++++++++ dlls/ddraw/tests/ddraw2.c | 12 ++++++++++++ dlls/ddraw/tests/ddraw4.c | 12 ++++++++++++ dlls/ddraw/tests/ddraw7.c | 12 ++++++++++++ 5 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 7b7f16e2a3c..a5f032eabfc 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -3785,9 +3785,13 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface) } }
+ if (!ddraw_surface_can_be_lost(surface)) + return DD_OK; ddraw_update_lost_surfaces(surface->ddraw); - surface->is_lost = FALSE; + if (surface->ddraw->device_state == DDRAW_DEVICE_STATE_LOST) + return DDERR_WRONGMODE;
+ surface->is_lost = FALSE; for(i = 0; i < MAX_COMPLEX_ATTACHED; i++) { if (surface->complex_array[i]) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 2fc454a6069..532065a4796 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -7381,12 +7381,24 @@ static void test_lost_device(void) ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(surface); + ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_IsLost(surface); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_IsLost(sysmem_surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(sysmem_surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface_IsLost(sysmem_surface); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); if (vidmem_surface) { hr = IDirectDrawSurface_IsLost(vidmem_surface); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(vidmem_surface); + ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_IsLost(vidmem_surface); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); }
ret = SetForegroundWindow(window1); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 311c7a159df..800dab0fe83 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -8334,12 +8334,24 @@ static void test_lost_device(void) ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(surface); + ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_IsLost(surface); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_IsLost(sysmem_surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(sysmem_surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface_IsLost(sysmem_surface); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); if (vidmem_surface) { hr = IDirectDrawSurface_IsLost(vidmem_surface); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(vidmem_surface); + ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_IsLost(vidmem_surface); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); }
ret = SetForegroundWindow(window1); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 8eee655bba4..d4f4f08e396 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -9731,12 +9731,24 @@ static void test_lost_device(void) ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface4_Restore(surface); + ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface4_IsLost(surface); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface4_IsLost(sysmem_surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface4_Restore(sysmem_surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface4_IsLost(sysmem_surface); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); if (vidmem_surface) { hr = IDirectDrawSurface4_IsLost(vidmem_surface); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface4_Restore(vidmem_surface); + ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface4_IsLost(vidmem_surface); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); }
ret = SetForegroundWindow(window1); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 778b1738fa9..5ea81903c47 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -9489,12 +9489,24 @@ static void test_lost_device(void) ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface7_Flip(surface, NULL, DDFLIP_WAIT); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface7_Restore(surface); + ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface7_IsLost(surface); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface7_IsLost(sysmem_surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface7_Restore(sysmem_surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDrawSurface7_IsLost(sysmem_surface); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); if (vidmem_surface) { hr = IDirectDrawSurface7_IsLost(vidmem_surface); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface7_Restore(vidmem_surface); + ok(hr == DDERR_WRONGMODE, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface7_IsLost(vidmem_surface); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); }
ret = SetForegroundWindow(window1);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76310
Your paranoid android.
=== w1064v1809_2scr (32 bit report) ===
ddraw: ddraw7.c:15545: Test failed: Expected 22 surfaces, got 20.
=== w1064v1809_ja (32 bit report) ===
ddraw: ddraw7.c:4026: Test failed: Lit quad without normals has color 0x00ff0000, expected 0x00000000. ddraw7.c:4039: Test failed: Lit quad with normals has color 0x00ff0000, expected 0x00000000. ddraw7.c:4084: Test failed: Lit quad with non-affine matrix has color 0x00ff0000.
=== debiant (build log) ===
The task timed out