From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ddraw/tests/ddraw1.c | 52 +++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 52 +++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 52 +++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 42 +++++++++++++++++++++++++++++++ 4 files changed, 198 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 167ef8a3dc4..060e65a0faa 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -1413,6 +1413,16 @@ static void init_format_b5g6r5(DDPIXELFORMAT *format) format->dwBBitMask = 0x001f; }
+static void init_format_b8g8r8x8(DDPIXELFORMAT *format) +{ + format->dwSize = sizeof(*format); + format->dwFlags = DDPF_RGB; + format->dwRGBBitCount = 32; + format->dwRBitMask = 0x00ff0000; + format->dwGBitMask = 0x0000ff00; + format->dwBBitMask = 0x000000ff; +} + static ULONG get_refcount(IUnknown *test_iface) { IUnknown_AddRef(test_iface); @@ -15703,6 +15713,47 @@ static void test_multiple_devices(void) DestroyWindow(window); }
+/* The Egyptian Prophecy: The Fate of Ramses does this. */ +static void test_sysmem_x_channel(void) +{ + DDSURFACEDESC surface_desc = {sizeof(surface_desc)}; + DDBLTFX fx = {.dwSize = sizeof(fx)}; + unsigned int colour, refcount; + IDirectDrawSurface *surface; + IDirectDraw *ddraw; + HWND window; + HRESULT hr; + + window = create_window(); + ddraw = create_ddraw(); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + surface_desc.dwWidth = 32; + surface_desc.dwHeight = 32; + init_format_b8g8r8x8(&surface_desc.ddpfPixelFormat); + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + fx.dwFillColor = 0x0000ff00; + hr = IDirectDrawSurface_Blt(surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirectDrawSurface_Lock(surface, NULL, &surface_desc, DDLOCK_READONLY, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + colour = *(unsigned int *)surface_desc.lpSurface; + todo_wine ok(colour == 0x0000ff00, "Got colour %08x.\n", colour); + hr = IDirectDrawSurface_Unlock(surface, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + IDirectDrawSurface_Release(surface); + refcount = IDirectDraw_Release(ddraw); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw1) { DDDEVICEIDENTIFIER identifier; @@ -15824,4 +15875,5 @@ START_TEST(ddraw1) test_enum_devices(); test_pinned_sysmem(); test_multiple_devices(); + test_sysmem_x_channel(); } diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index de4778e8d24..c0d4f98daeb 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -1596,6 +1596,16 @@ static BOOL compare_mode_rect(const DEVMODEW *mode1, const DEVMODEW *mode2) && mode1->dmPelsHeight == mode2->dmPelsHeight; }
+static void init_format_b8g8r8x8(DDPIXELFORMAT *format) +{ + format->dwSize = sizeof(*format); + format->dwFlags = DDPF_RGB; + format->dwRGBBitCount = 32; + format->dwRBitMask = 0x00ff0000; + format->dwGBitMask = 0x0000ff00; + format->dwBBitMask = 0x000000ff; +} + static ULONG get_refcount(IUnknown *test_iface) { IUnknown_AddRef(test_iface); @@ -16763,6 +16773,47 @@ static void test_d3d_state_reset(void) DestroyWindow(window); }
+/* The Egyptian Prophecy: The Fate of Ramses does this. */ +static void test_sysmem_x_channel(void) +{ + DDSURFACEDESC surface_desc = {sizeof(surface_desc)}; + DDBLTFX fx = {.dwSize = sizeof(fx)}; + unsigned int colour, refcount; + IDirectDrawSurface *surface; + IDirectDraw2 *ddraw; + HWND window; + HRESULT hr; + + window = create_window(); + ddraw = create_ddraw(); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + surface_desc.dwWidth = 32; + surface_desc.dwHeight = 32; + init_format_b8g8r8x8(&surface_desc.ddpfPixelFormat); + hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + fx.dwFillColor = 0x0000ff00; + hr = IDirectDrawSurface_Blt(surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirectDrawSurface_Lock(surface, NULL, &surface_desc, DDLOCK_READONLY, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + colour = *(unsigned int *)surface_desc.lpSurface; + todo_wine ok(colour == 0x0000ff00, "Got colour %08x.\n", colour); + hr = IDirectDrawSurface_Unlock(surface, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + IDirectDrawSurface_Release(surface); + refcount = IDirectDraw2_Release(ddraw); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw2) { DDDEVICEIDENTIFIER identifier; @@ -16890,4 +16941,5 @@ START_TEST(ddraw2) test_enum_devices(); test_multiple_devices(); test_d3d_state_reset(); + test_sysmem_x_channel(); } diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 96bdbf37183..a8c4f3ab621 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -1767,6 +1767,16 @@ static BOOL compare_mode_rect(const DEVMODEW *mode1, const DEVMODEW *mode2) && mode1->dmPelsHeight == mode2->dmPelsHeight; }
+static void init_format_b8g8r8x8(DDPIXELFORMAT *format) +{ + format->dwSize = sizeof(*format); + format->dwFlags = DDPF_RGB; + format->dwRGBBitCount = 32; + format->dwRBitMask = 0x00ff0000; + format->dwGBitMask = 0x0000ff00; + format->dwBBitMask = 0x000000ff; +} + static ULONG get_refcount(IUnknown *test_iface) { IUnknown_AddRef(test_iface); @@ -19838,6 +19848,47 @@ static void test_d3d_state_reset(void) DestroyWindow(window); }
+/* The Egyptian Prophecy: The Fate of Ramses does this. */ +static void test_sysmem_x_channel(void) +{ + DDSURFACEDESC2 surface_desc = {sizeof(surface_desc)}; + DDBLTFX fx = {.dwSize = sizeof(fx)}; + unsigned int colour, refcount; + IDirectDrawSurface4 *surface; + IDirectDraw4 *ddraw; + HWND window; + HRESULT hr; + + window = create_window(); + ddraw = create_ddraw(); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + surface_desc.dwWidth = 32; + surface_desc.dwHeight = 32; + init_format_b8g8r8x8(&surface_desc.ddpfPixelFormat); + hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + fx.dwFillColor = 0x0000ff00; + hr = IDirectDrawSurface4_Blt(surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirectDrawSurface4_Lock(surface, NULL, &surface_desc, DDLOCK_READONLY, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + colour = *(unsigned int *)surface_desc.lpSurface; + todo_wine ok(colour == 0x0000ff00, "Got colour %08x.\n", colour); + hr = IDirectDrawSurface4_Unlock(surface, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + IDirectDrawSurface4_Release(surface); + refcount = IDirectDraw4_Release(ddraw); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw4) { DDDEVICEIDENTIFIER identifier; @@ -19982,4 +20033,5 @@ START_TEST(ddraw4) test_multiple_devices(); test_vb_desc(); test_d3d_state_reset(); + test_sysmem_x_channel(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 343ca652214..9c7be81636f 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -20284,6 +20284,47 @@ static void test_d3d_state_reset(void) DestroyWindow(window); }
+/* The Egyptian Prophecy: The Fate of Ramses does this. */ +static void test_sysmem_x_channel(void) +{ + DDSURFACEDESC2 surface_desc = {sizeof(surface_desc)}; + DDBLTFX fx = {.dwSize = sizeof(fx)}; + unsigned int colour, refcount; + IDirectDrawSurface7 *surface; + IDirectDraw7 *ddraw; + HWND window; + HRESULT hr; + + window = create_window(); + ddraw = create_ddraw(); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + surface_desc.dwWidth = 32; + surface_desc.dwHeight = 32; + init_format_b8g8r8x8(&surface_desc.ddpfPixelFormat); + hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + fx.dwFillColor = 0x0000ff00; + hr = IDirectDrawSurface7_Blt(surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirectDrawSurface7_Lock(surface, NULL, &surface_desc, DDLOCK_READONLY, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + colour = *(unsigned int *)surface_desc.lpSurface; + todo_wine ok(colour == 0x0000ff00, "Got colour %08x.\n", colour); + hr = IDirectDrawSurface7_Unlock(surface, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + IDirectDrawSurface7_Release(surface); + refcount = IDirectDraw7_Release(ddraw); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw7) { DDDEVICEIDENTIFIER2 identifier; @@ -20462,4 +20503,5 @@ START_TEST(ddraw7) test_multiple_devices(); test_vb_desc(); test_d3d_state_reset(); + test_sysmem_x_channel(); }