From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/surface.c | 9 +++++++++ dlls/ddraw/tests/ddraw1.c | 2 +- dlls/ddraw/tests/ddraw2.c | 2 +- dlls/ddraw/tests/ddraw4.c | 2 +- dlls/ddraw/tests/ddraw7.c | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 4a95067996f..cdb1cfe109d 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6117,6 +6117,15 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ /* Ensure DDSD_CAPS is always set. */ desc->dwFlags |= DDSD_CAPS;
+ if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX) + && !(desc->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_MIPMAP)) + && !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)) + { + WARN("DDSCAPS_COMPLEX specified for a surface which is neither flippable, mipmapped, nor a cubemap.\n"); + heap_free(texture); + return DDERR_INVALIDCAPS; + } + if (desc->ddsCaps.dwCaps & DDSCAPS_FLIP) { if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->u5.dwBackBufferCount) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 258670f1db5..2d7d350517e 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -6323,7 +6323,7 @@ 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 == 1 || i == 4 || i == 7 || i == 8) + todo_wine_if (i == 7 || i == 8) ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr); if (FAILED(hr)) continue; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 9427dea535e..5733c879b4e 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -7452,7 +7452,7 @@ 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 == 1 || i == 4 || i == 7 || i == 8) + todo_wine_if (i == 7 || i == 8) ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr); if (FAILED(hr)) continue; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index aca9a456078..81bf170711d 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -9353,7 +9353,7 @@ 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 == 1 || i == 4 || i == 7 || i == 8) + todo_wine_if (i == 7 || i == 8) ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr); if (FAILED(hr)) continue; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index e9574cdec2c..229448d135a 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -9197,7 +9197,7 @@ 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 == 1 || i == 4 || i == 7 || i == 8) + todo_wine_if (i == 7 || i == 8) ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr); if (FAILED(hr)) continue;