From: Elizabeth Figura zfigura@codeweavers.com
Fixes: 9fc3862dd4a09a8a457c1c449380e1e122228221 --- dlls/ddraw/tests/ddraw1.c | 105 ++++++++++++++++++---------------- dlls/ddraw/tests/ddraw2.c | 111 +++++++++++++++++++----------------- dlls/ddraw/tests/ddraw4.c | 117 ++++++++++++++++++++------------------ dlls/ddraw/tests/ddraw7.c | 6 +- 4 files changed, 177 insertions(+), 162 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index e3cc346b637..b864e58ab36 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -20,6 +20,7 @@
#define COBJMACROS
+#include <stdbool.h> #include <stdint.h> #include "wine/test.h" #include <limits.h> @@ -14341,6 +14342,7 @@ static void test_caps(void)
for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) { + bool supported = (hal_caps.dwZBufferBitDepths & depth_caps[i].flag); IDirectDrawSurface *surface; DDSURFACEDESC desc = { @@ -14357,8 +14359,7 @@ static void test_caps(void) /* 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); + ok(hr == S_OK || (!supported && hr == DDERR_INVALIDPIXELFORMAT), "Got hr %#lx.\n", hr);
if (hr == S_OK) { @@ -14366,7 +14367,7 @@ static void test_caps(void) 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)), + || (!supported && (desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER))), "Got caps %#lx.\n", desc.ddsCaps.dwCaps); IDirectDrawSurface_Release(surface); } @@ -14397,70 +14398,74 @@ static void test_caps(void) ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); 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 & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + todo_wine ok(!(hel_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)) + || broken(hel_caps.ddsCaps.dwCaps == caps_hel), /* Windows 8+ */ "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
IDirectDraw_Release(ddraw); }
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); + ok(hr == DD_OK || (is_ddraw64 && hr == E_FAIL), "Got unexpected hr %#lx.\n", hr); + if (SUCCEEDED(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)); - 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); + 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);
- 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); + 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);
- for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) - { - IDirectDrawSurface *surface; - DDSURFACEDESC desc = + for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) { - .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, - }; + 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); + 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); + 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); + 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(); }
- winetest_pop_context(); + IDirectDraw_Release(ddraw); }
- IDirectDraw_Release(ddraw); - DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 7745c0732d8..aaa9fd1cbdd 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -21,6 +21,7 @@ #include <math.h>
#define COBJMACROS +#include <stdbool.h> #include <stdint.h> #include "wine/test.h" #include <limits.h> @@ -15355,6 +15356,7 @@ static void test_caps(void)
for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) { + bool supported = (hal_caps.dwZBufferBitDepths & depth_caps[i].flag); IDirectDrawSurface *surface; DDSURFACEDESC desc = { @@ -15371,8 +15373,7 @@ static void test_caps(void) /* 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); + ok(hr == S_OK || (!supported && hr == DDERR_INVALIDPIXELFORMAT), "Got hr %#lx.\n", hr);
if (hr == S_OK) { @@ -15380,7 +15381,7 @@ static void test_caps(void) 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)), + || (!supported && (desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER))), "Got caps %#lx.\n", desc.ddsCaps.dwCaps); IDirectDrawSurface_Release(surface); } @@ -15414,73 +15415,77 @@ static void test_caps(void) ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); 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 & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + todo_wine ok(!(hel_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)) + || broken(hel_caps.ddsCaps.dwCaps == caps_hel), /* Windows 8+ */ "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
IDirectDraw2_Release(ddraw); }
hr = DirectDrawCreate((GUID *)DDCREATE_EMULATIONONLY, &ddraw1, NULL); - 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); - hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); - ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); + 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); + 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)); - 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 & ~(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); + 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);
- for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) - { - IDirectDrawSurface *surface; - DDSURFACEDESC desc = + for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) { - .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, - }; + 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); + 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); + 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); + 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(); }
- winetest_pop_context(); + IDirectDraw2_Release(ddraw); }
- IDirectDraw2_Release(ddraw); - DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index b7be97c32bc..6946ca71245 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -20,6 +20,7 @@
#define COBJMACROS
+#include <stdbool.h> #include <stdint.h> #include "wine/test.h" #include <limits.h> @@ -18096,6 +18097,7 @@ static void test_caps(void)
for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) { + bool supported = (hal_caps.dwZBufferBitDepths & depth_caps[i].flag); IDirectDrawSurface4 *surface; DDSURFACEDESC2 desc = { @@ -18115,8 +18117,7 @@ static void test_caps(void) /* 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); + ok(hr == S_OK || (!supported && hr == DDERR_INVALIDPIXELFORMAT), "Got hr %#lx.\n", hr);
if (hr == S_OK) { @@ -18124,7 +18125,7 @@ static void test_caps(void) 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)), + || (!supported && (desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER))), "Got caps %#lx.\n", desc.ddsCaps.dwCaps); IDirectDrawSurface4_Release(surface); } @@ -18158,76 +18159,80 @@ static void test_caps(void) ok(!(hal_caps.ddsCaps.dwCaps & caps_never), "Got unexpected caps %#lx.\n", hal_caps.ddsCaps.dwCaps); 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 & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)), + todo_wine ok(!(hel_caps.ddsCaps.dwCaps & ~(DDSCAPS_STANDARDVGAMODE | DDSCAPS_MODEX)) + || broken(hel_caps.ddsCaps.dwCaps == caps_hel), /* Windows 8+ */ "Got unexpected caps %#lx.\n", hel_caps.ddsCaps.dwCaps);
IDirectDraw4_Release(ddraw); }
hr = DirectDrawCreate((GUID *)DDCREATE_EMULATIONONLY, &ddraw1, NULL); - ok(hr == DD_OK, "Got unexpected hr %#lx.\n", hr); - 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); + ok(hr == DD_OK || (is_ddraw64 && hr == E_FAIL), "Got unexpected hr %#lx.\n", hr); + if (SUCCEEDED(hr)) + { + 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)); - hal_caps.dwSize = sizeof(hal_caps); - hel_caps.dwSize = sizeof(hel_caps); - hr = IDirectDraw4_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 = IDirectDraw4_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 & ~(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); + 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);
- for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) - { - IDirectDrawSurface4 *surface; - DDSURFACEDESC2 desc = + for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) { - .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, - }; + 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); + 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); + 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); + 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(); }
- winetest_pop_context(); + IDirectDraw4_Release(ddraw); }
- IDirectDraw4_Release(ddraw); - DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 42b47fef8e7..84da71aaf4c 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -18240,6 +18240,7 @@ static void test_caps(void)
for (unsigned int i = 0; i < ARRAY_SIZE(depth_caps); ++i) { + bool supported = (hal_caps.dwZBufferBitDepths & depth_caps[i].flag); IDirectDrawSurface7 *surface; DDSURFACEDESC2 desc = { @@ -18259,8 +18260,7 @@ static void test_caps(void) /* 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); + ok(hr == S_OK || (!supported && hr == DDERR_INVALIDPIXELFORMAT), "Got hr %#lx.\n", hr);
if (hr == S_OK) { @@ -18268,7 +18268,7 @@ static void test_caps(void) 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)), + || (!supported && desc.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_ZBUFFER)), "Got caps %#lx.\n", desc.ddsCaps.dwCaps); IDirectDrawSurface7_Release(surface); }
From: Elizabeth Figura zfigura@codeweavers.com
Test various things which some applications are sensitive to: device names, enumeration order, specific caps. Also show that HAL caps for non-HAL devices and HEL caps for HAL devices are nearly empty.
Most of these tests already pass on real Windows 98, but one modification was necessary to remove a positive test for HWTRANSFORMANDLIGHT from d3d1-4 devices, which real cards don't always expose. --- dlls/ddraw/tests/ddraw1.c | 195 ++++++++++++++++-------------- dlls/ddraw/tests/ddraw2.c | 193 +++++++++++++++++++----------- dlls/ddraw/tests/ddraw4.c | 243 ++++++++++++++++++++++---------------- dlls/ddraw/tests/ddraw7.c | 12 ++ 4 files changed, 384 insertions(+), 259 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index b864e58ab36..b8716a1b956 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15462,165 +15462,179 @@ static void test_filling_convention(void) DestroyWindow(window); }
+static unsigned int enum_devices_index; + static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_desc, char *device_name, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx) { + static const D3DLIGHTINGCAPS empty_lighting_caps = {.dwSize = sizeof(D3DLIGHTINGCAPS)}; + static const D3DPRIMCAPS empty_primitive_caps = {.dwSize = sizeof(D3DPRIMCAPS)}; + IDirectDraw *ddraw = ctx; + + todo_wine ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hal->dwSize); + todo_wine ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hel->dwSize); + ok(hal->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS) + || (ddraw_is_warp(ddraw) && !hal->dtcTransformCaps.dwSize), + "Got transform caps size %lu.\n", hal->dtcTransformCaps.dwSize); + ok(hel->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS), + "Got transform caps size %lu.\n", hel->dtcTransformCaps.dwSize); + ok(hal->dlcLightingCaps.dwSize == sizeof(D3DLIGHTINGCAPS) + || (ddraw_is_warp(ddraw) && !hal->dlcLightingCaps.dwSize), + "Got lighting caps size %lu.\n", hal->dlcLightingCaps.dwSize); + ok(hel->dlcLightingCaps.dwSize == sizeof(D3DLIGHTINGCAPS), + "Got lighting caps size %lu.\n", hel->dlcLightingCaps.dwSize); + ok(hal->dpcLineCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got line caps size %lu.\n", hal->dpcLineCaps.dwSize); + ok(hel->dpcLineCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got line caps size %lu.\n", hel->dpcLineCaps.dwSize); + ok(hal->dpcTriCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got triangle caps size %lu.\n", hal->dpcTriCaps.dwSize); + ok(hel->dpcTriCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got triangle caps size %lu.\n", hel->dpcTriCaps.dwSize); + + if (!IsEqualGUID(guid, &IID_IDirect3DHALDevice)) + { + ok(!hal->dwFlags, "Got HAL flags %#lx.\n", hal->dwFlags); + ok(!hal->dcmColorModel, "Got color model %#lx.\n", hal->dcmColorModel); + todo_wine ok(!hal->dwDevCaps, "Got device caps %#lx.\n", hal->dwDevCaps); + todo_wine ok(!hal->dtcTransformCaps.dwCaps, "Got transform caps %#lx.\n", hal->dtcTransformCaps.dwCaps); + todo_wine ok(!hal->bClipping, "Got clipping %#x.\n", hal->bClipping); + todo_wine ok(!memcmp(&hal->dlcLightingCaps, &empty_lighting_caps, sizeof(D3DLIGHTINGCAPS)), + "Lighting caps didn't match.\n"); + todo_wine ok(!memcmp(&hal->dpcLineCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Line caps didn't match.\n"); + todo_wine ok(!memcmp(&hal->dpcTriCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Triangle caps didn't match.\n"); + todo_wine ok(!hal->dwDeviceRenderBitDepth, "Got colour depth %#lx.\n", hal->dwDeviceRenderBitDepth); + todo_wine ok(!hal->dwDeviceZBufferBitDepth, "Got Z depth %#lx.\n", hal->dwDeviceZBufferBitDepth); + ok(!hal->dwMaxBufferSize, "Got max buffer size %lu.\n", hal->dwMaxBufferSize); + todo_wine ok(!hal->dwMaxVertexCount, "Got max vertex count %lu.\n", hal->dwMaxVertexCount); + } + if(IsEqualGUID(&IID_IDirect3DRGBDevice, guid)) { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "RGB Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "RGB Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + static const DWORD hel_flags = D3DDD_COLORMODEL + | D3DDD_DEVCAPS + | D3DDD_TRANSFORMCAPS + | D3DDD_LIGHTINGCAPS + | D3DDD_BCLIPPING + | D3DDD_TRICAPS + | D3DDD_DEVICERENDERBITDEPTH + | D3DDD_DEVICEZBUFFERBITDEPTH + | D3DDD_MAXBUFFERSIZE + | D3DDD_MAXVERTEXCOUNT; + + static const DWORD device_caps = D3DDEVCAPS_FLOATTLVERTEX + | D3DDEVCAPS_SORTINCREASINGZ + | D3DDEVCAPS_SORTEXACT + | D3DDEVCAPS_EXECUTESYSTEMMEMORY + | D3DDEVCAPS_TLVERTEXSYSTEMMEMORY + | D3DDEVCAPS_TEXTURESYSTEMMEMORY + | D3DDEVCAPS_DRAWPRIMTLVERTEX; + + todo_wine ok(enum_devices_index == 1, "Expected index %u.\n", enum_devices_index); + todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name)); + + todo_wine ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "Got color model %#lx.\n", hel->dcmColorModel); + todo_wine ok(hel->dwDevCaps == device_caps, "Got device caps %#lx.\n", hel->dwDevCaps); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "RGB Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n");
- ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "RGB Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "RGB Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n");
- ok(hal->dcmColorModel == 0, "RGB Device hal caps has colormodel %lu\n", hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_RGB, "RGB Device hel caps has colormodel %lu\n", hel->dcmColorModel); - - ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); - - ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_HWRASTERIZATION) == 0, - "RGB Device hal device caps has D3DDEVCAPS_HWRASTERIZATION set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWRASTERIZATION) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWRASTERIZATION set\n"); } else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) { + static const DWORD hel_flags = D3DDD_COLORMODEL + | D3DDD_DEVCAPS + | D3DDD_TRANSFORMCAPS + | D3DDD_LIGHTINGCAPS + | D3DDD_BCLIPPING; + + todo_wine ok(enum_devices_index == 2, "Expected index %u.\n", enum_devices_index); + ok(!strcmp(device_name, "Direct3D HAL"), "Got name %s.\n", debugstr_a(device_name)); + ok(hal->dcmColorModel == D3DCOLOR_RGB, "HAL Device hal caps has colormodel %lu\n", hel->dcmColorModel); - ok(hel->dcmColorModel == 0, "HAL Device hel caps has colormodel %lu\n", hel->dcmColorModel);
ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, - "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + + todo_wine ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); + ok(!hel->dcmColorModel, "Got color model %#lx.\n", hel->dcmColorModel); + todo_wine ok(hel->dwDevCaps == D3DDEVCAPS_FLOATTLVERTEX, "Got device caps %#lx.\n", hel->dwDevCaps); + ok(hel->dtcTransformCaps.dwCaps == D3DTRANSFORMCAPS_CLIP, + "Got transform caps %#lx.\n", hel->dtcTransformCaps.dwCaps); + ok(hel->bClipping == TRUE, "Got clipping %#x.\n", hel->bClipping); + ok(hel->dlcLightingCaps.dwCaps == (D3DLIGHTCAPS_POINT | D3DLIGHTCAPS_SPOT + | D3DLIGHTCAPS_DIRECTIONAL | D3DLIGHTCAPS_PARALLELPOINT), + "Got lighting caps %#lx.\n", hel->dlcLightingCaps.dwCaps); + ok(hel->dlcLightingCaps.dwLightingModel == D3DLIGHTINGMODEL_RGB, + "Got lighting model %#lx.\n", hel->dlcLightingCaps.dwLightingModel); + todo_wine ok(!hel->dlcLightingCaps.dwNumLights, + "Got light count %lu.\n", hel->dlcLightingCaps.dwNumLights); + todo_wine ok(!memcmp(&hel->dpcLineCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Line caps didn't match.\n"); + todo_wine ok(!memcmp(&hel->dpcTriCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Triangle caps didn't match.\n"); + todo_wine ok(!hel->dwDeviceRenderBitDepth, "Got colour depth %#lx.\n", hel->dwDeviceRenderBitDepth); + todo_wine ok(!hel->dwDeviceZBufferBitDepth, "Got Z depth %#lx.\n", hel->dwDeviceZBufferBitDepth); + ok(!hel->dwMaxBufferSize, "Got max buffer size %lu.\n", hel->dwMaxBufferSize); + ok(hel->dwMaxVertexCount == hal->dwMaxVertexCount, "Got HAL max vertex count %lu, HEL %lu.\n", + hal->dwMaxVertexCount, hel->dwMaxVertexCount); } else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "REF Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "REF Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "REF Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "REF Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n");
- ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "REF Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "REF Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n");
- ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "REF Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "REF Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "REF Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "REF Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "Ramp Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "Ramp Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(enum_devices_index == 0, "Expected index %u.\n", enum_devices_index); + ok(!strcmp(device_name, "Ramp Emulation"), "Got name %s.\n", debugstr_a(device_name)); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "Ramp Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n");
- ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "Ramp Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "Ramp Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n");
- ok(hal->dcmColorModel == 0, "Ramp Device hal caps has colormodel %lu\n", hal->dcmColorModel); ok(hel->dcmColorModel == D3DCOLOR_MONO, "Ramp Device hel caps has colormodel %lu\n", hel->dcmColorModel);
- ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "Ramp Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "Ramp Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "Ramp Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "Ramp Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } - else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) - { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "MMX Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "MMX Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "MMX Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "MMX Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); - - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "MMX Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "MMX Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); - - ok(hal->dcmColorModel == 0, "MMX Device hal caps has colormodel %lu\n", hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_RGB, "MMX Device hel caps has colormodel %lu\n", hel->dcmColorModel); - - ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags); - - ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "MMX Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "MMX Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "MMX Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "MMX Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - } else { ok(FALSE, "Unexpected device enumerated: "%s" "%s"\n", device_desc, device_name); @@ -15642,6 +15656,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d trace("hel tri does NOT have pow2 set\n"); }
+ ++enum_devices_index; return DDENUMRET_OK; }
@@ -15666,7 +15681,7 @@ static void test_enum_devices(void) hr = IDirect3D_EnumDevices(d3d, NULL, NULL); ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr);
- hr = IDirect3D_EnumDevices(d3d, test_enum_devices_caps_callback, NULL); + hr = IDirect3D_EnumDevices(d3d, test_enum_devices_caps_callback, ddraw); ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
IDirect3D_Release(d3d); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index aaa9fd1cbdd..f8dbc387475 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -16457,162 +16457,216 @@ static void test_filling_convention(void) DestroyWindow(window); }
+static unsigned int enum_devices_index; + static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_desc, char *device_name, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx) { + static const D3DLIGHTINGCAPS empty_lighting_caps = {.dwSize = sizeof(D3DLIGHTINGCAPS)}; + static const D3DPRIMCAPS empty_primitive_caps = {.dwSize = sizeof(D3DPRIMCAPS)}; + IDirectDraw2 *ddraw = ctx; + + todo_wine ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hal->dwSize); + todo_wine ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hel->dwSize); + ok(hal->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS) + || (ddraw_is_warp(ddraw) && !hal->dtcTransformCaps.dwSize), + "Got transform caps size %lu.\n", hal->dtcTransformCaps.dwSize); + ok(hel->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS), + "Got transform caps size %lu.\n", hel->dtcTransformCaps.dwSize); + ok(hal->dlcLightingCaps.dwSize == sizeof(D3DLIGHTINGCAPS) + || (ddraw_is_warp(ddraw) && !hal->dlcLightingCaps.dwSize), + "Got lighting caps size %lu.\n", hal->dlcLightingCaps.dwSize); + ok(hel->dlcLightingCaps.dwSize == sizeof(D3DLIGHTINGCAPS), + "Got lighting caps size %lu.\n", hel->dlcLightingCaps.dwSize); + ok(hal->dpcLineCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got line caps size %lu.\n", hal->dpcLineCaps.dwSize); + ok(hel->dpcLineCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got line caps size %lu.\n", hel->dpcLineCaps.dwSize); + ok(hal->dpcTriCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got triangle caps size %lu.\n", hal->dpcTriCaps.dwSize); + ok(hel->dpcTriCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got triangle caps size %lu.\n", hel->dpcTriCaps.dwSize); + + if (!IsEqualGUID(guid, &IID_IDirect3DHALDevice)) + { + ok(!hal->dwFlags, "Got HAL flags %#lx.\n", hal->dwFlags); + ok(!hal->dcmColorModel, "Got color model %#lx.\n", hal->dcmColorModel); + todo_wine ok(!hal->dwDevCaps, "Got device caps %#lx.\n", hal->dwDevCaps); + todo_wine ok(!hal->dtcTransformCaps.dwCaps, "Got transform caps %#lx.\n", hal->dtcTransformCaps.dwCaps); + todo_wine ok(!hal->bClipping, "Got clipping %#x.\n", hal->bClipping); + todo_wine ok(!memcmp(&hal->dlcLightingCaps, &empty_lighting_caps, sizeof(D3DLIGHTINGCAPS)), + "Lighting caps didn't match.\n"); + todo_wine ok(!memcmp(&hal->dpcLineCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Line caps didn't match.\n"); + todo_wine ok(!memcmp(&hal->dpcTriCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Triangle caps didn't match.\n"); + todo_wine ok(!hal->dwDeviceRenderBitDepth, "Got colour depth %#lx.\n", hal->dwDeviceRenderBitDepth); + todo_wine ok(!hal->dwDeviceZBufferBitDepth, "Got Z depth %#lx.\n", hal->dwDeviceZBufferBitDepth); + ok(!hal->dwMaxBufferSize, "Got max buffer size %lu.\n", hal->dwMaxBufferSize); + todo_wine ok(!hal->dwMaxVertexCount, "Got max vertex count %lu.\n", hal->dwMaxVertexCount); + todo_wine ok(!hal->dwMinTextureWidth, "Got min texture width %lu.\n", hal->dwMinTextureWidth); + todo_wine ok(!hal->dwMinTextureHeight, "Got min texture height %lu.\n", hal->dwMinTextureHeight); + todo_wine ok(!hal->dwMaxTextureWidth, "Got max texture width %lu.\n", hal->dwMaxTextureWidth); + todo_wine ok(!hal->dwMaxTextureHeight, "Got max texture height %lu.\n", hal->dwMaxTextureHeight); + todo_wine ok(!hal->dwMinStippleWidth, "Got min stipple width %lu.\n", hal->dwMinStippleWidth); + todo_wine ok(!hal->dwMinStippleHeight, "Got min stipple height %lu.\n", hal->dwMinStippleHeight); + todo_wine ok(!hal->dwMaxStippleWidth, "Got max stipple width %lu.\n", hal->dwMaxStippleWidth); + todo_wine ok(!hal->dwMaxStippleHeight, "Got max stipple height %lu.\n", hal->dwMaxStippleHeight); + } + if(IsEqualGUID(&IID_IDirect3DRGBDevice, guid)) { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "RGB Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "RGB Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + static const DWORD hel_flags = D3DDD_COLORMODEL + | D3DDD_DEVCAPS + | D3DDD_TRANSFORMCAPS + | D3DDD_LIGHTINGCAPS + | D3DDD_BCLIPPING + | D3DDD_TRICAPS + | D3DDD_DEVICERENDERBITDEPTH + | D3DDD_DEVICEZBUFFERBITDEPTH + | D3DDD_MAXBUFFERSIZE + | D3DDD_MAXVERTEXCOUNT; + + static const DWORD device_caps = D3DDEVCAPS_FLOATTLVERTEX + | D3DDEVCAPS_SORTINCREASINGZ + | D3DDEVCAPS_SORTEXACT + | D3DDEVCAPS_EXECUTESYSTEMMEMORY + | D3DDEVCAPS_TLVERTEXSYSTEMMEMORY + | D3DDEVCAPS_TEXTURESYSTEMMEMORY + | D3DDEVCAPS_DRAWPRIMTLVERTEX; + + todo_wine ok(enum_devices_index == 1, "Expected index %u.\n", enum_devices_index); + todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name)); + + todo_wine ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "Got color model %#lx.\n", hel->dcmColorModel); + todo_wine ok(hel->dwDevCaps == device_caps, "Got device caps %#lx.\n", hel->dwDevCaps); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "RGB Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n");
- ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "RGB Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "RGB Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n");
- ok(hal->dcmColorModel == 0, "RGB Device hal caps has colormodel %lu\n", hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_RGB, "RGB Device hel caps has colormodel %lu\n", hel->dcmColorModel); - - ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); - - ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_HWRASTERIZATION) == 0, - "RGB Device hal device caps has D3DDEVCAPS_HWRASTERIZATION set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWRASTERIZATION) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWRASTERIZATION set\n"); } else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) { + static const DWORD hel_flags = D3DDD_COLORMODEL + | D3DDD_DEVCAPS + | D3DDD_TRANSFORMCAPS + | D3DDD_LIGHTINGCAPS + | D3DDD_BCLIPPING; + + todo_wine ok(enum_devices_index == 2, "Expected index %u.\n", enum_devices_index); + ok(!strcmp(device_name, "Direct3D HAL"), "Got name %s.\n", debugstr_a(device_name)); + ok(hal->dcmColorModel == D3DCOLOR_RGB, "HAL Device hal caps has colormodel %lu\n", hel->dcmColorModel); - ok(hel->dcmColorModel == 0, "HAL Device hel caps has colormodel %lu\n", hel->dcmColorModel);
ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, - "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + + todo_wine ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); + ok(!hel->dcmColorModel, "Got color model %#lx.\n", hel->dcmColorModel); + todo_wine ok(hel->dwDevCaps == D3DDEVCAPS_FLOATTLVERTEX, "Got device caps %#lx.\n", hel->dwDevCaps); + ok(hel->dtcTransformCaps.dwCaps == D3DTRANSFORMCAPS_CLIP, + "Got transform caps %#lx.\n", hel->dtcTransformCaps.dwCaps); + ok(hel->bClipping == TRUE, "Got clipping %#x.\n", hel->bClipping); + ok(hel->dlcLightingCaps.dwCaps == (D3DLIGHTCAPS_POINT | D3DLIGHTCAPS_SPOT + | D3DLIGHTCAPS_DIRECTIONAL | D3DLIGHTCAPS_PARALLELPOINT), + "Got lighting caps %#lx.\n", hel->dlcLightingCaps.dwCaps); + ok(hel->dlcLightingCaps.dwLightingModel == D3DLIGHTINGMODEL_RGB, + "Got lighting model %#lx.\n", hel->dlcLightingCaps.dwLightingModel); + todo_wine ok(!hel->dlcLightingCaps.dwNumLights, + "Got light count %lu.\n", hel->dlcLightingCaps.dwNumLights); + todo_wine ok(!memcmp(&hel->dpcLineCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Line caps didn't match.\n"); + todo_wine ok(!memcmp(&hel->dpcTriCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Triangle caps didn't match.\n"); + todo_wine ok(!hel->dwDeviceRenderBitDepth, "Got colour depth %#lx.\n", hel->dwDeviceRenderBitDepth); + todo_wine ok(!hel->dwDeviceZBufferBitDepth, "Got Z depth %#lx.\n", hel->dwDeviceZBufferBitDepth); + ok(!hel->dwMaxBufferSize, "Got max buffer size %lu.\n", hel->dwMaxBufferSize); + ok(hel->dwMaxVertexCount == hal->dwMaxVertexCount, "Got HAL max vertex count %lu, HEL %lu.\n", + hal->dwMaxVertexCount, hel->dwMaxVertexCount); + todo_wine ok(!hel->dwMinTextureWidth, "Got min texture width %lu.\n", hel->dwMinTextureWidth); + todo_wine ok(!hel->dwMinTextureHeight, "Got min texture height %lu.\n", hel->dwMinTextureHeight); + todo_wine ok(!hel->dwMaxTextureWidth, "Got max texture width %lu.\n", hel->dwMaxTextureWidth); + todo_wine ok(!hel->dwMaxTextureHeight, "Got max texture height %lu.\n", hel->dwMaxTextureHeight); + todo_wine ok(!hel->dwMinStippleWidth, "Got min stipple width %lu.\n", hel->dwMinStippleWidth); + todo_wine ok(!hel->dwMinStippleHeight, "Got min stipple height %lu.\n", hel->dwMinStippleHeight); + todo_wine ok(!hel->dwMaxStippleWidth, "Got max stipple width %lu.\n", hel->dwMaxStippleWidth); + todo_wine ok(!hel->dwMaxStippleHeight, "Got max stipple height %lu.\n", hel->dwMaxStippleHeight); } else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "REF Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "REF Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "REF Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "REF Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n");
- ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "REF Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "REF Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "REF Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n");
- ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "REF Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "REF Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "REF Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "REF Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "Ramp Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "Ramp Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(enum_devices_index == 0, "Expected index %u.\n", enum_devices_index); + ok(!strcmp(device_name, "Ramp Emulation"), "Got name %s.\n", debugstr_a(device_name)); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "Ramp Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n");
- ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "Ramp Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "Ramp Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n");
- ok(hal->dcmColorModel == 0, "Ramp Device hal caps has colormodel %lu\n", hal->dcmColorModel); ok(hel->dcmColorModel == D3DCOLOR_MONO, "Ramp Device hel caps has colormodel %lu\n", hel->dcmColorModel);
- ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "Ramp Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "Ramp Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "Ramp Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "Ramp Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "MMX Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "MMX Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + ok(enum_devices_index == 3, "Expected index %u.\n", enum_devices_index); + ok(!strcmp(device_name, "MMX Emulation"), "Got name %s.\n", debugstr_a(device_name)); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "MMX Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "MMX Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n");
- ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "MMX Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "MMX Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n");
- ok(hal->dcmColorModel == 0, "MMX Device hal caps has colormodel %lu\n", hal->dcmColorModel); ok(hel->dcmColorModel == D3DCOLOR_RGB, "MMX Device hel caps has colormodel %lu\n", hel->dcmColorModel);
- ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "MMX Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "MMX Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "MMX Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "MMX Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } @@ -16637,6 +16691,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d trace("hel tri does NOT have pow2 set\n"); }
+ ++enum_devices_index; return DDENUMRET_OK; }
@@ -16661,7 +16716,7 @@ static void test_enum_devices(void) hr = IDirect3D2_EnumDevices(d3d, NULL, NULL); ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr);
- hr = IDirect3D2_EnumDevices(d3d, test_enum_devices_caps_callback, NULL); + hr = IDirect3D2_EnumDevices(d3d, test_enum_devices_caps_callback, ddraw); ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
IDirect3D2_Release(d3d); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 6946ca71245..a6ea3231725 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -19550,64 +19550,177 @@ static void test_filling_convention(void) DestroyWindow(window); }
+static unsigned int enum_devices_index; + static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_desc, char *device_name, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, void *ctx) { + static const D3DLIGHTINGCAPS empty_lighting_caps = {.dwSize = sizeof(D3DLIGHTINGCAPS)}; + static const D3DPRIMCAPS empty_primitive_caps = {.dwSize = sizeof(D3DPRIMCAPS)}; + IDirectDraw4 *ddraw = ctx; + + ok(hal->dwSize == sizeof(D3DDEVICEDESC), "Got size %lu.\n", hal->dwSize); + ok(hel->dwSize == sizeof(D3DDEVICEDESC), "Got size %lu.\n", hel->dwSize); + ok(hal->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS) + || (ddraw_is_warp(ddraw) && !hal->dtcTransformCaps.dwSize), + "Got transform caps size %lu.\n", hal->dtcTransformCaps.dwSize); + ok(hel->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS), + "Got transform caps size %lu.\n", hel->dtcTransformCaps.dwSize); + ok(hal->dlcLightingCaps.dwSize == sizeof(D3DLIGHTINGCAPS) + || (ddraw_is_warp(ddraw) && !hal->dlcLightingCaps.dwSize), + "Got lighting caps size %lu.\n", hal->dlcLightingCaps.dwSize); + ok(hel->dlcLightingCaps.dwSize == sizeof(D3DLIGHTINGCAPS), + "Got lighting caps size %lu.\n", hel->dlcLightingCaps.dwSize); + ok(hal->dpcLineCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got line caps size %lu.\n", hal->dpcLineCaps.dwSize); + ok(hel->dpcLineCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got line caps size %lu.\n", hel->dpcLineCaps.dwSize); + ok(hal->dpcTriCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got triangle caps size %lu.\n", hal->dpcTriCaps.dwSize); + ok(hel->dpcTriCaps.dwSize == sizeof(D3DPRIMCAPS), + "Got triangle caps size %lu.\n", hel->dpcTriCaps.dwSize); + + if (!IsEqualGUID(guid, &IID_IDirect3DHALDevice)) + { + ok(!hal->dwFlags, "Got HAL flags %#lx.\n", hal->dwFlags); + ok(!hal->dcmColorModel, "Got color model %#lx.\n", hal->dcmColorModel); + todo_wine ok(!hal->dwDevCaps, "Got device caps %#lx.\n", hal->dwDevCaps); + todo_wine ok(!hal->dtcTransformCaps.dwCaps, "Got transform caps %#lx.\n", hal->dtcTransformCaps.dwCaps); + todo_wine ok(!hal->bClipping, "Got clipping %#x.\n", hal->bClipping); + todo_wine ok(!memcmp(&hal->dlcLightingCaps, &empty_lighting_caps, sizeof(D3DLIGHTINGCAPS)), + "Lighting caps didn't match.\n"); + todo_wine ok(!memcmp(&hal->dpcLineCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Line caps didn't match.\n"); + todo_wine ok(!memcmp(&hal->dpcTriCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Triangle caps didn't match.\n"); + todo_wine ok(!hal->dwDeviceRenderBitDepth, "Got colour depth %#lx.\n", hal->dwDeviceRenderBitDepth); + todo_wine ok(!hal->dwDeviceZBufferBitDepth, "Got Z depth %#lx.\n", hal->dwDeviceZBufferBitDepth); + ok(!hal->dwMaxBufferSize, "Got max buffer size %lu.\n", hal->dwMaxBufferSize); + todo_wine ok(!hal->dwMaxVertexCount, "Got max vertex count %lu.\n", hal->dwMaxVertexCount); + todo_wine ok(!hal->dwMinTextureWidth, "Got min texture width %lu.\n", hal->dwMinTextureWidth); + todo_wine ok(!hal->dwMinTextureHeight, "Got min texture height %lu.\n", hal->dwMinTextureHeight); + todo_wine ok(!hal->dwMaxTextureWidth, "Got max texture width %lu.\n", hal->dwMaxTextureWidth); + todo_wine ok(!hal->dwMaxTextureHeight, "Got max texture height %lu.\n", hal->dwMaxTextureHeight); + todo_wine ok(!hal->dwMinStippleWidth, "Got min stipple width %lu.\n", hal->dwMinStippleWidth); + todo_wine ok(!hal->dwMinStippleHeight, "Got min stipple height %lu.\n", hal->dwMinStippleHeight); + todo_wine ok(!hal->dwMaxStippleWidth, "Got max stipple width %lu.\n", hal->dwMaxStippleWidth); + todo_wine ok(!hal->dwMaxStippleHeight, "Got max stipple height %lu.\n", hal->dwMaxStippleHeight); + todo_wine ok(!hal->dwMaxTextureRepeat, "Got max texture repeat %lu.\n", hal->dwMaxTextureRepeat); + todo_wine ok(!hal->dwMaxTextureAspectRatio, "Got max texture aspect ratio %lu.\n", hal->dwMaxTextureAspectRatio); + todo_wine ok(!hal->dwMaxAnisotropy, "Got max anisotropy %lu.\n", hal->dwMaxAnisotropy); + todo_wine ok(!hal->dvGuardBandLeft, "Got left guard band %.8e.\n", hal->dvGuardBandLeft); + todo_wine ok(!hal->dvGuardBandTop, "Got top guard band %.8e.\n", hal->dvGuardBandTop); + todo_wine ok(!hal->dvGuardBandRight, "Got right guard band %.8e.\n", hal->dvGuardBandRight); + todo_wine ok(!hal->dvGuardBandBottom, "Got bottom guard band %.8e.\n", hal->dvGuardBandBottom); + ok(!hal->dvExtentsAdjust, "Got extents adjust %.8e.\n", hal->dvExtentsAdjust); + todo_wine ok(!hal->dwStencilCaps, "Got stencil caps %#lx.\n", hal->dwStencilCaps); + todo_wine ok(!hal->dwFVFCaps, "Got FVF caps %#lx.\n", hal->dwFVFCaps); + todo_wine ok(!hal->dwTextureOpCaps, "Got texture op caps %#lx.\n", hal->dwTextureOpCaps); + todo_wine ok(!hal->wMaxTextureBlendStages, "Got max blend stages %u.\n", hal->wMaxTextureBlendStages); + todo_wine ok(!hal->wMaxSimultaneousTextures, "Got max simultaneous textures %u.\n", hal->wMaxSimultaneousTextures); + } + if(IsEqualGUID(&IID_IDirect3DRGBDevice, guid)) { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "RGB Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "RGB Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); + static const DWORD hel_flags = D3DDD_COLORMODEL + | D3DDD_DEVCAPS + | D3DDD_TRANSFORMCAPS + | D3DDD_LIGHTINGCAPS + | D3DDD_BCLIPPING + | D3DDD_LINECAPS + | D3DDD_TRICAPS + | D3DDD_DEVICERENDERBITDEPTH + | D3DDD_DEVICEZBUFFERBITDEPTH + | D3DDD_MAXBUFFERSIZE + | D3DDD_MAXVERTEXCOUNT; + + static const DWORD device_caps = D3DDEVCAPS_FLOATTLVERTEX + | D3DDEVCAPS_EXECUTESYSTEMMEMORY + | D3DDEVCAPS_TLVERTEXSYSTEMMEMORY + | D3DDEVCAPS_TEXTURESYSTEMMEMORY + | D3DDEVCAPS_DRAWPRIMTLVERTEX; + + ok(enum_devices_index == 0, "Expected index %u.\n", enum_devices_index); + todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name)); + + ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); + ok(hel->dcmColorModel == D3DCOLOR_RGB, "Got color model %#lx.\n", hel->dcmColorModel); + todo_wine ok(hel->dwDevCaps == device_caps, "Got device caps %#lx.\n", hel->dwDevCaps); + ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "RGB Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n");
- ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "RGB Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "RGB Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, "RGB Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n");
- ok(hal->dcmColorModel == 0, "RGB Device hal caps has colormodel %lu\n", hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_RGB, "RGB Device hel caps has colormodel %lu\n", hel->dcmColorModel); - - ok(hal->dwFlags == 0, "RGB Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "RGB Device hel caps has hardware flags %#lx\n", hel->dwFlags); - - ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "RGB Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "RGB Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_HWRASTERIZATION) == 0, - "RGB Device hal device caps has D3DDEVCAPS_HWRASTERIZATION set\n"); ok((hel->dwDevCaps & D3DDEVCAPS_HWRASTERIZATION) == 0, "RGB Device hel device caps has D3DDEVCAPS_HWRASTERIZATION set\n"); } else if(IsEqualGUID(&IID_IDirect3DHALDevice, guid)) { + static const DWORD hel_flags = D3DDD_COLORMODEL + | D3DDD_DEVCAPS + | D3DDD_TRANSFORMCAPS + | D3DDD_LIGHTINGCAPS + | D3DDD_BCLIPPING; + + ok(enum_devices_index == 1, "Expected index %u.\n", enum_devices_index); + ok(!strcmp(device_name, "Direct3D HAL"), "Got name %s.\n", debugstr_a(device_name)); + ok(hal->dcmColorModel == D3DCOLOR_RGB, "HAL Device hal caps has colormodel %lu\n", hel->dcmColorModel); - ok(hel->dcmColorModel == 0, "HAL Device hel caps has colormodel %lu\n", hel->dcmColorModel);
ok(hal->dwFlags != 0, "HAL Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "HAL Device hel caps has hardware flags %#lx\n", hel->dwFlags);
- ok(hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, - "HAL Device hal device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "RGB Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, "HAL Device hal device caps does not have D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "RGB Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); + + todo_wine ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); + ok(!hel->dcmColorModel, "Got color model %#lx.\n", hel->dcmColorModel); + todo_wine ok(hel->dwDevCaps == D3DDEVCAPS_FLOATTLVERTEX, "Got device caps %#lx.\n", hel->dwDevCaps); + ok(hel->dtcTransformCaps.dwCaps == D3DTRANSFORMCAPS_CLIP, + "Got transform caps %#lx.\n", hel->dtcTransformCaps.dwCaps); + ok(hel->bClipping == TRUE, "Got clipping %#x.\n", hel->bClipping); + ok(hel->dlcLightingCaps.dwCaps == (D3DLIGHTCAPS_POINT | D3DLIGHTCAPS_SPOT + | D3DLIGHTCAPS_DIRECTIONAL | D3DLIGHTCAPS_PARALLELPOINT), + "Got lighting caps %#lx.\n", hel->dlcLightingCaps.dwCaps); + ok(hel->dlcLightingCaps.dwLightingModel == D3DLIGHTINGMODEL_RGB, + "Got lighting model %#lx.\n", hel->dlcLightingCaps.dwLightingModel); + todo_wine ok(!hel->dlcLightingCaps.dwNumLights, + "Got light count %lu.\n", hel->dlcLightingCaps.dwNumLights); + todo_wine ok(!memcmp(&hel->dpcLineCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Line caps didn't match.\n"); + todo_wine ok(!memcmp(&hel->dpcTriCaps, &empty_primitive_caps, sizeof(D3DPRIMCAPS)), "Triangle caps didn't match.\n"); + todo_wine ok(!hel->dwDeviceRenderBitDepth, "Got colour depth %#lx.\n", hel->dwDeviceRenderBitDepth); + todo_wine ok(!hel->dwDeviceZBufferBitDepth, "Got Z depth %#lx.\n", hel->dwDeviceZBufferBitDepth); + ok(!hel->dwMaxBufferSize, "Got max buffer size %lu.\n", hel->dwMaxBufferSize); + ok(hel->dwMaxVertexCount == hal->dwMaxVertexCount, "Got HAL max vertex count %lu, HEL %lu.\n", + hal->dwMaxVertexCount, hel->dwMaxVertexCount); + todo_wine ok(!hel->dwMinTextureWidth, "Got min texture width %lu.\n", hel->dwMinTextureWidth); + todo_wine ok(!hel->dwMinTextureHeight, "Got min texture height %lu.\n", hel->dwMinTextureHeight); + todo_wine ok(!hel->dwMaxTextureWidth, "Got max texture width %lu.\n", hel->dwMaxTextureWidth); + todo_wine ok(!hel->dwMaxTextureHeight, "Got max texture height %lu.\n", hel->dwMaxTextureHeight); + todo_wine ok(!hel->dwMinStippleWidth, "Got min stipple width %lu.\n", hel->dwMinStippleWidth); + todo_wine ok(!hel->dwMinStippleHeight, "Got min stipple height %lu.\n", hel->dwMinStippleHeight); + todo_wine ok(!hel->dwMaxStippleWidth, "Got max stipple width %lu.\n", hel->dwMaxStippleWidth); + todo_wine ok(!hel->dwMaxStippleHeight, "Got max stipple height %lu.\n", hel->dwMaxStippleHeight); + todo_wine ok(!hel->dwMaxTextureRepeat, "Got max texture repeat %lu.\n", hel->dwMaxTextureRepeat); + todo_wine ok(!hel->dwMaxTextureAspectRatio, "Got max texture aspect ratio %lu.\n", hel->dwMaxTextureAspectRatio); + todo_wine ok(!hel->dwMaxAnisotropy, "Got max anisotropy %lu.\n", hel->dwMaxAnisotropy); + todo_wine ok(!hel->dvGuardBandLeft, "Got left guard band %.8e.\n", hel->dvGuardBandLeft); + todo_wine ok(!hel->dvGuardBandTop, "Got top guard band %.8e.\n", hel->dvGuardBandTop); + todo_wine ok(!hel->dvGuardBandRight, "Got right guard band %.8e.\n", hel->dvGuardBandRight); + todo_wine ok(!hel->dvGuardBandBottom, "Got bottom guard band %.8e.\n", hel->dvGuardBandBottom); + ok(!hel->dvExtentsAdjust, "Got extents adjust %.8e.\n", hel->dvExtentsAdjust); + todo_wine ok(!hel->dwStencilCaps, "Got stencil caps %#lx.\n", hel->dwStencilCaps); + todo_wine ok(!hel->dwFVFCaps, "Got FVF caps %#lx.\n", hel->dwFVFCaps); + todo_wine ok(!hel->dwTextureOpCaps, "Got texture op caps %#lx.\n", hel->dwTextureOpCaps); + todo_wine ok(!hel->wMaxTextureBlendStages, "Got max blend stages %u.\n", hel->wMaxTextureBlendStages); + todo_wine ok(!hel->wMaxSimultaneousTextures, "Got max simultaneous textures %u.\n", hel->wMaxSimultaneousTextures); } else if(IsEqualGUID(&IID_IDirect3DRefDevice, guid)) { @@ -19638,77 +19751,6 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "REF Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); } - else if(IsEqualGUID(&IID_IDirect3DRampDevice, guid)) - { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "Ramp Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "Ramp Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "Ramp Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); - - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "Ramp Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "Ramp Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "Ramp Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); - - ok(hal->dcmColorModel == 0, "Ramp Device hal caps has colormodel %lu\n", hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_MONO, "Ramp Device hel caps has colormodel %lu\n", - hel->dcmColorModel); - - ok(hal->dwFlags == 0, "Ramp Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "Ramp Device hel caps has hardware flags %#lx\n", hel->dwFlags); - - ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "Ramp Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "Ramp Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "Ramp Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "Ramp Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - } - else if(IsEqualGUID(&IID_IDirect3DMMXDevice, guid)) - { - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "MMX Device hal line caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0, - "MMX Device hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n"); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "MMX Device hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2, - "MMX Device hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n"); - - ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "MMX Device hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0, - "MMX Device hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); - ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE, - "MMX Device hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n"); - - ok(hal->dcmColorModel == 0, "MMX Device hal caps has colormodel %lu\n", hal->dcmColorModel); - ok(hel->dcmColorModel == D3DCOLOR_RGB, "MMX Device hel caps has colormodel %lu\n", hel->dcmColorModel); - - ok(hal->dwFlags == 0, "MMX Device hal caps has hardware flags %#lx\n", hal->dwFlags); - ok(hel->dwFlags != 0, "MMX Device hel caps has hardware flags %#lx\n", hel->dwFlags); - - ok((hal->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "MMX Device hal device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, - "MMX Device hel device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - ok((hal->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "MMX Device hal device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - ok((hel->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, - "MMX Device hel device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); - } else { ok(FALSE, "Unexpected device enumerated: "%s" "%s"\n", device_desc, device_name); @@ -19730,6 +19772,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d trace("hel tri does NOT have pow2 set\n"); }
+ ++enum_devices_index; return DDENUMRET_OK; }
@@ -19754,7 +19797,7 @@ static void test_enum_devices(void) hr = IDirect3D3_EnumDevices(d3d, NULL, NULL); ok(hr == DDERR_INVALIDPARAMS, "Got hr %#lx.\n", hr);
- hr = IDirect3D3_EnumDevices(d3d, test_enum_devices_caps_callback, NULL); + hr = IDirect3D3_EnumDevices(d3d, test_enum_devices_caps_callback, ddraw); ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
IDirect3D3_Release(d3d); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 84da71aaf4c..2306caba3cc 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -19891,11 +19891,16 @@ static void test_filling_convention(void) DestroyWindow(window); }
+static unsigned int enum_devices_index; + static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *device_name, D3DDEVICEDESC7 *device_desc7, void *ctx) { if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DTnLHalDevice)) { + todo_wine ok(enum_devices_index == 2, "Expected index %u.\n", enum_devices_index); + todo_wine ok(!strcmp(device_name, "Direct3D T&L HAL"), "Got name %s.\n", debugstr_a(device_name)); + ok(device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, "TnLHal Device device caps does not have D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, @@ -19903,6 +19908,9 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d } else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DHALDevice)) { + ok(enum_devices_index == 1, "Expected index %u.\n", enum_devices_index); + ok(!strcmp(device_name, "Direct3D HAL"), "Got name %s.\n", debugstr_a(device_name)); + ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "HAL Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, @@ -19910,6 +19918,9 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d } else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DRGBDevice)) { + todo_wine ok(enum_devices_index == 0, "Expected index %u.\n", enum_devices_index); + todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name)); + ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok((device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, @@ -19922,6 +19933,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d ok(FALSE, "Unexpected device enumerated: "%s" "%s"\n", device_desc, device_name); }
+ ++enum_devices_index; return DDENUMRET_OK; }
From: Elizabeth Figura zfigura@codeweavers.com
Based on a patch by Andrew D'Addesio.
The comment dates back to a872c781ea9908bd549b59629585e4fd23ef2211, but at that time it referred to the reference device. This was changed to the RGB device by d9fef10b71b9add27cfaeffa6d7e3ab42342bba7.
The reference device is not enumerated by default even on Windows 98, as the neighbouring comment explains. It would make sense if the affected games do not function with the reference device, but are fine with the RGB device. It's not clear whether this is the case, though. According to Andrew D'Addesio in bug 19153, Motoracer 2 does not break even if the reference device is enumerated (so possibly the bug has to do with some other part of the caps later changed). As for AvP, I was unable to locate a copy of the game to test. --- dlls/ddraw/ddraw.c | 74 ++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 42 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index e59f7c9a01f..179b677d6d6 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -3878,6 +3878,11 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA D3DDEVICEDESC7 device_desc7; HRESULT hr;
+ /* Tomb Raider 3 overwrites the reference device description buffer + * with its own custom string. Reserve some extra space in the array + * to avoid a buffer overrun. */ + static CHAR reference_description[64] = "RGB Direct3D emulation"; + /* Some games (Motoracer 2 demo) have the bad idea to modify the device * name string. Let's put the string in a sufficiently sized array in * writable memory. */ @@ -3898,56 +3903,41 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA } ddraw_d3dcaps1_from_7(&device_desc1, &device_desc7);
- /* Do I have to enumerate the reference id? Note from old d3d7: - * "It seems that enumerating the reference IID on Direct3D 1 games - * (AvP / Motoracer2) breaks them". So do not enumerate this iid in V1 - * - * There's a registry key HKLM\Software\Microsoft\Direct3D\Drivers, + /* There's a registry key HKLM\Software\Microsoft\Direct3D\Drivers, * EnumReference which enables / disables enumerating the reference * rasterizer. It's a DWORD, 0 means disabled, 2 means enabled. The * enablerefrast.reg and disablerefrast.reg files in the DirectX 7.0 sdk * demo directory suggest this. * - * Some games(GTA 2) seem to use the second enumerated device, so I have - * to enumerate at least 2 devices. So enumerate the reference device to - * have 2 devices. - * - * Other games (Rollcage) tell emulation and hal device apart by certain - * flags. Rollcage expects D3DPTEXTURECAPS_POW2 to be set (yeah, it is a + * Rollcage tells apart the emulation and HAL device by certain flags. + * It expects D3DPTEXTURECAPS_POW2 to be set (yeah, it is a * limitation flag), and it refuses all devices that have the perspective * flag set. This way it refuses the emulation device, and HAL devices * never have POW2 unset in d3d7 on windows. */ - if (ddraw->d3dversion != 1) - { - /* Tomb Raider 3 overwrites the reference device description buffer - * with its own custom string. Reserve some extra space in the array - * to avoid a buffer overrun. */ - static CHAR reference_description[64] = "RGB Direct3D emulation"; - - TRACE("Enumerating WineD3D D3DDevice interface.\n"); - hal_desc = device_desc1; - hel_desc = device_desc1; - /* The rgb device has the pow2 flag set in the hel caps, but not in the hal caps. */ - hal_desc.dpcLineCaps.dwTextureCaps &= ~(D3DPTEXTURECAPS_POW2 - | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PERSPECTIVE); - hal_desc.dpcTriCaps.dwTextureCaps &= ~(D3DPTEXTURECAPS_POW2 - | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PERSPECTIVE); - /* RGB, RAMP and MMX devices have a HAL dcmColorModel of 0 */ - hal_desc.dcmColorModel = 0; - /* RGB, RAMP and MMX devices cannot report HAL hardware flags */ - hal_desc.dwFlags = 0; - /* RGB, REF, RAMP and MMX devices don't report hardware transform and lighting capability */ - hal_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION); - hel_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION); - - hr = callback((GUID *)&IID_IDirect3DRGBDevice, reference_description, - device_name, &hal_desc, &hel_desc, context); - if (hr != D3DENUMRET_OK) - { - TRACE("Application cancelled the enumeration.\n"); - wined3d_mutex_unlock(); - return D3D_OK; - } + + TRACE("Enumerating RGB Direct3D device.\n"); + hal_desc = device_desc1; + hel_desc = device_desc1; + /* The rgb device has the pow2 flag set in the hel caps, but not in the hal caps. */ + hal_desc.dpcLineCaps.dwTextureCaps &= ~(D3DPTEXTURECAPS_POW2 + | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PERSPECTIVE); + hal_desc.dpcTriCaps.dwTextureCaps &= ~(D3DPTEXTURECAPS_POW2 + | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PERSPECTIVE); + /* RGB, RAMP and MMX devices have a HAL dcmColorModel of 0 */ + hal_desc.dcmColorModel = 0; + /* RGB, RAMP and MMX devices cannot report HAL hardware flags */ + hal_desc.dwFlags = 0; + /* RGB, REF, RAMP and MMX devices don't report hardware transform and lighting capability */ + hal_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION); + hel_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION); + + hr = callback((GUID *)&IID_IDirect3DRGBDevice, reference_description, + device_name, &hal_desc, &hel_desc, context); + if (hr != D3DENUMRET_OK) + { + TRACE("Application cancelled the enumeration.\n"); + wined3d_mutex_unlock(); + return D3D_OK; }
strcpy(device_name,"Direct3D HAL");
From: Elizabeth Figura zfigura@codeweavers.com
Based on a patch by Andrew D'Addesio. --- dlls/ddraw/ddraw.c | 21 ++++++++------------- dlls/ddraw/tests/ddraw7.c | 4 ++-- 2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 179b677d6d6..e1ef853f19f 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -52,28 +52,23 @@ static struct enum_device_entry DWORD unsupported_caps; } device_list7[] = { - /* T&L HAL device */ { - "WINE Direct3D7 Hardware Transform and Lighting acceleration using WineD3D", - "Wine D3D7 T&L HAL", - &IID_IDirect3DTnLHalDevice, - 0, + "WINE Direct3D7 RGB Software Emulation using WineD3D", + "Wine D3D7 RGB", + &IID_IDirect3DRGBDevice, + D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION, }, - - /* HAL device */ { "WINE Direct3D7 Hardware acceleration using WineD3D", "Direct3D HAL", &IID_IDirect3DHALDevice, D3DDEVCAPS_HWTRANSFORMANDLIGHT, }, - - /* RGB device */ { - "WINE Direct3D7 RGB Software Emulation using WineD3D", - "Wine D3D7 RGB", - &IID_IDirect3DRGBDevice, - D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION, + "WINE Direct3D7 Hardware Transform and Lighting acceleration using WineD3D", + "Wine D3D7 T&L HAL", + &IID_IDirect3DTnLHalDevice, + 0, }, };
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 2306caba3cc..1c84ce9333a 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -19898,7 +19898,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d { if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DTnLHalDevice)) { - todo_wine ok(enum_devices_index == 2, "Expected index %u.\n", enum_devices_index); + ok(enum_devices_index == 2, "Expected index %u.\n", enum_devices_index); todo_wine ok(!strcmp(device_name, "Direct3D T&L HAL"), "Got name %s.\n", debugstr_a(device_name));
ok(device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT, @@ -19918,7 +19918,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d } else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DRGBDevice)) { - todo_wine ok(enum_devices_index == 0, "Expected index %u.\n", enum_devices_index); + ok(enum_devices_index == 0, "Expected index %u.\n", enum_devices_index); todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name));
ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0,
From: Elizabeth Figura zfigura@codeweavers.com
Based on a patch by Andrew D'Addesio.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=19153 --- dlls/ddraw/ddraw.c | 4 ++-- 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, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index e1ef853f19f..5d0a582c8e3 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -54,7 +54,7 @@ static struct enum_device_entry { { "WINE Direct3D7 RGB Software Emulation using WineD3D", - "Wine D3D7 RGB", + "RGB Emulation", &IID_IDirect3DRGBDevice, D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION, }, @@ -3882,7 +3882,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA * name string. Let's put the string in a sufficiently sized array in * writable memory. */ char device_name[50]; - strcpy(device_name,"Direct3D HEL"); + strcpy(device_name, "RGB Emulation");
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index b8716a1b956..a4a7ad2c423 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15531,7 +15531,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d | D3DDEVCAPS_DRAWPRIMTLVERTEX;
todo_wine ok(enum_devices_index == 1, "Expected index %u.\n", enum_devices_index); - todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name)); + ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name));
todo_wine ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); ok(hel->dcmColorModel == D3DCOLOR_RGB, "Got color model %#lx.\n", hel->dcmColorModel); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index f8dbc387475..045314b78ac 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -16534,7 +16534,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d | D3DDEVCAPS_DRAWPRIMTLVERTEX;
todo_wine ok(enum_devices_index == 1, "Expected index %u.\n", enum_devices_index); - todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name)); + ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name));
todo_wine ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); ok(hel->dcmColorModel == D3DCOLOR_RGB, "Got color model %#lx.\n", hel->dcmColorModel); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index a6ea3231725..663dbeeb20c 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -19639,7 +19639,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d | D3DDEVCAPS_DRAWPRIMTLVERTEX;
ok(enum_devices_index == 0, "Expected index %u.\n", enum_devices_index); - todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name)); + ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name));
ok(hel->dwFlags == hel_flags, "Got HEL flags %#lx.\n", hel->dwFlags); ok(hel->dcmColorModel == D3DCOLOR_RGB, "Got color model %#lx.\n", hel->dcmColorModel); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 1c84ce9333a..387db042766 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -19919,7 +19919,7 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DRGBDevice)) { ok(enum_devices_index == 0, "Expected index %u.\n", enum_devices_index); - todo_wine ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name)); + ok(!strcmp(device_name, "RGB Emulation"), "Got name %s.\n", debugstr_a(device_name));
ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n");
From: Elizabeth Figura zfigura@codeweavers.com
Based on a patch by Andrew D'Addesio. --- dlls/ddraw/ddraw.c | 37 +++++++++++++------------------------ dlls/ddraw/tests/ddraw1.c | 4 ++-- dlls/ddraw/tests/ddraw2.c | 4 ++-- 3 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 5d0a582c8e3..3e66b134a75 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -3847,28 +3847,9 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA return D3D_OK; }
-/***************************************************************************** - * IDirect3D3::EnumDevices - * - * Enumerates all supported Direct3DDevice interfaces. This is the - * implementation for Direct3D 1 to Direc3D 3, Version 7 has its own. - * - * Versions 1, 2 and 3 - * - * Params: - * callback: Application-provided routine to call for each enumerated device - * Context: Pointer to pass to the callback - * - * Returns: - * D3D_OK on success, - * The result of IDirect3DImpl_GetCaps if it failed - * - *****************************************************************************/ -static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) +static HRESULT enum_devices_d3d3(struct ddraw *ddraw, LPD3DENUMDEVICESCALLBACK callback, void *context, DWORD desc_size) { static CHAR wined3d_description[] = "Wine D3DDevice using WineD3D and OpenGL"; - - struct ddraw *ddraw = impl_from_IDirect3D3(iface); D3DDEVICEDESC device_desc1, hal_desc, hel_desc; D3DDEVICEDESC7 device_desc7; HRESULT hr; @@ -3884,8 +3865,6 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA char device_name[50]; strcpy(device_name, "RGB Emulation");
- TRACE("iface %p, callback %p, context %p.\n", iface, callback, context); - if (!callback) return DDERR_INVALIDPARAMS;
@@ -3897,6 +3876,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA return hr; } ddraw_d3dcaps1_from_7(&device_desc1, &device_desc7); + device_desc1.dwSize = desc_size;
/* There's a registry key HKLM\Software\Microsoft\Direct3D\Drivers, * EnumReference which enables / disables enumerating the reference @@ -3967,13 +3947,22 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA return D3D_OK; }
+static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) +{ + struct ddraw *ddraw = impl_from_IDirect3D3(iface); + + TRACE("iface %p, callback %p, context %p.\n", iface, callback, context); + + return enum_devices_d3d3(ddraw, callback, context, sizeof(D3DDEVICEDESC)); +} + static HRESULT WINAPI d3d2_EnumDevices(IDirect3D2 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) { struct ddraw *ddraw = impl_from_IDirect3D2(iface);
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
- return d3d3_EnumDevices(&ddraw->IDirect3D3_iface, callback, context); + return enum_devices_d3d3(ddraw, callback, context, offsetof(D3DDEVICEDESC, dwMaxTextureRepeat)); }
static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) @@ -3982,7 +3971,7 @@ static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBAC
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
- return d3d3_EnumDevices(&ddraw->IDirect3D3_iface, callback, context); + return enum_devices_d3d3(ddraw, callback, context, offsetof(D3DDEVICEDESC, dwMinTextureWidth)); }
/***************************************************************************** diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index a4a7ad2c423..ce83144a0d5 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15471,8 +15471,8 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d static const D3DPRIMCAPS empty_primitive_caps = {.dwSize = sizeof(D3DPRIMCAPS)}; IDirectDraw *ddraw = ctx;
- todo_wine ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hal->dwSize); - todo_wine ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hel->dwSize); + ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hal->dwSize); + ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hel->dwSize); ok(hal->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS) || (ddraw_is_warp(ddraw) && !hal->dtcTransformCaps.dwSize), "Got transform caps size %lu.\n", hal->dtcTransformCaps.dwSize); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 045314b78ac..40dcbd2bd0b 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -16466,8 +16466,8 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d static const D3DPRIMCAPS empty_primitive_caps = {.dwSize = sizeof(D3DPRIMCAPS)}; IDirectDraw2 *ddraw = ctx;
- todo_wine ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hal->dwSize); - todo_wine ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hel->dwSize); + ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hal->dwSize); + ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hel->dwSize); ok(hal->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS) || (ddraw_is_warp(ddraw) && !hal->dtcTransformCaps.dwSize), "Got transform caps size %lu.\n", hal->dtcTransformCaps.dwSize);