From: David Adam david.adam.cnrs@gmail.com
Instead of the total count, it indicates the count starting from the current level.
Signed-off-by: David Adam david.adam.cnrs@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/ddraw/surface.c | 2 ++ dlls/ddraw/tests/ddraw1.c | 16 +++++++--------- dlls/ddraw/tests/ddraw2.c | 16 +++++++--------- dlls/ddraw/tests/ddraw4.c | 16 +++++++--------- dlls/ddraw/tests/ddraw7.c | 16 +++++++--------- 5 files changed, 30 insertions(+), 36 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 385ba1ac966..14aa5ab744e 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6342,6 +6342,8 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ { mip = wined3d_texture_get_sub_resource_parent(wined3d_texture, i * levels + j); mip_desc = &mip->surface_desc; + if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP) + mip_desc->u2.dwMipMapCount = levels - j;
if (j) { diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 99df15aea5b..1f7e2ce04e7 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -5482,24 +5482,22 @@ static void test_mipmap(void) ok(SUCCEEDED(hr), "Test %u, %u: Failed to get surface desc, hr %#x.\n", i, mipmap_count, hr); ok(surface_desc.dwFlags & DDSD_MIPMAPCOUNT, "Test %u, %u: Got unexpected flags %#x.\n", i, mipmap_count, surface_desc.dwFlags); - todo_wine_if(mipmap_count != tests[i].mipmap_count_out) - ok(U2(surface_desc).dwMipMapCount == mipmap_count, - "Test %u, %u: Got unexpected mipmap count %u.\n", - i, mipmap_count, U2(surface_desc).dwMipMapCount); + ok(U2(surface_desc).dwMipMapCount == mipmap_count, + "Test %u, %u: Got unexpected mipmap count %u.\n", + i, mipmap_count, U2(surface_desc).dwMipMapCount);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface_Lock(surface_base, NULL, &surface_desc, 0, NULL); ok(SUCCEEDED(hr), "Test %u, %u: Failed to lock surface, hr %#x.\n", i, mipmap_count, hr); - todo_wine_if(mipmap_count != tests[i].mipmap_count_out) - ok(surface_desc.dwMipMapCount == mipmap_count, - "Test %u, %u: unexpected change of mipmap count %u.\n", - i, mipmap_count, surface_desc.dwMipMapCount); + ok(surface_desc.dwMipMapCount == mipmap_count, + "Test %u, %u: unexpected change of mipmap count %u.\n", + i, mipmap_count, surface_desc.dwMipMapCount); memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface_Lock(surface_mip, NULL, &surface_desc, 0, NULL); ok(SUCCEEDED(hr), "Test %u, %u: Failed to lock surface, hr %#x.\n", i, mipmap_count, hr); - todo_wine ok(surface_desc.dwMipMapCount == mipmap_count - 1, + ok(surface_desc.dwMipMapCount == mipmap_count - 1, "Test %u, %u: Child mipmap count unexpected %u\n", i, mipmap_count, surface_desc.dwMipMapCount); IDirectDrawSurface_Unlock(surface_mip, NULL); IDirectDrawSurface_Unlock(surface_base, NULL); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 2c2008a2f02..842870d7d78 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -6512,24 +6512,22 @@ static void test_mipmap(void) ok(SUCCEEDED(hr), "Test %u, %u: Failed to get surface desc, hr %#x.\n", i, mipmap_count, hr); ok(surface_desc.dwFlags & DDSD_MIPMAPCOUNT, "Test %u, %u: Got unexpected flags %#x.\n", i, mipmap_count, surface_desc.dwFlags); - todo_wine_if(mipmap_count != tests[i].mipmap_count_out) - ok(U2(surface_desc).dwMipMapCount == mipmap_count, - "Test %u, %u: Got unexpected mipmap count %u.\n", - i, mipmap_count, U2(surface_desc).dwMipMapCount); + ok(U2(surface_desc).dwMipMapCount == mipmap_count, + "Test %u, %u: Got unexpected mipmap count %u.\n", + i, mipmap_count, U2(surface_desc).dwMipMapCount);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface2_Lock(surface_base, NULL, &surface_desc, 0, NULL); ok(SUCCEEDED(hr), "Test %u, %u: Failed to lock surface, hr %#x.\n", i, mipmap_count, hr); - todo_wine_if(mipmap_count != tests[i].mipmap_count_out) - ok(surface_desc.dwMipMapCount == mipmap_count, - "Test %u, %u: unexpected change of mipmap count %u.\n", - i, mipmap_count, surface_desc.dwMipMapCount); + ok(surface_desc.dwMipMapCount == mipmap_count, + "Test %u, %u: unexpected change of mipmap count %u.\n", + i, mipmap_count, surface_desc.dwMipMapCount); memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface2_Lock(surface_mip, NULL, &surface_desc, 0, NULL); ok(SUCCEEDED(hr), "Test %u, %u: Failed to lock surface, hr %#x.\n", i, mipmap_count, hr); - todo_wine ok(surface_desc.dwMipMapCount == mipmap_count - 1, + ok(surface_desc.dwMipMapCount == mipmap_count - 1, "Test %u, %u: Child mipmap count unexpected %u\n", i, mipmap_count, surface_desc.dwMipMapCount); IDirectDrawSurface2_Unlock(surface_mip, NULL); IDirectDrawSurface2_Unlock(surface_base, NULL); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index f94f62ef799..8062fe870a9 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -8040,24 +8040,22 @@ static void test_mipmap(void) ok(SUCCEEDED(hr), "Test %u, %u: Failed to get surface desc, hr %#x.\n", i, mipmap_count, hr); ok(surface_desc.dwFlags & DDSD_MIPMAPCOUNT, "Test %u, %u: Got unexpected flags %#x.\n", i, mipmap_count, surface_desc.dwFlags); - todo_wine_if(mipmap_count != tests[i].mipmap_count_out) - ok(U2(surface_desc).dwMipMapCount == mipmap_count, - "Test %u, %u: Got unexpected mipmap count %u.\n", - i, mipmap_count, U2(surface_desc).dwMipMapCount); + ok(U2(surface_desc).dwMipMapCount == mipmap_count, + "Test %u, %u: Got unexpected mipmap count %u.\n", + i, mipmap_count, U2(surface_desc).dwMipMapCount);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface4_Lock(surface_base, NULL, &surface_desc, 0, NULL); ok(SUCCEEDED(hr), "Test %u, %u: Failed to lock surface, hr %#x.\n", i, mipmap_count, hr); - todo_wine_if(mipmap_count != tests[i].mipmap_count_out) - ok(surface_desc.dwMipMapCount == mipmap_count, - "Test %u, %u: unexpected change of mipmap count %u.\n", - i, mipmap_count, surface_desc.dwMipMapCount); + ok(surface_desc.dwMipMapCount == mipmap_count, + "Test %u, %u: unexpected change of mipmap count %u.\n", + i, mipmap_count, surface_desc.dwMipMapCount); memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface4_Lock(surface_mip, NULL, &surface_desc, 0, NULL); ok(SUCCEEDED(hr), "Test %u, %u: Failed to lock surface, hr %#x.\n", i, mipmap_count, hr); - todo_wine ok(surface_desc.dwMipMapCount == mipmap_count - 1, + ok(surface_desc.dwMipMapCount == mipmap_count - 1, "Test %u, %u: Child mipmap count unexpected %u\n", i, mipmap_count, surface_desc.dwMipMapCount); IDirectDrawSurface4_Unlock(surface_mip, NULL); IDirectDrawSurface4_Unlock(surface_base, NULL); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 061c691c961..6ef696d34fd 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -7875,24 +7875,22 @@ static void test_mipmap(void) ok(SUCCEEDED(hr), "Test %u, %u: Failed to get surface desc, hr %#x.\n", i, mipmap_count, hr); ok(surface_desc.dwFlags & DDSD_MIPMAPCOUNT, "Test %u, %u: Got unexpected flags %#x.\n", i, mipmap_count, surface_desc.dwFlags); - todo_wine_if(mipmap_count != tests[i].mipmap_count_out) - ok(U2(surface_desc).dwMipMapCount == mipmap_count, - "Test %u, %u: Got unexpected mipmap count %u.\n", - i, mipmap_count, U2(surface_desc).dwMipMapCount); + ok(U2(surface_desc).dwMipMapCount == mipmap_count, + "Test %u, %u: Got unexpected mipmap count %u.\n", + i, mipmap_count, U2(surface_desc).dwMipMapCount);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface7_Lock(surface_base, NULL, &surface_desc, 0, NULL); ok(SUCCEEDED(hr), "Test %u, %u: Failed to lock surface, hr %#x.\n", i, mipmap_count, hr); - todo_wine_if(mipmap_count != tests[i].mipmap_count_out) - ok(surface_desc.dwMipMapCount == mipmap_count, - "Test %u, %u: unexpected change of mipmap count %u.\n", - i, mipmap_count, surface_desc.dwMipMapCount); + ok(surface_desc.dwMipMapCount == mipmap_count, + "Test %u, %u: unexpected change of mipmap count %u.\n", + i, mipmap_count, surface_desc.dwMipMapCount); memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); hr = IDirectDrawSurface7_Lock(surface_mip, NULL, &surface_desc, 0, NULL); ok(SUCCEEDED(hr), "Test %u, %u: Failed to lock surface, hr %#x.\n", i, mipmap_count, hr); - todo_wine ok(surface_desc.dwMipMapCount == mipmap_count - 1, + ok(surface_desc.dwMipMapCount == mipmap_count - 1, "Test %u, %u: Child mipmap count unexpected %u\n", i, mipmap_count, surface_desc.dwMipMapCount); IDirectDrawSurface7_Unlock(surface_mip, NULL); IDirectDrawSurface7_Unlock(surface_base, NULL);