Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3d8/tests/visual.c | 87 +++++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 41fc0cbf16a..87b3c120b4f 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5639,7 +5639,7 @@ static void add_dirty_rect_test(void) ok(color_match(color, 0x0000ff00, 1), "Expected color 0x0000ff00, got 0x%08x.\n", color);
- /* Locks with NO_DIRTY_UPDATE are ignored. */ + /* UpdateTexture() ignores locks made with D3DLOCK_NO_DIRTY_UPDATE. */ fill_surface(surface_src_green, 0x00000080, D3DLOCK_NO_DIRTY_UPDATE); hr = IDirect3DDevice8_UpdateTexture(device, (IDirect3DBaseTexture8 *)tex_src_green, (IDirect3DBaseTexture8 *)tex_dst2); @@ -5651,6 +5651,15 @@ static void add_dirty_rect_test(void) hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
+ /* Manually copying the surface works, though. */ + hr = IDirect3DDevice8_CopyRects(device, surface_src_green, NULL, 0, surface_dst2, NULL); + ok(hr == D3D_OK, "Failed to copy rects, hr %#x.\n", hr); + add_dirty_rect_test_draw(device); + color = getPixelColor(device, 320, 240); + ok(color_match(color, 0x00000080, 1), "Got unexpected colour 0x%08x.\n", color); + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3D_OK, "Failed to present, hr %#x.\n", hr); + /* Readonly maps write to D3DPOOL_SYSTEMMEM, but don't record a dirty rectangle. */ fill_surface(surface_src_green, 0x000000ff, D3DLOCK_READONLY); hr = IDirect3DDevice8_UpdateTexture(device, (IDirect3DBaseTexture8 *)tex_src_green, @@ -5658,8 +5667,7 @@ static void add_dirty_rect_test(void) ok(SUCCEEDED(hr), "Failed to update texture, hr %#x.\n", hr); add_dirty_rect_test_draw(device); color = getPixelColor(device, 320, 240); - ok(color_match(color, 0x0000ff00, 1), - "Expected color 0x0000ff00, got 0x%08x.\n", color); + ok(color_match(color, 0x00000080, 1), "Got unexpected colour 0x%08x.\n", color); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
@@ -5724,7 +5732,7 @@ static void add_dirty_rect_test(void) hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
- /* UpdateSurface ignores the missing dirty marker. */ + /* CopyRects() ignores the missing dirty marker. */ hr = IDirect3DDevice8_UpdateTexture(device, (IDirect3DBaseTexture8 *)tex_src_red, (IDirect3DBaseTexture8 *)tex_dst2); hr = IDirect3DDevice8_CopyRects(device, surface_src_green, NULL, 0, surface_dst2, NULL); @@ -5775,17 +5783,28 @@ static void add_dirty_rect_test(void) ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
/* AddDirtyRect uploads the new contents. - * Side note, not tested in the test: Partial surface updates work, and two separate - * dirty rectangles are tracked individually. Tested on Nvidia Kepler, other drivers - * untested. */ - hr = IDirect3DTexture8_AddDirtyRect(tex_managed, NULL); - ok(SUCCEEDED(hr), "Failed to add dirty rect, hr %#x.\n", hr); + * Partial surface updates work, and two separate dirty rectangles are + * tracked individually. Tested on Nvidia Kepler, other drivers untested. */ + hr = IDirect3DTexture8_AddDirtyRect(tex_managed, &part_rect); + ok(hr == S_OK, "Failed to add dirty rect, hr %#x.\n", hr); add_dirty_rect_test_draw(device); color = getPixelColor(device, 320, 240); - ok(color_match(color, 0x0000ff00, 1), - "Expected color 0x0000ff00, got 0x%08x.\n", color); + ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 1, 1); + todo_wine ok(color_match(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + + hr = IDirect3DTexture8_AddDirtyRect(tex_managed, NULL); + ok(hr == S_OK, "Failed to add dirty rect, hr %#x.\n", hr); + add_dirty_rect_test_draw(device); + color = getPixelColor(device, 320, 240); + ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 1, 1); + ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color); + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MAXMIPLEVEL, 1); ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr); add_dirty_rect_test_draw(device); @@ -5812,6 +5831,18 @@ static void add_dirty_rect_test(void) hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
+ /* Test blitting from a managed texture. */ + fill_surface(surface_managed0, 0x0000ff00, D3DLOCK_NO_DIRTY_UPDATE); + hr = IDirect3DDevice8_CopyRects(device, surface_managed0, NULL, 0, surface_dst2, NULL); + ok(hr == D3D_OK, "Failed to update surface, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)tex_dst2); + ok(hr == D3D_OK, "Failed to set texture, hr %#x.\n", hr); + add_dirty_rect_test_draw(device); + color = getPixelColor(device, 320, 240); + ok(color_match(color, 0x0000ff00, 1), "Got unexpected colour 0x%08x.\n", color); + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3D_OK, "Failed to present, hr %#x.\n", hr); + /* Tests with dynamic textures */ fill_surface(surface_dynamic, 0x0000ffff, 0); hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)tex_dynamic); @@ -5869,6 +5900,40 @@ static void add_dirty_rect_test(void) IDirect3DTexture8_Release(tex_dst2); IDirect3DTexture8_Release(tex_managed); IDirect3DTexture8_Release(tex_dynamic); + + /* As above, test CopyRect() after locking the source with + * D3DLOCK_NO_DIRTY_UPDATE, but this time do it immediately after creating + * the destination texture. This is a regression test for a previously + * broken code path. */ + + hr = IDirect3DDevice8_CreateTexture(device, 256, 256, 1, 0, D3DFMT_X8R8G8B8, + D3DPOOL_DEFAULT, &tex_dst2); + ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr); + hr = IDirect3DDevice8_CreateTexture(device, 256, 256, 1, 0, D3DFMT_X8R8G8B8, + D3DPOOL_SYSTEMMEM, &tex_src_green); + ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr); + + hr = IDirect3DTexture8_GetSurfaceLevel(tex_dst2, 0, &surface_dst2); + ok(hr == D3D_OK, "Failed to get surface level, hr %#x.\n", hr); + hr = IDirect3DTexture8_GetSurfaceLevel(tex_src_green, 0, &surface_src_green); + ok(hr == D3D_OK, "Failed to get surface level, hr %#x.\n", hr); + + hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)tex_dst2); + ok(hr == D3D_OK, "Failed to set texture, hr %#x.\n", hr); + fill_surface(surface_src_green, 0x00ff0000, D3DLOCK_NO_DIRTY_UPDATE); + hr = IDirect3DDevice8_CopyRects(device, surface_src_green, NULL, 0, surface_dst2, NULL); + ok(hr == D3D_OK, "Failed to copy rects, hr %#x.\n", hr); + add_dirty_rect_test_draw(device); + color = getPixelColor(device, 320, 240); + todo_wine ok(color_match(color, 0x00ff0000, 1), "Got unexpected colour 0x%08x.\n", color); + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3D_OK, "Failed to present, hr %#x.\n", hr); + + IDirect3DSurface8_Release(surface_dst2); + IDirect3DSurface8_Release(surface_src_green); + IDirect3DTexture8_Release(tex_dst2); + IDirect3DTexture8_Release(tex_src_green); + refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); done:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3d9/tests/visual.c | 77 ++++++++++++++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 14 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 9f9055483b1..cd1486b7980 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -19502,7 +19502,7 @@ static void add_dirty_rect_test(void) ok(color_match(color, 0x0000ff00, 1), "Expected color 0x0000ff00, got 0x%08x.\n", color);
- /* Locks with NO_DIRTY_UPDATE are ignored. */ + /* UpdateTexture() ignores locks made with D3DLOCK_NO_DIRTY_UPDATE. */ fill_surface(surface_src_green, 0x00000080, D3DLOCK_NO_DIRTY_UPDATE); hr = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)tex_src_green, (IDirect3DBaseTexture9 *)tex_dst2); @@ -19514,6 +19514,15 @@ static void add_dirty_rect_test(void) hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
+ /* Manually copying the surface works, though. */ + hr = IDirect3DDevice9_UpdateSurface(device, surface_src_green, NULL, surface_dst2, NULL); + ok(hr == D3D_OK, "Failed to copy surface, hr %#x.\n", hr); + add_dirty_rect_test_draw(device); + color = getPixelColor(device, 320, 240); + ok(color_match(color, 0x00000080, 1), "Got unexpected colour 0x%08x.\n", color); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3D_OK, "Failed to present, hr %#x.\n", hr); + /* Readonly maps write to D3DPOOL_SYSTEMMEM, but don't record a dirty rectangle. */ fill_surface(surface_src_green, 0x000000ff, D3DLOCK_READONLY); hr = IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)tex_src_green, @@ -19521,8 +19530,7 @@ static void add_dirty_rect_test(void) ok(SUCCEEDED(hr), "Failed to update texture, hr %#x.\n", hr); add_dirty_rect_test_draw(device); color = getPixelColor(device, 320, 240); - ok(color_match(color, 0x0000ff00, 1), - "Expected color 0x0000ff00, got 0x%08x.\n", color); + ok(color_match(color, 0x00000080, 1), "Got unexpected colour 0x%08x.\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
@@ -19638,17 +19646,28 @@ static void add_dirty_rect_test(void) ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
/* AddDirtyRect uploads the new contents. - * Side note, not tested in the test: Partial surface updates work, and two separate - * dirty rectangles are tracked individually. Tested on Nvidia Kepler, other drivers - * untested. */ - hr = IDirect3DTexture9_AddDirtyRect(tex_managed, NULL); - ok(SUCCEEDED(hr), "Failed to add dirty rect, hr %#x.\n", hr); + * Partial surface updates work, and two separate dirty rectangles are + * tracked individually. Tested on Nvidia Kepler, other drivers untested. */ + hr = IDirect3DTexture9_AddDirtyRect(tex_managed, &part_rect); + ok(hr == S_OK, "Failed to add dirty rect, hr %#x.\n", hr); add_dirty_rect_test_draw(device); color = getPixelColor(device, 320, 240); - ok(color_match(color, 0x0000ff00, 1), - "Expected color 0x0000ff00, got 0x%08x.\n", color); + ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 1, 1); + todo_wine ok(color_match(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + + hr = IDirect3DTexture9_AddDirtyRect(tex_managed, NULL); + ok(hr == S_OK, "Failed to add dirty rect, hr %#x.\n", hr); + add_dirty_rect_test_draw(device); + color = getPixelColor(device, 320, 240); + ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 1, 1); + ok(color_match(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 1); ok(SUCCEEDED(hr), "Failed to set sampler state, hr %#x.\n", hr); add_dirty_rect_test_draw(device); @@ -19720,10 +19739,6 @@ static void add_dirty_rect_test(void) ok(SUCCEEDED(hr), "[%u] Got unexpected hr %#x.\n", i, hr); }
- hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); IDirect3DSurface9_Release(surface_dst2); IDirect3DSurface9_Release(surface_managed1); IDirect3DSurface9_Release(surface_managed0); @@ -19736,6 +19751,40 @@ static void add_dirty_rect_test(void) IDirect3DTexture9_Release(tex_dst2); IDirect3DTexture9_Release(tex_managed); IDirect3DTexture9_Release(tex_dynamic); + + /* As above, test UpdateSurface() after locking the source with + * D3DLOCK_NO_DIRTY_UPDATE, but this time do it immediately after creating + * the destination texture. This is a regression test for a previously + * broken code path. */ + + hr = IDirect3DDevice9_CreateTexture(device, 256, 256, 1, 0, D3DFMT_X8R8G8B8, + D3DPOOL_DEFAULT, &tex_dst2, NULL); + ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr); + hr = IDirect3DDevice9_CreateTexture(device, 256, 256, 1, 0, D3DFMT_X8R8G8B8, + D3DPOOL_SYSTEMMEM, &tex_src_green, NULL); + ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr); + + hr = IDirect3DTexture9_GetSurfaceLevel(tex_dst2, 0, &surface_dst2); + ok(hr == D3D_OK, "Failed to get surface level, hr %#x.\n", hr); + hr = IDirect3DTexture9_GetSurfaceLevel(tex_src_green, 0, &surface_src_green); + ok(hr == D3D_OK, "Failed to get surface level, hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)tex_dst2); + ok(hr == D3D_OK, "Failed to set texture, hr %#x.\n", hr); + fill_surface(surface_src_green, 0x00ff0000, D3DLOCK_NO_DIRTY_UPDATE); + hr = IDirect3DDevice9_UpdateSurface(device, surface_src_green, NULL, surface_dst2, NULL); + ok(hr == D3D_OK, "Failed to copy rects, hr %#x.\n", hr); + add_dirty_rect_test_draw(device); + color = getPixelColor(device, 320, 240); + todo_wine ok(color_match(color, 0x00ff0000, 1), "Got unexpected colour 0x%08x.\n", color); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3D_OK, "Failed to present, hr %#x.\n", hr); + + IDirect3DSurface9_Release(surface_dst2); + IDirect3DSurface9_Release(surface_src_green); + IDirect3DTexture9_Release(tex_dst2); + IDirect3DTexture9_Release(tex_src_green); + refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); IDirect3D9_Release(d3d);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
When blitting from a staging texture in SYSMEM to an as-yet uninitialized GPU texture, we want to avoid ever loading the source texture into TEXTURE_RGB, or loading the destination texture into SYSMEM.
This isn't really a proper fix for the relevant tests; it just manages to avoid the problematic code path.
This manages to fix test_yv12_overlay because it causes those blits to use the upload path (whereas currently they go through the raw blitter, and before 1632b8e7a4 they would go through the CPU blitter), and wined3d_texture_gl_upload_data() is one of the only functions to correctly handle planar YUV formats.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52684 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/d3d8/tests/visual.c | 2 +- dlls/d3d9/tests/visual.c | 2 +- dlls/ddraw/tests/ddraw1.c | 4 ++-- dlls/ddraw/tests/ddraw2.c | 4 ++-- dlls/ddraw/tests/ddraw4.c | 4 ++-- dlls/ddraw/tests/ddraw7.c | 4 ++-- dlls/wined3d/surface.c | 22 ++++++++++++++++------ 7 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 87b3c120b4f..fa0030b2187 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5925,7 +5925,7 @@ static void add_dirty_rect_test(void) ok(hr == D3D_OK, "Failed to copy rects, hr %#x.\n", hr); add_dirty_rect_test_draw(device); color = getPixelColor(device, 320, 240); - todo_wine ok(color_match(color, 0x00ff0000, 1), "Got unexpected colour 0x%08x.\n", color); + ok(color_match(color, 0x00ff0000, 1), "Got unexpected colour 0x%08x.\n", color); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Failed to present, hr %#x.\n", hr);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index cd1486b7980..f20f1ecb369 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -19776,7 +19776,7 @@ static void add_dirty_rect_test(void) ok(hr == D3D_OK, "Failed to copy rects, hr %#x.\n", hr); add_dirty_rect_test_draw(device); color = getPixelColor(device, 320, 240); - todo_wine ok(color_match(color, 0x00ff0000, 1), "Got unexpected colour 0x%08x.\n", color); + ok(color_match(color, 0x00ff0000, 1), "Got unexpected colour 0x%08x.\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Failed to present, hr %#x.\n", hr);
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 72e120683d7..b87b7903289 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -10100,9 +10100,9 @@ static void test_yv12_overlay(void) base = desc.lpSurface; ok(base[0] == 0x10, "Got unexpected Y data 0x%02x.\n", base[0]); base += desc.dwHeight * U1(desc).lPitch; - todo_wine ok(base[0] == 0x20, "Got unexpected V data 0x%02x.\n", base[0]); + ok(base[0] == 0x20, "Got unexpected V data 0x%02x.\n", base[0]); base += desc.dwHeight / 4 * U1(desc).lPitch; - todo_wine ok(base[0] == 0x30, "Got unexpected U data 0x%02x.\n", base[0]); + ok(base[0] == 0x30, "Got unexpected U data 0x%02x.\n", base[0]);
hr = IDirectDrawSurface_Unlock(dst_surface, NULL); ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 3cd785a635e..eea87f4bac2 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -10930,9 +10930,9 @@ static void test_yv12_overlay(void) base = desc.lpSurface; ok(base[0] == 0x10, "Got unexpected Y data 0x%02x.\n", base[0]); base += desc.dwHeight * U1(desc).lPitch; - todo_wine ok(base[0] == 0x20, "Got unexpected V data 0x%02x.\n", base[0]); + ok(base[0] == 0x20, "Got unexpected V data 0x%02x.\n", base[0]); base += desc.dwHeight / 4 * U1(desc).lPitch; - todo_wine ok(base[0] == 0x30, "Got unexpected U data 0x%02x.\n", base[0]); + ok(base[0] == 0x30, "Got unexpected U data 0x%02x.\n", base[0]);
hr = IDirectDrawSurface_Unlock(dst_surface, NULL); ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1c1ac2baa5f..136cf90fa60 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -12886,9 +12886,9 @@ static void test_yv12_overlay(void) base = desc.lpSurface; ok(base[0] == 0x10, "Got unexpected Y data 0x%02x.\n", base[0]); base += desc.dwHeight * U1(desc).lPitch; - todo_wine ok(base[0] == 0x20, "Got unexpected V data 0x%02x.\n", base[0]); + ok(base[0] == 0x20, "Got unexpected V data 0x%02x.\n", base[0]); base += desc.dwHeight / 4 * U1(desc).lPitch; - todo_wine ok(base[0] == 0x30, "Got unexpected U data 0x%02x.\n", base[0]); + ok(base[0] == 0x30, "Got unexpected U data 0x%02x.\n", base[0]);
hr = IDirectDrawSurface4_Unlock(dst_surface, NULL); ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index efeb3c65b36..711eac2a6d6 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -12879,9 +12879,9 @@ static void test_yv12_overlay(void) base = desc.lpSurface; ok(base[0] == 0x10, "Got unexpected Y data 0x%02x.\n", base[0]); base += desc.dwHeight * U1(desc).lPitch; - todo_wine ok(base[0] == 0x20, "Got unexpected V data 0x%02x.\n", base[0]); + ok(base[0] == 0x20, "Got unexpected V data 0x%02x.\n", base[0]); base += desc.dwHeight / 4 * U1(desc).lPitch; - todo_wine ok(base[0] == 0x30, "Got unexpected U data 0x%02x.\n", base[0]); + ok(base[0] == 0x30, "Got unexpected U data 0x%02x.\n", base[0]);
hr = IDirectDrawSurface7_Unlock(dst_surface, NULL); ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 7dcc8679da5..3216439f32b 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -31,9 +31,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
-static const DWORD surface_simple_locations = WINED3D_LOCATION_SYSMEM - | WINED3D_LOCATION_BUFFER | WINED3D_LOCATION_CLEARED; - /* Works correctly only for <= 4 bpp formats. */ static void get_color_masks(const struct wined3d_format *format, uint32_t *masks) { @@ -1481,6 +1478,19 @@ static bool wined3d_is_colour_blit(enum wined3d_blit_op blit_op) } }
+static bool sub_resource_is_on_cpu(const struct wined3d_texture *texture, unsigned int sub_resource_idx) +{ + DWORD locations = texture->sub_resources[sub_resource_idx].locations; + + if (locations & (WINED3D_LOCATION_BUFFER | WINED3D_LOCATION_SYSMEM)) + return true; + + if (!(texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU) && (locations & WINED3D_LOCATION_CLEARED)) + return true; + + return false; +} + HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, const struct wined3d_box *dst_box, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, DWORD flags, const struct wined3d_blt_fx *fx, @@ -1641,8 +1651,8 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_ { blit_op = WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST; } - else if ((src_sub_resource->locations & surface_simple_locations) - && !(dst_sub_resource->locations & surface_simple_locations) + else if (sub_resource_is_on_cpu(src_texture, src_sub_resource_idx) + && !sub_resource_is_on_cpu(dst_texture, dst_sub_resource_idx) && (dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU)) { /* Upload */ @@ -1666,7 +1676,7 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_ return WINED3D_OK; } } - else if (!(src_sub_resource->locations & surface_simple_locations) + else if (!sub_resource_is_on_cpu(src_texture, src_sub_resource_idx) && (dst_sub_resource->locations & dst_texture->resource.map_binding) && !(dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU)) {
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=113507
Your paranoid android.
=== debian11 (32 bit Japanese:Japan report) ===
Report validation errors: ddraw2: Timeout
=== debian11 (build log) ===
WineRunWineTest.pl:error: The task timed out
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com