ddraw/tests: Re-init for every test_surface_discard iteration.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2e6dc57f31
commit
bc4ad3ca4d
|
@ -4413,6 +4413,18 @@ static void test_surface_discard(void)
|
|||
unsigned int i;
|
||||
|
||||
window = create_window();
|
||||
|
||||
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)))
|
||||
|
@ -4423,13 +4435,9 @@ static void test_surface_discard(void)
|
|||
return;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&target);
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
|
|
|
@ -4943,6 +4943,18 @@ static void test_surface_discard(void)
|
|||
unsigned int i;
|
||||
|
||||
window = create_window();
|
||||
|
||||
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)))
|
||||
|
@ -4956,10 +4968,6 @@ static void test_surface_discard(void)
|
|||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
|
|
|
@ -6565,6 +6565,18 @@ static void test_surface_discard(void)
|
|||
unsigned int i;
|
||||
|
||||
window = create_window();
|
||||
|
||||
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");
|
||||
|
@ -6578,10 +6590,6 @@ static void test_surface_discard(void)
|
|||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
|
|
|
@ -6379,6 +6379,18 @@ static void test_surface_discard(void)
|
|||
unsigned int i;
|
||||
|
||||
window = create_window();
|
||||
|
||||
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");
|
||||
|
@ -6392,10 +6404,6 @@ static void test_surface_discard(void)
|
|||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue