Commit 6ffa32b8 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw/tests: P8 color keying does not work on WARP.

parent 48856290
...@@ -5293,6 +5293,23 @@ static void test_palette_complex(void) ...@@ -5293,6 +5293,23 @@ static void test_palette_complex(void)
DestroyWindow(window); DestroyWindow(window);
} }
static BOOL ddraw_is_warp(IDirectDraw *ddraw)
{
IDirectDraw4 *ddraw4;
DDDEVICEIDENTIFIER identifier;
HRESULT hr;
if (!strcmp(winetest_platform, "wine"))
return FALSE;
hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4);
ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr);
hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0);
ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
IDirectDraw4_Release(ddraw4);
return !!strstr(identifier.szDriver, "warp");
}
static void test_p8_blit(void) static void test_p8_blit(void)
{ {
IDirectDrawSurface *src, *dst, *dst_p8; IDirectDrawSurface *src, *dst, *dst_p8;
...@@ -5305,6 +5322,7 @@ static void test_p8_blit(void) ...@@ -5305,6 +5322,7 @@ static void test_p8_blit(void)
PALETTEENTRY palette_entries[256]; PALETTEENTRY palette_entries[256];
unsigned int x; unsigned int x;
DDBLTFX fx; DDBLTFX fx;
BOOL is_warp;
static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80};
static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80}; static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80};
static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80};
...@@ -5321,6 +5339,7 @@ static void test_p8_blit(void) ...@@ -5321,6 +5339,7 @@ static void test_p8_blit(void)
ok(!!ddraw, "Failed to create a ddraw object.\n"); ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
is_warp = ddraw_is_warp(ddraw);
memset(palette_entries, 0, sizeof(palette_entries)); memset(palette_entries, 0, sizeof(palette_entries));
palette_entries[1].peGreen = 0xff; palette_entries[1].peGreen = 0xff;
...@@ -5412,7 +5431,14 @@ static void test_p8_blit(void) ...@@ -5412,7 +5431,14 @@ static void test_p8_blit(void)
hr = IDirectDrawSurface_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL); hr = IDirectDrawSurface_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL);
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8)), /* A color keyed P8 blit doesn't do anything on WARP - it just leaves the data in the destination
* surface untouched. P8 blits without color keys work. Error checking (DDBLT_KEYSRC without a key
* for example) also works as expected.
*
* Using DDBLT_KEYSRC instead of DDBLT_KEYSRCOVERRIDE doesn't change this. Doing this blit with
* the display mode set to P8 doesn't help either. */
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8))
|| broken(is_warp && !memcmp(surface_desc.lpSurface, src_data2, sizeof(src_data2))),
"Got unexpected P8 color key blit result.\n"); "Got unexpected P8 color key blit result.\n");
hr = IDirectDrawSurface_Unlock(dst_p8, NULL); hr = IDirectDrawSurface_Unlock(dst_p8, NULL);
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
......
...@@ -6350,6 +6350,23 @@ static void test_palette_complex(void) ...@@ -6350,6 +6350,23 @@ static void test_palette_complex(void)
DestroyWindow(window); DestroyWindow(window);
} }
static BOOL ddraw_is_warp(IDirectDraw2 *ddraw)
{
IDirectDraw4 *ddraw4;
DDDEVICEIDENTIFIER identifier;
HRESULT hr;
if (!strcmp(winetest_platform, "wine"))
return FALSE;
hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirectDraw4, (void **)&ddraw4);
ok(SUCCEEDED(hr), "Failed to get IDirectDraw4 interface, hr %#x.\n", hr);
hr = IDirectDraw4_GetDeviceIdentifier(ddraw4, &identifier, 0);
ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
IDirectDraw4_Release(ddraw4);
return !!strstr(identifier.szDriver, "warp");
}
static void test_p8_blit(void) static void test_p8_blit(void)
{ {
IDirectDrawSurface *src, *dst, *dst_p8; IDirectDrawSurface *src, *dst, *dst_p8;
...@@ -6362,6 +6379,7 @@ static void test_p8_blit(void) ...@@ -6362,6 +6379,7 @@ static void test_p8_blit(void)
PALETTEENTRY palette_entries[256]; PALETTEENTRY palette_entries[256];
unsigned int x; unsigned int x;
DDBLTFX fx; DDBLTFX fx;
BOOL is_warp;
static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80};
static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80}; static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80};
static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80};
...@@ -6378,6 +6396,7 @@ static void test_p8_blit(void) ...@@ -6378,6 +6396,7 @@ static void test_p8_blit(void)
ok(!!ddraw, "Failed to create a ddraw object.\n"); ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
is_warp = ddraw_is_warp(ddraw);
memset(palette_entries, 0, sizeof(palette_entries)); memset(palette_entries, 0, sizeof(palette_entries));
palette_entries[1].peGreen = 0xff; palette_entries[1].peGreen = 0xff;
...@@ -6469,7 +6488,14 @@ static void test_p8_blit(void) ...@@ -6469,7 +6488,14 @@ static void test_p8_blit(void)
hr = IDirectDrawSurface_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL); hr = IDirectDrawSurface_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL);
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8)), /* A color keyed P8 blit doesn't do anything on WARP - it just leaves the data in the destination
* surface untouched. P8 blits without color keys work. Error checking (DDBLT_KEYSRC without a key
* for example) also works as expected.
*
* Using DDBLT_KEYSRC instead of DDBLT_KEYSRCOVERRIDE doesn't change this. Doing this blit with
* the display mode set to P8 doesn't help either. */
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8))
|| broken(is_warp && !memcmp(surface_desc.lpSurface, src_data2, sizeof(src_data2))),
"Got unexpected P8 color key blit result.\n"); "Got unexpected P8 color key blit result.\n");
hr = IDirectDrawSurface_Unlock(dst_p8, NULL); hr = IDirectDrawSurface_Unlock(dst_p8, NULL);
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
......
...@@ -7877,6 +7877,19 @@ static void test_palette_complex(void) ...@@ -7877,6 +7877,19 @@ static void test_palette_complex(void)
DestroyWindow(window); DestroyWindow(window);
} }
static BOOL ddraw_is_warp(IDirectDraw4 *ddraw)
{
DDDEVICEIDENTIFIER identifier;
HRESULT hr;
if (!strcmp(winetest_platform, "wine"))
return FALSE;
hr = IDirectDraw4_GetDeviceIdentifier(ddraw, &identifier, 0);
ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
return !!strstr(identifier.szDriver, "warp");
}
static void test_p8_blit(void) static void test_p8_blit(void)
{ {
IDirectDrawSurface4 *src, *dst, *dst_p8; IDirectDrawSurface4 *src, *dst, *dst_p8;
...@@ -7889,6 +7902,7 @@ static void test_p8_blit(void) ...@@ -7889,6 +7902,7 @@ static void test_p8_blit(void)
PALETTEENTRY palette_entries[256]; PALETTEENTRY palette_entries[256];
unsigned int x; unsigned int x;
DDBLTFX fx; DDBLTFX fx;
BOOL is_warp;
static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80};
static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80}; static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80};
static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80};
...@@ -7905,6 +7919,7 @@ static void test_p8_blit(void) ...@@ -7905,6 +7919,7 @@ static void test_p8_blit(void)
ok(!!ddraw, "Failed to create a ddraw object.\n"); ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
is_warp = ddraw_is_warp(ddraw);
memset(palette_entries, 0, sizeof(palette_entries)); memset(palette_entries, 0, sizeof(palette_entries));
palette_entries[1].peGreen = 0xff; palette_entries[1].peGreen = 0xff;
...@@ -7996,7 +8011,14 @@ static void test_p8_blit(void) ...@@ -7996,7 +8011,14 @@ static void test_p8_blit(void)
hr = IDirectDrawSurface4_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL); hr = IDirectDrawSurface4_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL);
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8)), /* A color keyed P8 blit doesn't do anything on WARP - it just leaves the data in the destination
* surface untouched. P8 blits without color keys work. Error checking (DDBLT_KEYSRC without a key
* for example) also works as expected.
*
* Using DDBLT_KEYSRC instead of DDBLT_KEYSRCOVERRIDE doesn't change this. Doing this blit with
* the display mode set to P8 doesn't help either. */
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8))
|| broken(is_warp && !memcmp(surface_desc.lpSurface, src_data2, sizeof(src_data2))),
"Got unexpected P8 color key blit result.\n"); "Got unexpected P8 color key blit result.\n");
hr = IDirectDrawSurface4_Unlock(dst_p8, NULL); hr = IDirectDrawSurface4_Unlock(dst_p8, NULL);
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
......
...@@ -7789,6 +7789,19 @@ static void test_palette_complex(void) ...@@ -7789,6 +7789,19 @@ static void test_palette_complex(void)
DestroyWindow(window); DestroyWindow(window);
} }
static BOOL ddraw_is_warp(IDirectDraw7 *ddraw)
{
DDDEVICEIDENTIFIER2 identifier;
HRESULT hr;
if (!strcmp(winetest_platform, "wine"))
return FALSE;
hr = IDirectDraw7_GetDeviceIdentifier(ddraw, &identifier, 0);
ok(SUCCEEDED(hr), "Failed to get device identifier, hr %#x.\n", hr);
return !!strstr(identifier.szDriver, "warp");
}
static void test_p8_blit(void) static void test_p8_blit(void)
{ {
IDirectDrawSurface7 *src, *dst, *dst_p8; IDirectDrawSurface7 *src, *dst, *dst_p8;
...@@ -7801,6 +7814,7 @@ static void test_p8_blit(void) ...@@ -7801,6 +7814,7 @@ static void test_p8_blit(void)
PALETTEENTRY palette_entries[256]; PALETTEENTRY palette_entries[256];
unsigned int x; unsigned int x;
DDBLTFX fx; DDBLTFX fx;
BOOL is_warp;
static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80};
static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80}; static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80};
static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80}; static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80};
...@@ -7817,6 +7831,7 @@ static void test_p8_blit(void) ...@@ -7817,6 +7831,7 @@ static void test_p8_blit(void)
ok(!!ddraw, "Failed to create a ddraw object.\n"); ok(!!ddraw, "Failed to create a ddraw object.\n");
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
is_warp = ddraw_is_warp(ddraw);
memset(palette_entries, 0, sizeof(palette_entries)); memset(palette_entries, 0, sizeof(palette_entries));
palette_entries[1].peGreen = 0xff; palette_entries[1].peGreen = 0xff;
...@@ -7908,7 +7923,14 @@ static void test_p8_blit(void) ...@@ -7908,7 +7923,14 @@ static void test_p8_blit(void)
hr = IDirectDrawSurface7_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL); hr = IDirectDrawSurface7_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL);
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8)), /* A color keyed P8 blit doesn't do anything on WARP - it just leaves the data in the destination
* surface untouched. P8 blits without color keys work. Error checking (DDBLT_KEYSRC without a key
* for example) also works as expected.
*
* Using DDBLT_KEYSRC instead of DDBLT_KEYSRCOVERRIDE doesn't change this. Doing this blit with
* the display mode set to P8 doesn't help either. */
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8))
|| broken(is_warp && !memcmp(surface_desc.lpSurface, src_data2, sizeof(src_data2))),
"Got unexpected P8 color key blit result.\n"); "Got unexpected P8 color key blit result.\n");
hr = IDirectDrawSurface7_Unlock(dst_p8, NULL); hr = IDirectDrawSurface7_Unlock(dst_p8, NULL);
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment