From: Elizabeth Figura zfigura@codeweavers.com
Windows 98 NVidia and ATI drivers seem to support this. --- dlls/ddraw/tests/ddraw1.c | 2 -- dlls/ddraw/tests/ddraw2.c | 2 -- dlls/ddraw/tests/ddraw4.c | 2 -- dlls/ddraw/tests/ddraw7.c | 2 -- dlls/wined3d/utils.c | 2 +- 5 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 3292883afb3..9fd952cf55a 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -14425,8 +14425,6 @@ static void test_d32_support(void) ok((surface_desc.dwFlags & DDSD_ZBUFFERBITDEPTH), "Got unexpected flags %#lx.\n", surface_desc.dwFlags); ok(surface_desc.dwZBufferBitDepth == 32, "Got unexpected dwZBufferBitDepth %lu.\n", surface_desc.dwZBufferBitDepth); - ok(!(surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY), - "Got unexpected surface caps %#lx.\n", surface_desc.ddsCaps.dwCaps); IDirectDrawSurface_Release(surface);
refcount = IDirectDraw_Release(ddraw); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 3c49c28a212..0431116d57c 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -15446,8 +15446,6 @@ static void test_d32_support(void) ok((surface_desc.dwFlags & DDSD_ZBUFFERBITDEPTH), "Got unexpected flags %#lx.\n", surface_desc.dwFlags); ok(surface_desc.dwZBufferBitDepth == 32, "Got unexpected dwZBufferBitDepth %lu.\n", surface_desc.dwZBufferBitDepth); - ok(!(surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY), - "Got unexpected surface caps %#lx.\n", surface_desc.ddsCaps.dwCaps); IDirectDrawSurface_Release(surface);
refcount = IDirectDraw2_Release(ddraw); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 064591ec4e6..683530c8e2d 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -18180,8 +18180,6 @@ static void test_d32_support(void) "Got unexpected dwZBufferBitDepth %lu.\n", surface_desc.ddpfPixelFormat.dwZBufferBitDepth); ok(surface_desc.ddpfPixelFormat.dwZBitMask == 0xffffffff, "Got unexpected Z mask 0x%08lx.\n", surface_desc.ddpfPixelFormat.dwZBitMask); - ok(!(surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY), - "Got unexpected surface caps %#lx.\n", surface_desc.ddsCaps.dwCaps); IDirectDrawSurface4_Release(surface);
refcount = IDirectDraw4_Release(ddraw); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index fae4f6ae9cc..547971a9368 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -18318,8 +18318,6 @@ static void test_d32_support(void) "Got unexpected dwZBufferBitDepth %lu.\n", surface_desc.ddpfPixelFormat.dwZBufferBitDepth); ok(surface_desc.ddpfPixelFormat.dwZBitMask == 0xffffffff, "Got unexpected Z mask 0x%08lx.\n", surface_desc.ddpfPixelFormat.dwZBitMask); - ok(!(surface_desc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY), - "Got unexpected surface caps %#lx.\n", surface_desc.ddsCaps.dwCaps); IDirectDrawSurface7_Release(surface);
refcount = IDirectDraw7_Release(ddraw); diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 5c37dbba0e9..7ba67781e50 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -1353,7 +1353,7 @@ const struct wined3d_color_key_conversion * wined3d_format_get_color_key_convers }
/* We intentionally don't support WINED3DFMT_D32_UNORM. No hardware driver - * supports it, and applications get confused when we do. + * supports it on d3d9, and applications get confused when we do. * * The following formats explicitly don't have WINED3D_FORMAT_CAP_TEXTURE set: *
From: Elizabeth Figura zfigura@codeweavers.com
Tested with an ATI Rage 128 and a NVidia GeForce 2 MX under Windows 98.
This fixes a number of failures:
* DirectDraw drivers on Windows 98 sometimes support some flags listed under caps_never, namely ALPHA, SYSTEMMEMORY, VISIBLE, HWCODEC, MODEX, STANDARDVGAMODE.
* DirectDraw drivers on Windows 98 sometimes lack some flags listed under caps_hal, namely COMPLEX, FRONTBUFFER, LOCALVIDMEM and NONLOCALVIDMEM.
* SYSTEMMEMORY and OVERLAY are additionally both supported on both the ATI and NVidia cards on Windows 98, but not WARP. Conversely, WARP supports COMPLEX and OWNDC, which neither the ATI or NVIDIA cards do. I haven't gone to the trouble of marking these flags as WARP-specific, however.
* HEL caps are uniform across drivers, including WARP. Since the HEL is a Microsoft component this is not particularly surprising. Accordingly those tests are tightened to check for an exact match, and the caps_hal and caps_always flags are combined and simplified.
* Current WARP seems to have fixed divergence in behaviour between 32-bit and 64-bit ddraw. --- dlls/ddraw/tests/ddraw1.c | 98 +++++++++++++++--------------------- dlls/ddraw/tests/ddraw2.c | 103 ++++++++++++++++---------------------- dlls/ddraw/tests/ddraw4.c | 56 +++++++++------------ dlls/ddraw/tests/ddraw7.c | 56 +++++++++------------ 4 files changed, 132 insertions(+), 181 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 9fd952cf55a..804f1dcc6d6 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -14260,43 +14260,39 @@ static void test_clipper_refcount(void)
static void test_caps(void) { - DWORD caps_never, caps_always, caps_hal; DDCAPS hal_caps, hel_caps; IDirectDraw *ddraw; HRESULT hr; BOOL no3d;
- caps_never = DDSCAPS_RESERVED1 - | DDSCAPS_ALPHA + static const DWORD caps_hel = DDSCAPS_FLIP + | DDSCAPS_OFFSCREENPLAIN + | DDSCAPS_PALETTE + | DDSCAPS_PRIMARYSURFACE + | DDSCAPS_TEXTURE + | DDSCAPS_ZBUFFER + | DDSCAPS_MIPMAP; + + static const DWORD caps_never = DDSCAPS_RESERVED1 | DDSCAPS_PRIMARYSURFACELEFT - | DDSCAPS_SYSTEMMEMORY - | DDSCAPS_VISIBLE | DDSCAPS_WRITEONLY | DDSCAPS_LIVEVIDEO - | DDSCAPS_HWCODEC - | DDSCAPS_MODEX | DDSCAPS_RESERVED2 | 0x01000000u | 0x02000000u | DDSCAPS_ALLOCONLOAD | DDSCAPS_VIDEOPORT - | DDSCAPS_STANDARDVGAMODE | DDSCAPS_OPTIMIZED;
- caps_always = DDSCAPS_FLIP + static const DWORD caps_always = DDSCAPS_BACKBUFFER + | DDSCAPS_FLIP | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE - | DDSCAPS_ZBUFFER - | DDSCAPS_MIPMAP; - - caps_hal = DDSCAPS_BACKBUFFER - | DDSCAPS_COMPLEX - | DDSCAPS_FRONTBUFFER | DDSCAPS_3DDEVICE + | DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY - | DDSCAPS_LOCALVIDMEM - | DDSCAPS_NONLOCALVIDMEM; + | DDSCAPS_MIPMAP;
ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); @@ -14318,14 +14314,14 @@ static void test_caps(void) if (hal_caps.ddsCaps.dwCaps) { ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_hal), + todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); } - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(hel_caps.ddsCaps.dwCaps == caps_hel, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + + ok(!(hal_caps.dwZBufferBitDepths & ~(DDBD_16 | DDBD_24 | DDBD_32)), + "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);
IDirectDraw_Release(ddraw);
@@ -14348,49 +14344,35 @@ static void test_caps(void) hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps);
ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_hal), + todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - if (is_ddraw64) - { - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - } - else - { - todo_wine ok(!hel_caps.ddsCaps.dwCaps, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - } + todo_wine ok(!(hel_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
IDirectDraw_Release(ddraw); }
hr = DirectDrawCreate((GUID *)DDCREATE_EMULATIONONLY, &ddraw, NULL); - ok(hr == DD_OK || (is_ddraw64 && hr == E_FAIL), "Got unexpected hr %#lx.\n", hr); - if (SUCCEEDED(hr)) - { - memset(&hal_caps, 0, sizeof(hal_caps)); - memset(&hel_caps, 0, sizeof(hel_caps)); - hal_caps.dwSize = sizeof(hal_caps); - hel_caps.dwSize = sizeof(hel_caps); - hr = IDirectDraw_GetCaps(ddraw, &hal_caps, &hel_caps); - ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); - ok(hal_caps.ddsOldCaps.dwCaps == hal_caps.ddsCaps.dwCaps, - "Got unexpected caps %#lx, expected %#lx.\n", - hal_caps.ddsOldCaps.dwCaps, hal_caps.ddsCaps.dwCaps); - ok(hel_caps.ddsOldCaps.dwCaps == hel_caps.ddsCaps.dwCaps, - "Got unexpected caps %#lx, expected %#lx.\n", - hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr);
- todo_wine ok(!hal_caps.ddsCaps.dwCaps, "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + memset(&hal_caps, 0, sizeof(hal_caps)); + memset(&hel_caps, 0, sizeof(hel_caps)); + hal_caps.dwSize = sizeof(hal_caps); + hel_caps.dwSize = sizeof(hel_caps); + hr = IDirectDraw_GetCaps(ddraw, &hal_caps, &hel_caps); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + ok(hal_caps.ddsOldCaps.dwCaps == hal_caps.ddsCaps.dwCaps, + "Got unexpected caps %#lx, expected %#lx.\n", + hal_caps.ddsOldCaps.dwCaps, hal_caps.ddsCaps.dwCaps); + ok(hel_caps.ddsOldCaps.dwCaps == hel_caps.ddsCaps.dwCaps, + "Got unexpected caps %#lx, expected %#lx.\n", + hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps);
- IDirectDraw_Release(ddraw); - } + todo_wine ok(!(hal_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + "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); + + IDirectDraw_Release(ddraw); }
static void test_d32_support(void) diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 0431116d57c..011206a6c0f 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -15273,44 +15273,40 @@ static void test_clipper_refcount(void)
static void test_caps(void) { - DWORD caps_never, caps_always, caps_hal; DDCAPS hal_caps, hel_caps; IDirectDraw2 *ddraw; IDirectDraw *ddraw1; HRESULT hr; BOOL no3d;
- caps_never = DDSCAPS_RESERVED1 - | DDSCAPS_ALPHA + static const DWORD caps_hel = DDSCAPS_FLIP + | DDSCAPS_OFFSCREENPLAIN + | DDSCAPS_PALETTE + | DDSCAPS_PRIMARYSURFACE + | DDSCAPS_TEXTURE + | DDSCAPS_ZBUFFER + | DDSCAPS_MIPMAP; + + static const DWORD caps_never = DDSCAPS_RESERVED1 | DDSCAPS_PRIMARYSURFACELEFT - | DDSCAPS_SYSTEMMEMORY - | DDSCAPS_VISIBLE | DDSCAPS_WRITEONLY | DDSCAPS_LIVEVIDEO - | DDSCAPS_HWCODEC - | DDSCAPS_MODEX | DDSCAPS_RESERVED2 | 0x01000000u | 0x02000000u | DDSCAPS_ALLOCONLOAD | DDSCAPS_VIDEOPORT - | DDSCAPS_STANDARDVGAMODE | DDSCAPS_OPTIMIZED;
- caps_always = DDSCAPS_FLIP + static const DWORD caps_always = DDSCAPS_BACKBUFFER + | DDSCAPS_FLIP | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE - | DDSCAPS_ZBUFFER - | DDSCAPS_MIPMAP; - - caps_hal = DDSCAPS_BACKBUFFER - | DDSCAPS_COMPLEX - | DDSCAPS_FRONTBUFFER | DDSCAPS_3DDEVICE + | DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY - | DDSCAPS_LOCALVIDMEM - | DDSCAPS_NONLOCALVIDMEM; + | DDSCAPS_MIPMAP;
ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); @@ -15332,14 +15328,14 @@ static void test_caps(void) if (hal_caps.ddsCaps.dwCaps) { ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_hal), + todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); } - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(hel_caps.ddsCaps.dwCaps == caps_hel, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + + ok(!(hal_caps.dwZBufferBitDepths & ~(DDBD_16 | DDBD_24 | DDBD_32)), + "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);
IDirectDraw2_Release(ddraw);
@@ -15365,53 +15361,38 @@ static void test_caps(void) hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps);
ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_hal), + todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - if (is_ddraw64) - { - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - } - else - { - todo_wine ok(!hel_caps.ddsCaps.dwCaps, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - } + todo_wine ok(!(hel_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
IDirectDraw2_Release(ddraw); }
hr = DirectDrawCreate((GUID *)DDCREATE_EMULATIONONLY, &ddraw1, NULL); - ok(hr == DD_OK || (is_ddraw64 && hr == E_FAIL), "Got unexpected hr %#lx.\n", hr); - if (SUCCEEDED(hr)) - { - hr = IDirectDraw_QueryInterface(ddraw1, &IID_IDirectDraw2, (void **)&ddraw); - ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); - IDirectDraw_Release(ddraw1); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDirectDraw_QueryInterface(ddraw1, &IID_IDirectDraw2, (void **)&ddraw); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + IDirectDraw_Release(ddraw1);
- memset(&hal_caps, 0, sizeof(hal_caps)); - memset(&hel_caps, 0, sizeof(hel_caps)); - hal_caps.dwSize = sizeof(hal_caps); - hel_caps.dwSize = sizeof(hel_caps); - hr = IDirectDraw2_GetCaps(ddraw, &hal_caps, &hel_caps); - ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); - ok(hal_caps.ddsOldCaps.dwCaps == hal_caps.ddsCaps.dwCaps, - "Got unexpected caps %#lx, expected %#lx.\n", - hal_caps.ddsOldCaps.dwCaps, hal_caps.ddsCaps.dwCaps); - ok(hel_caps.ddsOldCaps.dwCaps == hel_caps.ddsCaps.dwCaps, - "Got unexpected caps %#lx, expected %#lx.\n", - hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps); + memset(&hal_caps, 0, sizeof(hal_caps)); + memset(&hel_caps, 0, sizeof(hel_caps)); + hal_caps.dwSize = sizeof(hal_caps); + hel_caps.dwSize = sizeof(hel_caps); + hr = IDirectDraw2_GetCaps(ddraw, &hal_caps, &hel_caps); + ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + ok(hal_caps.ddsOldCaps.dwCaps == hal_caps.ddsCaps.dwCaps, + "Got unexpected caps %#lx, expected %#lx.\n", + hal_caps.ddsOldCaps.dwCaps, hal_caps.ddsCaps.dwCaps); + ok(hel_caps.ddsOldCaps.dwCaps == hel_caps.ddsCaps.dwCaps, + "Got unexpected caps %#lx, expected %#lx.\n", + hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps);
- todo_wine ok(!hal_caps.ddsCaps.dwCaps, "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(!(hal_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + "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);
- IDirectDraw2_Release(ddraw); - } + IDirectDraw2_Release(ddraw); }
static void test_d32_support(void) diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 683530c8e2d..f73cf9efe7c 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -18013,44 +18013,40 @@ static void test_clipper_refcount(void)
static void test_caps(void) { - DWORD caps_never, caps_always, caps_hal; DDCAPS hal_caps, hel_caps; IDirectDraw4 *ddraw; IDirectDraw *ddraw1; HRESULT hr; BOOL no3d;
- caps_never = DDSCAPS_RESERVED1 - | DDSCAPS_ALPHA + static const DWORD caps_hel = DDSCAPS_FLIP + | DDSCAPS_OFFSCREENPLAIN + | DDSCAPS_PALETTE + | DDSCAPS_PRIMARYSURFACE + | DDSCAPS_TEXTURE + | DDSCAPS_ZBUFFER + | DDSCAPS_MIPMAP; + + static const DWORD caps_never = DDSCAPS_RESERVED1 | DDSCAPS_PRIMARYSURFACELEFT - | DDSCAPS_SYSTEMMEMORY - | DDSCAPS_VISIBLE | DDSCAPS_WRITEONLY | DDSCAPS_LIVEVIDEO - | DDSCAPS_HWCODEC - | DDSCAPS_MODEX | DDSCAPS_RESERVED2 | 0x01000000u | 0x02000000u | DDSCAPS_ALLOCONLOAD | DDSCAPS_VIDEOPORT - | DDSCAPS_STANDARDVGAMODE | DDSCAPS_OPTIMIZED;
- caps_always = DDSCAPS_FLIP + static const DWORD caps_always = DDSCAPS_BACKBUFFER + | DDSCAPS_FLIP | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE - | DDSCAPS_ZBUFFER - | DDSCAPS_MIPMAP; - - caps_hal = DDSCAPS_BACKBUFFER - | DDSCAPS_COMPLEX - | DDSCAPS_FRONTBUFFER | DDSCAPS_3DDEVICE + | DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY - | DDSCAPS_LOCALVIDMEM - | DDSCAPS_NONLOCALVIDMEM; + | DDSCAPS_MIPMAP;
ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); @@ -18072,14 +18068,14 @@ static void test_caps(void) if (hal_caps.ddsCaps.dwCaps) { ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_hal), + todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); } - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(hel_caps.ddsCaps.dwCaps == caps_hel, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + + ok(!(hal_caps.dwZBufferBitDepths & ~(DDBD_16 | DDBD_24 | DDBD_32)), + "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);
IDirectDraw4_Release(ddraw);
@@ -18105,10 +18101,10 @@ static void test_caps(void) hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps);
ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_hal), + todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine ok(!hel_caps.ddsCaps.dwCaps, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(!(hel_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
IDirectDraw4_Release(ddraw); } @@ -18132,11 +18128,9 @@ static void test_caps(void) "Got unexpected caps %#lx, expected %#lx.\n", hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps);
- todo_wine ok(!hal_caps.ddsCaps.dwCaps, "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(!(hal_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + "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);
IDirectDraw4_Release(ddraw); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 547971a9368..1ccfc5638a6 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -18158,43 +18158,39 @@ static void test_begin_end_state_block(void)
static void test_caps(void) { - DWORD caps_never, caps_always, caps_hal; DDCAPS hal_caps, hel_caps; IDirectDraw7 *ddraw; HRESULT hr; BOOL no3d;
- caps_never = DDSCAPS_RESERVED1 - | DDSCAPS_ALPHA + static const DWORD caps_hel = DDSCAPS_FLIP + | DDSCAPS_OFFSCREENPLAIN + | DDSCAPS_PALETTE + | DDSCAPS_PRIMARYSURFACE + | DDSCAPS_TEXTURE + | DDSCAPS_ZBUFFER + | DDSCAPS_MIPMAP; + + static const DWORD caps_never = DDSCAPS_RESERVED1 | DDSCAPS_PRIMARYSURFACELEFT - | DDSCAPS_SYSTEMMEMORY - | DDSCAPS_VISIBLE | DDSCAPS_WRITEONLY | DDSCAPS_LIVEVIDEO - | DDSCAPS_HWCODEC - | DDSCAPS_MODEX | DDSCAPS_RESERVED2 | 0x01000000u | 0x02000000u | DDSCAPS_ALLOCONLOAD | DDSCAPS_VIDEOPORT - | DDSCAPS_STANDARDVGAMODE | DDSCAPS_OPTIMIZED;
- caps_always = DDSCAPS_FLIP + static const DWORD caps_always = DDSCAPS_BACKBUFFER + | DDSCAPS_FLIP | DDSCAPS_OFFSCREENPLAIN | DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE - | DDSCAPS_ZBUFFER - | DDSCAPS_MIPMAP; - - caps_hal = DDSCAPS_BACKBUFFER - | DDSCAPS_COMPLEX - | DDSCAPS_FRONTBUFFER | DDSCAPS_3DDEVICE + | DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY - | DDSCAPS_LOCALVIDMEM - | DDSCAPS_NONLOCALVIDMEM; + | DDSCAPS_MIPMAP;
ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); @@ -18216,14 +18212,14 @@ static void test_caps(void) if (hal_caps.ddsCaps.dwCaps) { ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_hal), + todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); } - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(hel_caps.ddsCaps.dwCaps == caps_hel, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + + ok(!(hal_caps.dwZBufferBitDepths & ~(DDBD_16 | DDBD_24 | DDBD_32)), + "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);
IDirectDraw7_Release(ddraw);
@@ -18246,10 +18242,10 @@ static void test_caps(void) hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps);
ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_hal), + todo_wine_if(no3d) ok(!(~hal_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - todo_wine ok(!hel_caps.ddsCaps.dwCaps, "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(!(hel_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
IDirectDraw7_Release(ddraw); } @@ -18270,11 +18266,9 @@ static void test_caps(void) "Got unexpected caps %#lx, expected %#lx.\n", hel_caps.ddsOldCaps.dwCaps, hel_caps.ddsCaps.dwCaps);
- todo_wine ok(!hal_caps.ddsCaps.dwCaps, "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); - ok(!(hel_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - ok(!(~hel_caps.ddsCaps.dwCaps & caps_always), "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); - todo_wine_if(!no3d) ok(!(hel_caps.ddsCaps.dwCaps & caps_hal), - "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps); + todo_wine ok(!(hal_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + "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);
IDirectDraw7_Release(ddraw); }
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)
From: Elizabeth Figura zfigura@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=27002 --- dlls/ddraw/ddraw.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index ed342bfd708..e59f7c9a01f 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1483,6 +1483,33 @@ HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) return DD_OK; }
+static DWORD get_z_buffer_caps(struct ddraw *ddraw) +{ + struct wined3d_display_mode mode; + DWORD ret = 0; + + static const struct + { + enum wined3d_format_id format; + DWORD flag; + } + formats[] = + { + {WINED3DFMT_D16_UNORM, DDBD_16}, + {WINED3DFMT_X8D24_UNORM, DDBD_24}, + {WINED3DFMT_D32_UNORM, DDBD_32}, + }; + + wined3d_output_get_display_mode(ddraw->wined3d_output, &mode, NULL); + for (unsigned int i = 0; i < ARRAY_SIZE(formats); ++i) + { + if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, ddraw->wined3d_adapter, WINED3D_DEVICE_TYPE_HAL, + mode.format_id, 0, WINED3D_BIND_DEPTH_STENCIL, WINED3D_RTYPE_TEXTURE_2D, formats[i].format))) + ret |= formats[i].flag; + } + return ret; +} + /***************************************************************************** * IDirectDraw7::GetCaps * @@ -1549,6 +1576,7 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD caps.dwCKeyCaps = winecaps.ddraw_caps.color_key_caps; caps.dwFXCaps = winecaps.ddraw_caps.fx_caps; caps.dwPalCaps = DDPCAPS_8BIT | DDPCAPS_PRIMARYSURFACE; + caps.dwZBufferBitDepths = get_z_buffer_caps(ddraw); caps.ddsCaps.dwCaps = winecaps.ddraw_caps.dds_caps; caps.dwSVBCaps = winecaps.ddraw_caps.svb_caps; caps.dwSVBCKeyCaps = winecaps.ddraw_caps.svb_color_key_caps;