From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ddraw/tests/ddraw1.c | 89 ++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 89 ++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 96 +++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 96 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 370 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 804f1dcc6d6..e3cc346b637 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -14262,9 +14262,22 @@ static void test_caps(void) { DDCAPS hal_caps, hel_caps; IDirectDraw *ddraw; + HWND window; HRESULT hr; BOOL no3d;
+ static const struct + { + unsigned int depth; + DWORD flag; + } + depth_caps[] = + { + {16, DDBD_16}, + {24, DDBD_24}, + {32, DDBD_32}, + }; + static const DWORD caps_hel = DDSCAPS_FLIP | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PALETTE @@ -14294,8 +14307,11 @@ static void test_caps(void) | DDSCAPS_VIDEOMEMORY | DDSCAPS_MIPMAP;
+ window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hel_caps, 0, sizeof(hel_caps)); @@ -14323,6 +14339,41 @@ static void test_caps(void) "Got HAL depth caps %#lx.\n", hal_caps.dwZBufferBitDepths); todo_wine ok(hel_caps.dwZBufferBitDepths == DDBD_16, "Got HEL depth caps %#lx.\n", hel_caps.dwZBufferBitDepths);
+ for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) + { + IDirectDrawSurface *surface; + DDSURFACEDESC desc = + { + .dwSize = sizeof(DDSURFACEDESC), + .dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT, + .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .dwZBufferBitDepth = depth_caps[i].depth, + .dwWidth = 64, + .dwHeight = 64, + }; + + winetest_push_context("depth %u", depth_caps[i].depth); + + /* dwZBufferBitDepths sometimes reports false negatives, + * but it has not been known to report false positives. */ + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + ok(hr == S_OK || (!(hal_caps.dwZBufferBitDepths & depth_caps[i].flag) && hr == DDERR_INVALIDPIXELFORMAT), + "Got hr %#lx.\n", hr); + + if (hr == S_OK) + { + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (depth_caps[i].depth == 32) + ok(desc.ddsCaps.dwCaps == (DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_ZBUFFER) + || (ddraw_is_warp(ddraw) && desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER)), + "Got caps %#lx.\n", desc.ddsCaps.dwCaps); + IDirectDrawSurface_Release(surface); + } + + winetest_pop_context(); + } + IDirectDraw_Release(ddraw);
if (hal_caps.ddsCaps.dwCaps) @@ -14354,6 +14405,8 @@ static void test_caps(void)
hr = DirectDrawCreate((GUID *)DDCREATE_EMULATIONONLY, &ddraw, NULL); ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hel_caps, 0, sizeof(hel_caps)); @@ -14372,7 +14425,43 @@ static void test_caps(void) "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); todo_wine ok(hel_caps.ddsCaps.dwCaps == caps_hel, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
+ for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) + { + IDirectDrawSurface *surface; + DDSURFACEDESC desc = + { + .dwSize = sizeof(DDSURFACEDESC), + .dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT, + .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .dwZBufferBitDepth = depth_caps[i].depth, + .dwWidth = 64, + .dwHeight = 64, + }; + + winetest_push_context("depth %u", depth_caps[i].depth); + + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + if (depth_caps[i].depth == 16 || depth_caps[i].depth == 32) + ok(hr == S_OK, "Got hr %#lx.\n", hr); + else + todo_wine ok(hr == DDERR_INVALIDPIXELFORMAT, "Got hr %#lx.\n", hr); + + if (hr == S_OK) + { + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (depth_caps[i].depth != 32) + ok(desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER), + "Got caps %#lx.\n", desc.ddsCaps.dwCaps); + IDirectDrawSurface_Release(surface); + } + + winetest_pop_context(); + } + IDirectDraw_Release(ddraw); + + DestroyWindow(window); }
static void test_d32_support(void) diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 011206a6c0f..7745c0732d8 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -15276,9 +15276,22 @@ static void test_caps(void) DDCAPS hal_caps, hel_caps; IDirectDraw2 *ddraw; IDirectDraw *ddraw1; + HWND window; HRESULT hr; BOOL no3d;
+ static const struct + { + unsigned int depth; + DWORD flag; + } + depth_caps[] = + { + {16, DDBD_16}, + {24, DDBD_24}, + {32, DDBD_32}, + }; + static const DWORD caps_hel = DDSCAPS_FLIP | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PALETTE @@ -15308,8 +15321,11 @@ static void test_caps(void) | DDSCAPS_VIDEOMEMORY | DDSCAPS_MIPMAP;
+ window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hel_caps, 0, sizeof(hel_caps)); @@ -15337,6 +15353,41 @@ static void test_caps(void) "Got HAL depth caps %#lx.\n", hal_caps.dwZBufferBitDepths); todo_wine ok(hel_caps.dwZBufferBitDepths == DDBD_16, "Got HEL depth caps %#lx.\n", hel_caps.dwZBufferBitDepths);
+ for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) + { + IDirectDrawSurface *surface; + DDSURFACEDESC desc = + { + .dwSize = sizeof(DDSURFACEDESC), + .dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT, + .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .dwZBufferBitDepth = depth_caps[i].depth, + .dwWidth = 64, + .dwHeight = 64, + }; + + winetest_push_context("depth %u", depth_caps[i].depth); + + /* dwZBufferBitDepths sometimes reports false negatives, + * but it has not been known to report false positives. */ + hr = IDirectDraw2_CreateSurface(ddraw, &desc, &surface, NULL); + ok(hr == S_OK || (!(hal_caps.dwZBufferBitDepths & depth_caps[i].flag) && hr == DDERR_INVALIDPIXELFORMAT), + "Got hr %#lx.\n", hr); + + if (hr == S_OK) + { + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (depth_caps[i].depth == 32) + ok(desc.ddsCaps.dwCaps == (DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_ZBUFFER) + || (ddraw_is_warp(ddraw) && desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER)), + "Got caps %#lx.\n", desc.ddsCaps.dwCaps); + IDirectDrawSurface_Release(surface); + } + + winetest_pop_context(); + } + IDirectDraw2_Release(ddraw);
if (hal_caps.ddsCaps.dwCaps) @@ -15374,6 +15425,8 @@ static void test_caps(void) hr = IDirectDraw_QueryInterface(ddraw1, &IID_IDirectDraw2, (void **)&ddraw); ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); IDirectDraw_Release(ddraw1); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hel_caps, 0, sizeof(hel_caps)); @@ -15392,7 +15445,43 @@ static void test_caps(void) "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); todo_wine ok(hel_caps.ddsCaps.dwCaps == caps_hel, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
+ for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) + { + IDirectDrawSurface *surface; + DDSURFACEDESC desc = + { + .dwSize = sizeof(DDSURFACEDESC), + .dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT, + .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .dwZBufferBitDepth = depth_caps[i].depth, + .dwWidth = 64, + .dwHeight = 64, + }; + + winetest_push_context("depth %u", depth_caps[i].depth); + + hr = IDirectDraw2_CreateSurface(ddraw, &desc, &surface, NULL); + if (depth_caps[i].depth == 16 || depth_caps[i].depth == 32) + ok(hr == S_OK, "Got hr %#lx.\n", hr); + else + todo_wine ok(hr == DDERR_INVALIDPIXELFORMAT, "Got hr %#lx.\n", hr); + + if (hr == S_OK) + { + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (depth_caps[i].depth != 32) + ok(desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER), + "Got caps %#lx.\n", desc.ddsCaps.dwCaps); + IDirectDrawSurface_Release(surface); + } + + winetest_pop_context(); + } + IDirectDraw2_Release(ddraw); + + DestroyWindow(window); }
static void test_d32_support(void) diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index f73cf9efe7c..b7be97c32bc 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -18016,9 +18016,23 @@ static void test_caps(void) DDCAPS hal_caps, hel_caps; IDirectDraw4 *ddraw; IDirectDraw *ddraw1; + HWND window; HRESULT hr; BOOL no3d;
+ static const struct + { + unsigned int depth; + DWORD flag; + DWORD mask; + } + depth_caps[] = + { + {16, DDBD_16, 0xffff}, + {24, DDBD_24, 0xffffff}, + {32, DDBD_32, 0xffffffff}, + }; + static const DWORD caps_hel = DDSCAPS_FLIP | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PALETTE @@ -18048,8 +18062,11 @@ static void test_caps(void) | DDSCAPS_VIDEOMEMORY | DDSCAPS_MIPMAP;
+ window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hel_caps, 0, sizeof(hel_caps)); @@ -18077,6 +18094,44 @@ static void test_caps(void) "Got HAL depth caps %#lx.\n", hal_caps.dwZBufferBitDepths); todo_wine ok(hel_caps.dwZBufferBitDepths == DDBD_16, "Got HEL depth caps %#lx.\n", hel_caps.dwZBufferBitDepths);
+ for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) + { + IDirectDrawSurface4 *surface; + DDSURFACEDESC2 desc = + { + .dwSize = sizeof(DDSURFACEDESC2), + .dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT, + .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), + .ddpfPixelFormat.dwFlags = DDPF_ZBUFFER, + .ddpfPixelFormat.dwZBufferBitDepth = depth_caps[i].depth, + .ddpfPixelFormat.dwZBitMask = depth_caps[i].mask, + .dwWidth = 64, + .dwHeight = 64, + }; + + winetest_push_context("depth %u", depth_caps[i].depth); + + /* dwZBufferBitDepths sometimes reports false negatives, + * but it has not been known to report false positives. */ + hr = IDirectDraw4_CreateSurface(ddraw, &desc, &surface, NULL); + ok(hr == S_OK || (!(hal_caps.dwZBufferBitDepths & depth_caps[i].flag) && hr == DDERR_INVALIDPIXELFORMAT), + "Got hr %#lx.\n", hr); + + if (hr == S_OK) + { + hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &desc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (depth_caps[i].depth == 32) + ok(desc.ddsCaps.dwCaps == (DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_ZBUFFER) + || (ddraw_is_warp(ddraw) && desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER)), + "Got caps %#lx.\n", desc.ddsCaps.dwCaps); + IDirectDrawSurface4_Release(surface); + } + + winetest_pop_context(); + } + IDirectDraw4_Release(ddraw);
if (hal_caps.ddsCaps.dwCaps) @@ -18114,6 +18169,8 @@ static void test_caps(void) hr = IDirectDraw_QueryInterface(ddraw1, &IID_IDirectDraw4, (void **)&ddraw); ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); IDirectDraw_Release(ddraw1); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hel_caps, 0, sizeof(hel_caps)); @@ -18132,7 +18189,46 @@ static void test_caps(void) "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); todo_wine ok(hel_caps.ddsCaps.dwCaps == caps_hel, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
+ for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) + { + IDirectDrawSurface4 *surface; + DDSURFACEDESC2 desc = + { + .dwSize = sizeof(DDSURFACEDESC2), + .dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT, + .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), + .ddpfPixelFormat.dwFlags = DDPF_ZBUFFER, + .ddpfPixelFormat.dwZBufferBitDepth = depth_caps[i].depth, + .ddpfPixelFormat.dwZBitMask = depth_caps[i].mask, + .dwWidth = 64, + .dwHeight = 64, + }; + + winetest_push_context("depth %u", depth_caps[i].depth); + + hr = IDirectDraw4_CreateSurface(ddraw, &desc, &surface, NULL); + if (depth_caps[i].depth == 16 || depth_caps[i].depth == 32) + ok(hr == S_OK, "Got hr %#lx.\n", hr); + else + todo_wine ok(hr == DDERR_INVALIDPIXELFORMAT, "Got hr %#lx.\n", hr); + + if (hr == S_OK) + { + hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &desc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (depth_caps[i].depth != 32) + ok(desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER), + "Got caps %#lx.\n", desc.ddsCaps.dwCaps); + IDirectDrawSurface4_Release(surface); + } + + winetest_pop_context(); + } + IDirectDraw4_Release(ddraw); + + DestroyWindow(window); }
static void test_d32_support(void) diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 1ccfc5638a6..42b47fef8e7 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -18160,9 +18160,23 @@ static void test_caps(void) { DDCAPS hal_caps, hel_caps; IDirectDraw7 *ddraw; + HWND window; HRESULT hr; BOOL no3d;
+ static const struct + { + unsigned int depth; + DWORD flag; + DWORD mask; + } + depth_caps[] = + { + {16, DDBD_16, 0xffff}, + {24, DDBD_24, 0xffffff}, + {32, DDBD_32, 0xffffffff}, + }; + static const DWORD caps_hel = DDSCAPS_FLIP | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PALETTE @@ -18192,8 +18206,11 @@ static void test_caps(void) | DDSCAPS_VIDEOMEMORY | DDSCAPS_MIPMAP;
+ window = create_window(); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hel_caps, 0, sizeof(hel_caps)); @@ -18221,6 +18238,44 @@ static void test_caps(void) "Got HAL depth caps %#lx.\n", hal_caps.dwZBufferBitDepths); todo_wine ok(hel_caps.dwZBufferBitDepths == DDBD_16, "Got HEL depth caps %#lx.\n", hel_caps.dwZBufferBitDepths);
+ for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) + { + IDirectDrawSurface7 *surface; + DDSURFACEDESC2 desc = + { + .dwSize = sizeof(DDSURFACEDESC2), + .dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT, + .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), + .ddpfPixelFormat.dwFlags = DDPF_ZBUFFER, + .ddpfPixelFormat.dwZBufferBitDepth = depth_caps[i].depth, + .ddpfPixelFormat.dwZBitMask = depth_caps[i].mask, + .dwWidth = 64, + .dwHeight = 64, + }; + + winetest_push_context("depth %u", depth_caps[i].depth); + + /* dwZBufferBitDepths sometimes reports false negatives, + * but it has not been known to report false positives. */ + hr = IDirectDraw7_CreateSurface(ddraw, &desc, &surface, NULL); + ok(hr == S_OK || (!(hal_caps.dwZBufferBitDepths & depth_caps[i].flag) && hr == DDERR_INVALIDPIXELFORMAT), + "Got hr %#lx.\n", hr); + + if (hr == S_OK) + { + hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &desc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (depth_caps[i].depth == 32) + ok(desc.ddsCaps.dwCaps == (DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_ZBUFFER) + || (ddraw_is_warp(ddraw) && desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER)), + "Got caps %#lx.\n", desc.ddsCaps.dwCaps); + IDirectDrawSurface7_Release(surface); + } + + winetest_pop_context(); + } + IDirectDraw7_Release(ddraw);
if (hal_caps.ddsCaps.dwCaps) @@ -18252,6 +18307,8 @@ static void test_caps(void)
hr = pDirectDrawCreateEx((GUID *)DDCREATE_EMULATIONONLY, (void **)&ddraw, &IID_IDirectDraw7, NULL); ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
memset(&hal_caps, 0, sizeof(hal_caps)); memset(&hel_caps, 0, sizeof(hel_caps)); @@ -18270,7 +18327,46 @@ static void test_caps(void) "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); todo_wine ok(hel_caps.ddsCaps.dwCaps == caps_hel, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
+ for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) + { + IDirectDrawSurface7 *surface; + DDSURFACEDESC2 desc = + { + .dwSize = sizeof(DDSURFACEDESC2), + .dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT, + .ddsCaps.dwCaps = DDSCAPS_ZBUFFER, + .ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT), + .ddpfPixelFormat.dwFlags = DDPF_ZBUFFER, + .ddpfPixelFormat.dwZBufferBitDepth = depth_caps[i].depth, + .ddpfPixelFormat.dwZBitMask = depth_caps[i].mask, + .dwWidth = 64, + .dwHeight = 64, + }; + + winetest_push_context("depth %u", depth_caps[i].depth); + + hr = IDirectDraw7_CreateSurface(ddraw, &desc, &surface, NULL); + if (depth_caps[i].depth == 16 || depth_caps[i].depth == 32) + ok(hr == S_OK, "Got hr %#lx.\n", hr); + else + todo_wine ok(hr == DDERR_INVALIDPIXELFORMAT, "Got hr %#lx.\n", hr); + + if (hr == S_OK) + { + hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &desc); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine_if (depth_caps[i].depth != 32) + ok(desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER), + "Got caps %#lx.\n", desc.ddsCaps.dwCaps); + IDirectDrawSurface7_Release(surface); + } + + winetest_pop_context(); + } + IDirectDraw7_Release(ddraw); + + DestroyWindow(window); }
static void test_d32_support(void)