Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/ddraw/tests/ddraw7.c | 64 ++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 14 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 4a7ea61f5d..3cb3516906 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -14284,7 +14284,7 @@ static void test_device_load(void) RECT loadrect; POINT loadpoint; int i, i1, i2; - unsigned int diff_count, diff_count2; + unsigned int diff_count, diff_count2, diff_count3; unsigned int x, y; BOOL load_mip_subset_broken = FALSE; IDirectDrawPalette *palettes[5]; @@ -14825,6 +14825,7 @@ static void test_device_load(void) { diff_count = 0; diff_count2 = 0; + diff_count3 = 0;
memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); ddsd.dwSize = sizeof(ddsd); @@ -14866,15 +14867,26 @@ static void test_device_load(void) if (r != (0xf0 | i1) || !IS_VALUE_NEAR(g, x + loadrect.left - loadpoint.x) || !IS_VALUE_NEAR(b, y + loadrect.top - loadpoint.y)) diff_count2++; } + + /* some windows 8 and 10 machines copy the wrong mip */ + if (x < loadpoint.x / 16 || x >= ceil((loadpoint.x + loadrect.right - loadrect.left) / 16.0) || + y < loadpoint.y / 16 || y >= ceil((loadpoint.y + loadrect.bottom - loadrect.top) / 16.0)) + { + if (color & 0xffffff) diff_count3++; + } + else + { + if (r != (0xf0 | (i1 + 4)) || g != x || b != y) diff_count3++; + } } }
hr = IDirectDrawSurface7_Unlock(texture_levels[1][i1], NULL); ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n", hr);
- ok(diff_count == 0 || diff_count2 == 0, + ok(diff_count == 0 || diff_count2 == 0 || broken(diff_count3 == 0), "Unexpected destination texture level pixels; %u differences at %d level\n", - min(diff_count, diff_count2), i1); + min(min(diff_count, diff_count2), diff_count3), i1);
loadpoint.x /= 2; loadpoint.y /= 2; @@ -15027,6 +15039,7 @@ static void test_device_load(void) skip("IDirect3DDevice7_Load is broken (happens on some Windows installations like XP). Skipping affected tests.\n"); } else { diff_count = 0; + diff_count3 = 0;
for (y = 0; y < ddsd.dwHeight; y++) { @@ -15035,6 +15048,9 @@ static void test_device_load(void) for (x = 0; x < ddsd.dwWidth; x++) { DWORD color = *texture_row++; + DWORD r = (color & 0xff0000) >> 16; + DWORD g = (color & 0xff00) >> 8; + DWORD b = (color & 0xff);
if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left || y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top) @@ -15043,13 +15059,20 @@ static void test_device_load(void) } else { - DWORD r = (color & 0xff0000) >> 16; - DWORD g = (color & 0xff00) >> 8; - DWORD b = (color & 0xff); - if (r != 0xf2 || g != x + loadrect.left - loadpoint.x || b != y + loadrect.top - loadpoint.y) diff_count++; } + + /* some windows 8 and 10 machines copy the wrong mip */ + if (x < loadpoint.x / 16 || x >= (loadpoint.x + loadrect.right - loadrect.left) / 16 || + y < loadpoint.y / 16 || y >= (loadpoint.y + loadrect.bottom - loadrect.top) / 16) + { + if (color & 0xffffff) diff_count3++; + } + else + { + if (r != 0xf7 || g != x || b != y) diff_count3++; + } } } } @@ -15057,7 +15080,8 @@ static void test_device_load(void) hr = IDirectDrawSurface7_Unlock(texture_levels[1][0], NULL); ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n", hr);
- ok(diff_count == 0, "Unexpected destination texture level pixels; %u differences\n", diff_count); + ok(diff_count == 0 || broken(diff_count3 == 0), + "Unexpected destination texture level pixels; %u differences\n", min(diff_count, diff_count3));
for (i = 0; i < 2; i++) { @@ -15170,6 +15194,7 @@ static void test_device_load(void) if (ddsd.dwWidth == ddsd2.dwWidth && ddsd.dwHeight == ddsd2.dwHeight) { diff_count = 0; + diff_count3 = 0;
memset(&ddsd, 0, sizeof(DDSURFACEDESC2)); ddsd.dwSize = sizeof(ddsd); @@ -15184,6 +15209,9 @@ static void test_device_load(void) for (x = 0; x < ddsd.dwWidth; x++) { DWORD color = *texture_row++; + DWORD r = (color & 0xff0000) >> 16; + DWORD g = (color & 0xff00) >> 8; + DWORD b = (color & 0xff);
if (x < loadpoint.x || x >= loadpoint.x + loadrect.right - loadrect.left || y < loadpoint.y || y >= loadpoint.y + loadrect.bottom - loadrect.top) @@ -15192,21 +15220,29 @@ static void test_device_load(void) } else { - DWORD r = (color & 0xff0000) >> 16; - DWORD g = (color & 0xff00) >> 8; - DWORD b = (color & 0xff); - if (r != (0xf0 | i1) || g != x + loadrect.left - loadpoint.x || b != y + loadrect.top - loadpoint.y) diff_count++; } + + /* some windows 8 and 10 machines copy the wrong mip */ + if (x < loadpoint.x / 16 || x >= ceil((loadpoint.x + loadrect.right - loadrect.left) / 16.0) || + y < loadpoint.y / 16 || y >= ceil((loadpoint.y + loadrect.bottom - loadrect.top) / 16.0)) + { + if (color & 0xffffff) diff_count3++; + } + else + { + if (r != (0xf0 | (i + 4)) || g != x || b != y) diff_count3++; + } } }
hr = IDirectDrawSurface7_Unlock(texture_levels[1][i], NULL); ok(hr==DD_OK, "IDirectDrawSurface7_Unlock returned: %x\n", hr);
- ok(diff_count == 0, "Unexpected destination texture level pixels; %u differences at %d level\n", - diff_count, i1); + ok(diff_count == 0 || broken(diff_count3 == 0), + "Unexpected destination texture level pixels; %u differences at %d level\n", + min(diff_count, diff_count3), i1);
i++; }