From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/tests/ddraw2.c | 28 ++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 28 ++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index eddf846e54b..e48d4c54f1c 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -6203,6 +6203,34 @@ static void test_set_surface_desc(void) hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0); ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr);
+ /* Check that other surface properties are retained. */ + + ddsd.ddckCKSrcBlt.dwColorSpaceLowValue = 0x00ff00ff; + ddsd.ddckCKSrcBlt.dwColorSpaceHighValue = 0x0000ff00; + hr = IDirectDrawSurface3_SetColorKey(surface3, DDCKEY_SRCBLT, &ddsd.ddckCKSrcBlt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + reset_ddsd(&ddsd); + ddsd.dwFlags = DDSD_WIDTH | DDSD_PITCH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_LPSURFACE; + ddsd.dwWidth = 8; + U1(ddsd).lPitch = 8 * 2; + ddsd.dwHeight = 8; + ddsd.lpSurface = data; + U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat); + U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB; /* D3DFMT_R5G6B5 */ + U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 16; + U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0xf800; + U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x07e0; + U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x001f; + hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + memset(&ddsd.ddckCKSrcBlt, 0xcc, sizeof(ddsd.ddckCKSrcBlt)); + hr = IDirectDrawSurface3_GetColorKey(surface3, DDCKEY_SRCBLT, &ddsd.ddckCKSrcBlt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(ddsd.ddckCKSrcBlt.dwColorSpaceLowValue == 0x00ff00ff, + "Got low color key value %#lx.\n", ddsd.ddckCKSrcBlt.dwColorSpaceLowValue); + IDirectDrawSurface3_Release(surface3);
/* Test mipmap texture. */ diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index a658de37b94..657ea982154 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -7861,6 +7861,34 @@ static void test_set_surface_desc(void) hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 0); ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr);
+ /* Check that other surface properties are retained. */ + + ddsd.ddckCKSrcBlt.dwColorSpaceLowValue = 0x00ff00ff; + ddsd.ddckCKSrcBlt.dwColorSpaceHighValue = 0x0000ff00; + hr = IDirectDrawSurface4_SetColorKey(surface, DDCKEY_SRCBLT, &ddsd.ddckCKSrcBlt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + reset_ddsd(&ddsd); + ddsd.dwFlags = DDSD_WIDTH | DDSD_PITCH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_LPSURFACE; + ddsd.dwWidth = 8; + U1(ddsd).lPitch = 8 * 2; + ddsd.dwHeight = 8; + ddsd.lpSurface = data; + U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat); + U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB; /* D3DFMT_R5G6B5 */ + U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 16; + U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0xf800; + U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x07e0; + U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x001f; + hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + memset(&ddsd.ddckCKSrcBlt, 0xcc, sizeof(ddsd.ddckCKSrcBlt)); + hr = IDirectDrawSurface4_GetColorKey(surface, DDCKEY_SRCBLT, &ddsd.ddckCKSrcBlt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(ddsd.ddckCKSrcBlt.dwColorSpaceLowValue == 0x00ff00ff, + "Got low color key value %#lx.\n", ddsd.ddckCKSrcBlt.dwColorSpaceLowValue); + IDirectDrawSurface4_Release(surface);
/* Test mipmap texture. */ diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index a1c791a9116..d642a644e97 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -7718,6 +7718,34 @@ static void test_set_surface_desc(void) hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 0); ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr);
+ /* Check that other surface properties are retained. */ + + ddsd.ddckCKSrcBlt.dwColorSpaceLowValue = 0x00ff00ff; + ddsd.ddckCKSrcBlt.dwColorSpaceHighValue = 0x0000ff00; + hr = IDirectDrawSurface7_SetColorKey(surface, DDCKEY_SRCBLT, &ddsd.ddckCKSrcBlt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + reset_ddsd(&ddsd); + ddsd.dwFlags = DDSD_WIDTH | DDSD_PITCH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_LPSURFACE; + ddsd.dwWidth = 8; + U1(ddsd).lPitch = 8 * 2; + ddsd.dwHeight = 8; + ddsd.lpSurface = data; + U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat); + U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_RGB; /* D3DFMT_R5G6B5 */ + U1(U4(ddsd).ddpfPixelFormat).dwRGBBitCount = 16; + U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0xf800; + U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x07e0; + U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x001f; + hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + memset(&ddsd.ddckCKSrcBlt, 0xcc, sizeof(ddsd.ddckCKSrcBlt)); + hr = IDirectDrawSurface7_GetColorKey(surface, DDCKEY_SRCBLT, &ddsd.ddckCKSrcBlt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(ddsd.ddckCKSrcBlt.dwColorSpaceLowValue == 0x00ff00ff, + "Got low color key value %#lx.\n", ddsd.ddckCKSrcBlt.dwColorSpaceLowValue); + IDirectDrawSurface7_Release(surface);
/* Test mipmap texture. */
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/tests/ddraw1.c | 21 +++++++++++++++++---- dlls/ddraw/tests/ddraw2.c | 21 +++++++++++++++++---- dlls/ddraw/tests/ddraw4.c | 21 +++++++++++++++++---- dlls/ddraw/tests/ddraw7.c | 21 +++++++++++++++++---- 4 files changed, 68 insertions(+), 16 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 71c60db3804..258670f1db5 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -6280,12 +6280,18 @@ static void test_mipmap(void) } tests[] = { - {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3}, - {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS, 0}, + {0, DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDCAPS}, + {0, DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, + {0, DDSCAPS_MIPMAP | DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, {0, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 1}, - {0, DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDCAPS, 0}, + {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 6}, {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 32, 64, 0, DD_OK, 6}, + + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 1, DDERR_INVALIDCAPS}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 3, DDERR_INVALIDCAPS}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS}, };
window = create_window(); @@ -6317,10 +6323,17 @@ 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); - ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr); + todo_wine_if (i == 1 || i == 4 || i == 7 || i == 8) + 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); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index e48d4c54f1c..9427dea535e 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -7409,12 +7409,18 @@ static void test_mipmap(void) } tests[] = { - {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3}, - {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS, 0}, + {0, DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDCAPS}, + {0, DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, + {0, DDSCAPS_MIPMAP | DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, {0, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 1}, - {0, DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDCAPS, 0}, + {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 6}, {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 32, 64, 0, DD_OK, 6}, + + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 1, DDERR_INVALIDCAPS}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 3, DDERR_INVALIDCAPS}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS}, };
window = create_window(); @@ -7446,10 +7452,17 @@ 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); - ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr); + todo_wine_if (i == 1 || i == 4 || i == 7 || i == 8) + 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); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 657ea982154..aca9a456078 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -9310,12 +9310,18 @@ static void test_mipmap(void) } tests[] = { - {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3}, - {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS, 0}, + {0, DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDCAPS}, + {0, DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, + {0, DDSCAPS_MIPMAP | DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, {0, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 1}, - {0, DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDCAPS, 0}, + {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 6}, {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 32, 64, 0, DD_OK, 6}, + + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 1, DDERR_INVALIDCAPS}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 3, DDERR_INVALIDCAPS}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS}, };
window = create_window(); @@ -9347,10 +9353,17 @@ 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); - ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr); + todo_wine_if (i == 1 || i == 4 || i == 7 || i == 8) + 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); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d642a644e97..e9574cdec2c 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -9153,12 +9153,18 @@ static void test_mipmap(void) } tests[] = { - {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3}, - {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS, 0}, + {0, DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDCAPS}, + {0, DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, + {0, DDSCAPS_MIPMAP | DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, {0, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 1}, - {0, DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDCAPS, 0}, + {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX, 128, 32, 0, DDERR_INVALIDCAPS}, {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DD_OK, 8}, {0, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 32, 64, 0, DD_OK, 7}, + + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 1, DDERR_INVALIDCAPS}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_MIPMAP, 128, 32, 3, DDERR_INVALIDCAPS}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 3, DD_OK, 3}, + {DDSD_MIPMAPCOUNT, DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP, 128, 32, 0, DDERR_INVALIDPARAMS}, };
window = create_window(); @@ -9191,10 +9197,17 @@ 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); - ok(hr == tests[i].hr, "Test %u: Got unexpected hr %#lx.\n", i, hr); + todo_wine_if (i == 1 || i == 4 || i == 7 || i == 8) + 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);
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;
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/surface.c | 8 ++++++++ dlls/ddraw/tests/ddraw1.c | 9 +-------- dlls/ddraw/tests/ddraw2.c | 9 +-------- dlls/ddraw/tests/ddraw4.c | 9 +-------- dlls/ddraw/tests/ddraw7.c | 9 +-------- 5 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index cdb1cfe109d..ddbe08f2260 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -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) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 2d7d350517e..4f950d775b2 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -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); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 5733c879b4e..476531d41a5 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -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); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 81bf170711d..71052214baf 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -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); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 229448d135a..8ac62b303e1 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -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);
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/surface.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index ddbe08f2260..aec0bba8dc3 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -5995,10 +5995,11 @@ static HRESULT ddraw_surface_reserve_memory(struct wined3d_texture *wined3d_text return hr; }
-static HRESULT ddraw_surface_create_wined3d_texture(DDSURFACEDESC2 *desc, struct wined3d_device *wined3d_device, +static HRESULT ddraw_surface_create_wined3d_texture(struct wined3d_device *wined3d_device, const struct wined3d_resource_desc *wined3d_desc, unsigned int layers, unsigned int levels, struct ddraw_texture *texture, struct wined3d_texture **wined3d_texture) { + const DDSURFACEDESC2 *desc = &texture->surface_desc; struct wined3d_resource_desc draw_texture_desc; struct wined3d_texture *draw_texture; struct ddraw_surface *parent; @@ -6589,7 +6590,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ layers = 6; }
- if (FAILED(hr = ddraw_surface_create_wined3d_texture(desc, ddraw->wined3d_device, &wined3d_desc, layers, levels, + if (FAILED(hr = ddraw_surface_create_wined3d_texture(ddraw->wined3d_device, &wined3d_desc, layers, levels, texture, &wined3d_texture))) { WARN("Failed to create wined3d texture, hr %#lx.\n", hr); @@ -6723,7 +6724,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ desc->ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER; desc->u5.dwBackBufferCount = 0;
- if (FAILED(hr = ddraw_surface_create_wined3d_texture(desc, ddraw->wined3d_device, &wined3d_desc, 1, 1, + if (FAILED(hr = ddraw_surface_create_wined3d_texture(ddraw->wined3d_device, &wined3d_desc, 1, 1, texture, &wined3d_texture))) { heap_free(texture);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=130170
Your paranoid android.
=== w10pro64 (32 bit report) ===
ddraw: ddraw1.c:13664: Test failed: WM_KILLFOCUS was not received. ddraw1.c:13700: Test failed: Got unexpected hr 0x887600e1. ddraw1.c:13703: Test failed: Got unexpected hr 0x887600ff. 0460:ddraw1: unhandled exception c0000005 at 00418050
=== w11pro64_amd (64 bit report) ===
ddraw: ddraw1.c:126: Test failed: Failed to get device identifier, hr 0x887600ff. ddraw1.c:867: Test failed: Got unexpected wparam 0x1 for message 0x5, expected 0. ddraw1.c:3130: Test failed: Expected message 0x7e, but didn't receive it. ddraw1.c:3135: Test failed: Got unexpected screen size 800x600. ddraw1.c:3224: Test failed: Expected surface width 1024, got 640. ddraw1.c:3226: Test failed: Expected surface height 768, got 480. ddraw1.c:3244: Test failed: Expected surface width 1024, got 640. ddraw1.c:3246: Test failed: Expected surface height 768, got 480. ddraw1.c:3259: Test failed: Expected surface width 1024, got 640. ddraw1.c:3261: Test failed: Expected surface height 768, got 480. ddraw1.c:3310: Test failed: Got unexpected hr 0. ddraw1.c:3312: Test failed: Got unexpected hr 0. ddraw1.c:3325: Test failed: Expected surface width 1024, got 640. ddraw1.c:3327: Test failed: Expected surface height 768, got 480. ddraw1.c:3362: Test failed: Expected message 0x7e, but didn't receive it. ddraw1.c:3381: Test failed: Expected resolution 1024x768, got 640x480. ddraw1.c:3398: Test failed: Expected surface width 1024, got 640. ddraw1.c:3400: Test failed: Expected surface height 768, got 480. ddraw1.c:3421: Test failed: Expected surface width 1024, got 640. ddraw1.c:3423: Test failed: Expected surface height 768, got 480. ddraw1.c:3436: Test failed: Expected surface width 1024, got 640. ddraw1.c:3438: Test failed: Expected surface height 768, got 480. ddraw1.c:3480: Test failed: Got unexpected hr 0. ddraw1.c:3482: Test failed: Got unexpected hr 0. ddraw1.c:3495: Test failed: Expected surface width 1024, got 640. ddraw1.c:3497: Test failed: Expected surface height 768, got 480. ddraw1.c:3532: Test failed: Expected message 0x7e, but didn't receive it. ddraw1.c:3551: Test failed: Expected resolution 1024x768, got 640x480. ddraw1.c:3568: Test failed: Expected surface width 1024, got 640. ddraw1.c:3570: Test failed: Expected surface height 768, got 480. ddraw1.c:3631: Test failed: Got a different mode. ddraw1.c:3650: Test failed: Got a different mode. ddraw1.c:3669: Test failed: Got a different mode. ddraw1.c:3672: Test failed: Got a different mode. ddraw1.c:3690: Test failed: Got a different mode. ddraw1.c:3693: Test failed: Got a different mode. ddraw1.c:3724: Test failed: Got a different mode. ddraw1.c:3727: Test failed: Got a different mode. ddraw1.c:3756: Test failed: Got unexpected screen width 800. ddraw1.c:3758: Test failed: Got unexpected screen height 600. ddraw1.c:3781: Test failed: Got unexpected screen width 640. ddraw1.c:3783: Test failed: Got unexpected screen height 480. ddraw1.c:3788: Test failed: Got unexpected screen width 640. ddraw1.c:3790: Test failed: Got unexpected screen height 480. ddraw1.c:3812: Test failed: Got unexpected screen width 640. ddraw1.c:3814: Test failed: Got unexpected screen height 480. ddraw1.c:3819: Test failed: Got unexpected screen width 640. ddraw1.c:3821: Test failed: Got unexpected screen height 480. ddraw1.c:3843: Test failed: Got unexpected screen width 640. ddraw1.c:3845: Test failed: Got unexpected screen height 480. ddraw1.c:3878: Test failed: Got unexpected screen width 640. ddraw1.c:3880: Test failed: Got unexpected screen height 480. ddraw1.c:3901: Test failed: Got unexpected screen width 800. ddraw1.c:3903: Test failed: Got unexpected screen height 600. ddraw1.c:3908: Test failed: Got unexpected screen width 800. ddraw1.c:3910: Test failed: Got unexpected screen height 600. ddraw1.c:126: Test failed: Failed to get device identifier, hr 0x887600ff. ddraw1.c:5713: Test failed: Failed to create surface, hr 0x80070057. ddraw1.c:5722: Test failed: Failed to create surface, hr 0x80070057. ddraw1.c:5735: Test failed: Failed to attach surface, hr 0x80070057. 1aec:ddraw1: unhandled exception c0000005 at 000000000040CD98
=== w10pro64 (32 bit report) ===
ddraw: ddraw2.c:14697: Test failed: WM_KILLFOCUS was not received. ddraw2.c:14733: Test failed: Got unexpected hr 0x887600e1. ddraw2.c:14736: Test failed: Got unexpected hr 0x887600ff. 1e2c:ddraw2: unhandled exception c0000005 at 0046249E
=== w8 (32 bit report) ===
ddraw: ddraw7.c:4719: Test failed: Lit quad with light has color 0x00000000. ddraw7.c:4719: Test failed: Lit quad with singular world matrix has color 0x00000000. ddraw7.c:4719: Test failed: Lit quad with transformation matrix has color 0x00000000.
=== w10pro64 (32 bit report) ===
ddraw: ddraw7.c:10190: Test failed: Failed to set foreground window. ddraw7.c:10192: Test failed: Got unexpected hr 0. ddraw7.c:10194: Test failed: Got unexpected hr 0. ddraw7.c:10196: Test failed: Got unexpected hr 0. ddraw7.c:10198: Test failed: Got unexpected hr 0. ddraw7.c:10200: Test failed: Got unexpected hr 0. ddraw7.c:10210: Test failed: Got unexpected hr 0. ddraw7.c:10212: Test failed: Got unexpected hr 0. ddraw7.c:10214: Test failed: Got unexpected hr 0. ddraw7.c:10218: Test failed: Failed to set foreground window. ddraw7.c:10222: Test failed: Got unexpected hr 0. ddraw7.c:10224: Test failed: Got unexpected hr 0. ddraw7.c:10230: Test failed: Got unexpected hr 0. ddraw7.c:10254: Test failed: Got unexpected hr 0. ddraw7.c:10256: Test failed: Got unexpected hr 0x887600e1. ddraw7.c:10262: Test failed: Got unexpected hr 0. ddraw7.c:10292: Test failed: Failed to set foreground window. ddraw7.c:10306: Test failed: Failed to set foreground window. ddraw7.c:17178: Test failed: WM_KILLFOCUS was not received. ddraw7.c:17340: Test failed: Got unexpected hr 0x887600e1. ddraw7.c:17343: Test failed: Got unexpected hr 0x887600ff. 1e70:ddraw7: unhandled exception c0000005 at 00509A3A
This merge request was approved by Jan Sikorski.