ddraw: Forbid DDSD_MIPMAPCOUNT without DDSCAPS_COMPLEX.

This commit is contained in:
Zebediah Figura 2022-12-20 21:44:43 -06:00 committed by Alexandre Julliard
parent 9bfdd9141c
commit c86263aa5d
5 changed files with 12 additions and 32 deletions

View file

@ -6126,6 +6126,14 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
return DDERR_INVALIDCAPS;
}
if ((desc->dwFlags & DDSD_MIPMAPCOUNT) && !(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
{
/* This is illegal even if there is only one mipmap level. */
WARN("DDSD_MIPMAPCOUNT specified without DDSCAPS_COMPLEX.\n");
heap_free(texture);
return DDERR_INVALIDCAPS;
}
if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP)
{
if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount)

View file

@ -6323,17 +6323,10 @@ static void test_mipmap(void)
if (tests[i].flags & DDSD_MIPMAPCOUNT)
U2(surface_desc).dwMipMapCount = tests[i].mipmap_count_in;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
todo_wine_if (i == 7 || i == 8)
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
if (FAILED(hr))
continue;
if (FAILED(tests[i].hr))
{
IDirectDrawSurface_Release(surface);
continue;
}
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc);

View file

@ -7452,17 +7452,10 @@ static void test_mipmap(void)
if (tests[i].flags & DDSD_MIPMAPCOUNT)
U2(surface_desc).dwMipMapCount = tests[i].mipmap_count_in;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface1, NULL);
todo_wine_if (i == 7 || i == 8)
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
if (FAILED(hr))
continue;
if (FAILED(tests[i].hr))
{
IDirectDrawSurface_Release(surface);
continue;
}
hr = IDirectDrawSurface_QueryInterface(surface1, &IID_IDirectDrawSurface2, (void **)&surface);
ok(SUCCEEDED(hr), "Test %u: Failed to get IDirectDrawSurface2 interface, hr %#lx.\n", i, hr);
IDirectDrawSurface_Release(surface1);

View file

@ -9353,17 +9353,10 @@ static void test_mipmap(void)
if (tests[i].flags & DDSD_MIPMAPCOUNT)
U2(surface_desc).dwMipMapCount = tests[i].mipmap_count_in;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
todo_wine_if (i == 7 || i == 8)
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
if (FAILED(hr))
continue;
if (FAILED(tests[i].hr))
{
IDirectDrawSurface4_Release(surface);
continue;
}
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc);

View file

@ -9197,17 +9197,10 @@ static void test_mipmap(void)
if (tests[i].flags & DDSD_MIPMAPCOUNT)
U2(surface_desc).dwMipMapCount = tests[i].mipmap_count_in;
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
todo_wine_if (i == 7 || i == 8)
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr);
if (FAILED(hr))
continue;
if (FAILED(tests[i].hr))
{
IDirectDrawSurface7_Release(surface);
continue;
}
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc);