ddraw: Fix the "dwMipMapCount" field of texture sub-levels.

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>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
David Adam 2019-01-23 21:18:42 +03:30 committed by Alexandre Julliard
parent 6ec69f0ee3
commit f5d7d9cccc
5 changed files with 30 additions and 36 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);