wined3d: Consider CPU blitter when clearing discarded textures.

In order to avoid invalidating system memory for "converted" surfaces.

Fixes a regression introduced by commit 56128d18d4 ("wined3d: Drop the
special case for "converted" surfaces in wined3d_surface_blt().").

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-12-21 12:08:25 +01:00 committed by Alexandre Julliard
parent 724f68c455
commit d38076fd57
3 changed files with 11 additions and 11 deletions

View File

@ -9960,11 +9960,10 @@ static void test_color_fill(void)
hr = IDirectDrawSurface4_Lock(surface, NULL, &surface_desc, DDLOCK_READONLY, 0);
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x, surface %s.\n", hr, tests[i].name);
color = surface_desc.lpSurface;
todo_wine_if(tests[i].caps & DDSCAPS_VIDEOMEMORY && U3(z_fmt).dwZBitMask != 0xffff)
ok((*color & U3(z_fmt).dwZBitMask) == (tests[i].result & U3(z_fmt).dwZBitMask)
|| broken((*color & U3(z_fmt).dwZBitMask) == (expected_broken & U3(z_fmt).dwZBitMask)),
"Got clear result 0x%08x, expected 0x%08x, surface %s.\n",
*color & U3(z_fmt).dwZBitMask, tests[i].result & U3(z_fmt).dwZBitMask, tests[i].name);
ok((*color & U3(z_fmt).dwZBitMask) == (tests[i].result & U3(z_fmt).dwZBitMask)
|| broken((*color & U3(z_fmt).dwZBitMask) == (expected_broken & U3(z_fmt).dwZBitMask)),
"Got clear result 0x%08x, expected 0x%08x, surface %s.\n",
*color & U3(z_fmt).dwZBitMask, tests[i].result & U3(z_fmt).dwZBitMask, tests[i].name);
hr = IDirectDrawSurface4_Unlock(surface, NULL);
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x, surface %s.\n", hr, tests[i].name);
}

View File

@ -9911,11 +9911,10 @@ static void test_color_fill(void)
hr = IDirectDrawSurface7_Lock(surface, NULL, &surface_desc, DDLOCK_READONLY, 0);
ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x, surface %s.\n", hr, tests[i].name);
color = surface_desc.lpSurface;
todo_wine_if(tests[i].caps & DDSCAPS_VIDEOMEMORY && U3(z_fmt).dwZBitMask != 0xffff)
ok((*color & U3(z_fmt).dwZBitMask) == (tests[i].result & U3(z_fmt).dwZBitMask)
|| broken((*color & U3(z_fmt).dwZBitMask) == (expected_broken & U3(z_fmt).dwZBitMask)),
"Got clear result 0x%08x, expected 0x%08x, surface %s.\n",
*color & U3(z_fmt).dwZBitMask, tests[i].result & U3(z_fmt).dwZBitMask, tests[i].name);
ok((*color & U3(z_fmt).dwZBitMask) == (tests[i].result & U3(z_fmt).dwZBitMask)
|| broken((*color & U3(z_fmt).dwZBitMask) == (expected_broken & U3(z_fmt).dwZBitMask)),
"Got clear result 0x%08x, expected 0x%08x, surface %s.\n",
*color & U3(z_fmt).dwZBitMask, tests[i].result & U3(z_fmt).dwZBitMask, tests[i].name);
hr = IDirectDrawSurface7_Unlock(surface, NULL);
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x, surface %s.\n", hr, tests[i].name);
}

View File

@ -2698,13 +2698,15 @@ static BOOL ffp_blitter_use_cpu_clear(struct wined3d_rendertarget_view *view)
{
struct wined3d_resource *resource;
struct wined3d_texture *texture;
DWORD locations;
resource = view->resource;
if (resource->type == WINED3D_RTYPE_BUFFER)
return resource->pool == WINED3D_POOL_SYSTEM_MEM;
texture = texture_from_resource(resource);
if (texture->sub_resources[view->sub_resource_idx].locations & resource->map_binding)
locations = texture->sub_resources[view->sub_resource_idx].locations;
if (locations & (resource->map_binding | WINED3D_LOCATION_DISCARDED))
return resource->pool == WINED3D_POOL_SYSTEM_MEM || (texture->flags & WINED3D_TEXTURE_PIN_SYSMEM);
return resource->pool == WINED3D_POOL_SYSTEM_MEM && !(texture->flags & WINED3D_TEXTURE_CONVERTED);