Signed-off-by: Stefan Dösinger stefan@codeweavers.com --- dlls/ddraw/tests/ddraw1.c | 39 +++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw2.c | 39 +++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw4.c | 41 ++++++++++++++++++++++++--------------- dlls/ddraw/tests/ddraw7.c | 41 ++++++++++++++++++++++++--------------- 4 files changed, 98 insertions(+), 62 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 98b83334122..5bfca430086 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -4413,23 +4413,31 @@ static void test_surface_discard(void) unsigned int i;
window = create_window(); - ddraw = create_ddraw(); - ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) - { - skip("Failed to create a 3D device, skipping test.\n"); - IDirectDraw_Release(ddraw); - DestroyWindow(window); - return; - } - - hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&target); - ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(tests); i++) { BOOL discarded;
+ /* Sigh. Anything other than the first run of the loop randomly fails with + * DDERR_SURFACELOST on my Radeon Pro 560 on Win10 19.09. Most of the time + * the blit fails, but with sleeps added between surface creation and lock + * the lock can fail too. Interestingly ddraw claims the render target has + * been lost, not the test surface. + * + * Recreating ddraw every iteration seems to fix this. */ + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw_Release(ddraw); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void**)&target); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; @@ -4475,11 +4483,12 @@ static void test_surface_discard(void) /* Windows 7 reliably changes the address of surfaces that are discardable (Nvidia Kepler, * AMD r500, evergreen). Windows XP, at least on AMD r200, never changes the pointer. */ ok(!discarded || tests[i].discard, "Expected surface not to be discarded, case %u\n", i); + + IDirectDrawSurface_Release(target); + IDirect3DDevice_Release(device); + IDirectDraw_Release(ddraw); }
- IDirectDrawSurface_Release(target); - IDirect3DDevice_Release(device); - IDirectDraw_Release(ddraw); DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 7dfb35d2d3a..b472b3d5883 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -4943,23 +4943,31 @@ static void test_surface_discard(void) unsigned int i;
window = create_window(); - ddraw = create_ddraw(); - ok(!!ddraw, "Failed to create a ddraw object.\n"); - if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) - { - skip("Failed to create a 3D device, skipping test.\n"); - DestroyWindow(window); - IDirectDraw2_Release(ddraw); - return; - } - - hr = IDirect3DDevice2_GetRenderTarget(device, &target); - ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(tests); i++) { BOOL discarded;
+ /* Sigh. Anything other than the first run of the loop randomly fails with + * DDERR_SURFACELOST on my Radeon Pro 560 on Win10 19.09. Most of the time + * the blit fails, but with sleeps added between surface creation and lock + * the lock can fail too. Interestingly ddraw claims the render target has + * been lost, not the test surface. + * + * Recreating ddraw every iteration seems to fix this. */ + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + IDirectDraw2_Release(ddraw); + return; + } + + hr = IDirect3DDevice2_GetRenderTarget(device, &target); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; @@ -5005,11 +5013,12 @@ static void test_surface_discard(void) /* Windows 7 reliably changes the address of surfaces that are discardable (Nvidia Kepler, * AMD r500, evergreen). Windows XP, at least on AMD r200, never changes the pointer. */ ok(!discarded || tests[i].discard, "Expected surface not to be discarded, case %u\n", i); + + IDirectDrawSurface_Release(target); + IDirect3DDevice2_Release(device); + IDirectDraw2_Release(ddraw); }
- IDirectDrawSurface_Release(target); - IDirect3DDevice2_Release(device); - IDirectDraw2_Release(ddraw); DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index e1d5bac18bb..1e6cf4c446a 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -6565,23 +6565,31 @@ static void test_surface_discard(void) unsigned int i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) - { - skip("Failed to create a 3D device, skipping test.\n"); - DestroyWindow(window); - return; - } - hr = IDirect3DDevice3_GetDirect3D(device, &d3d); - ok(SUCCEEDED(hr), "Failed to get d3d interface, hr %#x.\n", hr); - hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw); - ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr); - hr = IDirect3DDevice3_GetRenderTarget(device, &target); - ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(tests); i++) { BOOL discarded;
+ /* Sigh. Anything other than the first run of the loop randomly fails with + * DDERR_SURFACELOST on my Radeon Pro 560 on Win10 19.09. Most of the time + * the blit fails, but with sleeps added between surface creation and lock + * the lock can fail too. Interestingly ddraw claims the render target has + * been lost, not the test surface. + * + * Recreating ddraw every iteration seems to fix this. */ + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + hr = IDirect3DDevice3_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get d3d interface, hr %#x.\n", hr); + hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw); + ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr); + hr = IDirect3DDevice3_GetRenderTarget(device, &target); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; @@ -6624,12 +6632,13 @@ static void test_surface_discard(void) /* Windows 7 reliably changes the address of surfaces that are discardable (Nvidia Kepler, * AMD r500, evergreen). Windows XP, at least on AMD r200, does not. */ ok(!discarded || tests[i].discard, "Expected surface not to be discarded, case %u\n", i); + + IDirectDrawSurface4_Release(target); + IDirectDraw4_Release(ddraw); + IDirect3D3_Release(d3d); + IDirect3DDevice3_Release(device); }
- IDirectDrawSurface4_Release(target); - IDirectDraw4_Release(ddraw); - IDirect3D3_Release(d3d); - IDirect3DDevice3_Release(device); DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 3ad44991863..bdec30621e3 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -6379,23 +6379,31 @@ static void test_surface_discard(void) unsigned int i;
window = create_window(); - if (!(device = create_device(window, DDSCL_NORMAL))) - { - skip("Failed to create a 3D device, skipping test.\n"); - DestroyWindow(window); - return; - } - hr = IDirect3DDevice7_GetDirect3D(device, &d3d); - ok(SUCCEEDED(hr), "Failed to get d3d interface, hr %#x.\n", hr); - hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw); - ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr); - hr = IDirect3DDevice7_GetRenderTarget(device, &target); - ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
for (i = 0; i < ARRAY_SIZE(tests); ++i) { BOOL discarded;
+ /* Sigh. Anything other than the first run of the loop randomly fails with + * DDERR_SURFACELOST on my Radeon Pro 560 on Win10 19.09. Most of the time + * the blit fails, but with sleeps added between surface creation and lock + * the lock can fail too. Interestingly ddraw claims the render target has + * been lost, not the test surface. + * + * Recreating ddraw every iteration seems to fix this. */ + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + hr = IDirect3DDevice7_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get d3d interface, hr %#x.\n", hr); + hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw); + ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr); + hr = IDirect3DDevice7_GetRenderTarget(device, &target); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; @@ -6438,12 +6446,13 @@ static void test_surface_discard(void) /* Windows 7 reliably changes the address of surfaces that are discardable (Nvidia Kepler, * AMD r500, evergreen). Windows XP, at least on AMD r200, does not. */ ok(!discarded || tests[i].discard, "Expected surface not to be discarded, case %u\n", i); + + IDirectDrawSurface7_Release(target); + IDirectDraw7_Release(ddraw); + IDirect3D7_Release(d3d); + IDirect3DDevice7_Release(device); }
- IDirectDrawSurface7_Release(target); - IDirectDraw7_Release(ddraw); - IDirect3D7_Release(d3d); - IDirect3DDevice7_Release(device); DestroyWindow(window); }
Signed-off-by: Stefan Dösinger stefan@codeweavers.com --- dlls/ddraw/tests/ddraw7.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index bdec30621e3..5c0c5bb7c39 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -17127,16 +17127,16 @@ static void test_compressed_surface_stretch(void) { U4(src_surface_desc).ddpfPixelFormat = test_formats[k].fmt; hr = IDirectDraw7_CreateSurface(ddraw, &src_surface_desc, &src_surf, NULL); - ok(hr == DD_OK, "Test (%u, %u, %u, %u), got unexpected hr %#x.\n", i, j, k, l, hr); + ok(hr == DD_OK, "Test (%u, %u, %u), got unexpected hr %#x.\n", i, j, k, hr);
U5(fx).dwFillColor = 0x801f; hr = IDirectDrawSurface7_Blt(rb_surf, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); - ok(hr == DD_OK, "Test (%u, %u, %u, %u), got unexpected hr %#x.\n", i, j, k, l, hr); + ok(hr == DD_OK, "Test (%u, %u, %u), got unexpected hr %#x.\n", i, j, k, hr);
hr = IDirectDrawSurface7_Blt(src_surf, &src_rect, rb_surf, &src_rect, DDBLT_WAIT, NULL);
todo_wine_if(test_formats[k].fmt.dwFlags == DDPF_FOURCC && test_sizes[j].todo_src) - ok(hr == DD_OK, "Test (%u, %u, %u, %u), got unexpected hr %#x.\n", i, j, k, l, hr); + ok(hr == DD_OK, "Test (%u, %u, %u), got unexpected hr %#x.\n", i, j, k, hr); if (FAILED(hr)) { IDirectDrawSurface7_Release(src_surf);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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=67147
Your paranoid android.
=== w8adm (32 bit report) ===
ddraw: ddraw1.c:11154: Test failed: Got unexpected color 0x00ffffff.
=== w1064v1809 (64 bit report) ===
ddraw: ddraw2.c:8141: Test failed: Failed to set foreground window. ddraw2.c:8143: Test failed: Got unexpected hr 0. ddraw2.c:8145: Test failed: Got unexpected hr 0. ddraw2.c:8148: Test failed: Failed to set foreground window. ddraw2.c:8150: Test failed: Got unexpected hr 0. ddraw2.c:8152: Test failed: Got unexpected hr 0. ddraw2.c:8164: Test failed: Got unexpected hr 0. ddraw2.c:8166: Test failed: Got unexpected hr 0x887600e1. ddraw2.c:8182: Test failed: Failed to set foreground window. ddraw2.c:8187: Test failed: Failed to set foreground window. ddraw2.c:13461: Test failed: WM_KILLFOCUS was not received. ddraw2.c:13497: Test failed: Got unexpected hr 0x887600e1. ddraw2.c:13500: Test failed: Got unexpected hr 0x887600ff. 1804:ddraw2: unhandled exception c0000005 at 0000000000443D9E