In order to avoid invalidating system memory for "converted" surfaces.
Fixes a regression introduced by commit 56128d18d4df ("wined3d: Drop the special case for "converted" surfaces in wined3d_surface_blt().").
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/ddraw/tests/ddraw4.c | 9 ++++----- dlls/ddraw/tests/ddraw7.c | 9 ++++----- dlls/wined3d/surface.c | 4 +++- 3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 048331dfc39d..fb42f85b0048 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -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); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d1ff85d5d54f..2fb845378c42 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -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); } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 02e0c70382d8..da22c7ad9aaf 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -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);