mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 18:40:28 +00:00
ddraw/tests: Run test_zenable() for each device type.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a63716af13
commit
e68abb70df
|
@ -1610,7 +1610,7 @@ static void test_viewport_object(void)
|
|||
IDirectDraw_Release(ddraw);
|
||||
}
|
||||
|
||||
static void test_zenable(void)
|
||||
static void test_zenable(const GUID *device_guid)
|
||||
{
|
||||
static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
|
||||
static D3DTLVERTEX tquad[] =
|
||||
|
@ -1638,7 +1638,7 @@ static void test_zenable(void)
|
|||
window = create_window();
|
||||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
|
||||
if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid)))
|
||||
{
|
||||
skip("Failed to create a 3D device, skipping test.\n");
|
||||
IDirectDraw_Release(ddraw);
|
||||
|
@ -1669,20 +1669,20 @@ static void test_zenable(void)
|
|||
inst_length = (BYTE *)ptr - (BYTE *)exec_desc.lpData;
|
||||
inst_length -= sizeof(tquad);
|
||||
hr = IDirect3DExecuteBuffer_Unlock(execute_buffer);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock execute buffer, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DViewport_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
set_execute_data(execute_buffer, 4, sizeof(tquad), inst_length);
|
||||
hr = IDirect3DDevice_Execute(device, execute_buffer, viewport, D3DEXECUTE_CLIPPED);
|
||||
ok(SUCCEEDED(hr), "Failed to execute exec buffer, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 4; ++j)
|
||||
|
@ -14357,7 +14357,7 @@ START_TEST(ddraw1)
|
|||
test_surface_interface_mismatch();
|
||||
test_coop_level_threaded();
|
||||
test_viewport_object();
|
||||
test_zenable();
|
||||
run_for_each_device_type(test_zenable);
|
||||
test_ck_rgba();
|
||||
test_ck_default();
|
||||
test_ck_complex();
|
||||
|
|
|
@ -1829,7 +1829,7 @@ static void test_viewport_object(void)
|
|||
IDirectDraw2_Release(ddraw);
|
||||
}
|
||||
|
||||
static void test_zenable(void)
|
||||
static void test_zenable(const GUID *device_guid)
|
||||
{
|
||||
static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
|
||||
static D3DTLVERTEX tquad[] =
|
||||
|
@ -1853,7 +1853,7 @@ static void test_zenable(void)
|
|||
window = create_window();
|
||||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
|
||||
if (!(device = create_device_ex(ddraw, window, DDSCL_NORMAL, device_guid)))
|
||||
{
|
||||
skip("Failed to create a 3D device, skipping test.\n");
|
||||
IDirectDraw2_Release(ddraw);
|
||||
|
@ -1865,22 +1865,36 @@ static void test_zenable(void)
|
|||
viewport = create_viewport(device, 0, 0, 640, 480);
|
||||
viewport_set_background(device, viewport, background);
|
||||
hr = IDirect3DDevice2_SetCurrentViewport(device, viewport);
|
||||
ok(SUCCEEDED(hr), "Failed to set current viewport, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_TLVERTEX, tquad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice2_GetRenderTarget(device, &rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
color = get_surface_color(rt, 80, 60);
|
||||
/* For some reason clears and colour fill blits randomly fail with software render target. */
|
||||
ok(color == 0x00ff0000 || broken(is_software_device_type(device_guid) && !color),
|
||||
"Got unexpected colour 0x%08x.\n", color);
|
||||
if (!color)
|
||||
{
|
||||
fill_surface(rt, 0xffff0000);
|
||||
|
||||
color = get_surface_color(rt, 80, 60);
|
||||
ok(color == 0x00ff0000, "Got unexpected colour 0x%08x.\n", color);
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice2_BeginScene(device);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_TLVERTEX, tquad, 4, 0);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_EndScene(device);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 4; ++j)
|
||||
|
@ -15317,7 +15331,7 @@ START_TEST(ddraw2)
|
|||
run_for_each_device_type(test_depth_blit);
|
||||
test_texture_load_ckey();
|
||||
test_viewport_object();
|
||||
test_zenable();
|
||||
run_for_each_device_type(test_zenable);
|
||||
test_ck_rgba();
|
||||
test_ck_default();
|
||||
test_ck_complex();
|
||||
|
|
|
@ -2071,7 +2071,7 @@ static void test_viewport_object(void)
|
|||
IDirectDraw4_Release(ddraw);
|
||||
}
|
||||
|
||||
static void test_zenable(void)
|
||||
static void test_zenable(const GUID *device_guid)
|
||||
{
|
||||
static D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
|
||||
static struct
|
||||
|
@ -2096,7 +2096,7 @@ static void test_zenable(void)
|
|||
UINT i, j;
|
||||
|
||||
window = create_window();
|
||||
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||
if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid)))
|
||||
{
|
||||
skip("Failed to create a 3D device, skipping test.\n");
|
||||
DestroyWindow(window);
|
||||
|
@ -2105,22 +2105,36 @@ static void test_zenable(void)
|
|||
|
||||
viewport = create_viewport(device, 0, 0, 640, 480);
|
||||
hr = IDirect3DDevice3_SetCurrentViewport(device, viewport);
|
||||
ok(SUCCEEDED(hr), "Failed to set current viewport, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffff0000, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE, tquad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice3_GetRenderTarget(device, &rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
color = get_surface_color(rt, 80, 60);
|
||||
/* For some reason clears and colour fill blits randomly fail with software render target. */
|
||||
ok(color == 0x00ff0000 || broken(is_software_device_type(device_guid) && !color),
|
||||
"Got unexpected colour 0x%08x.\n", color);
|
||||
if (!color)
|
||||
{
|
||||
fill_surface(rt, 0xffff0000);
|
||||
|
||||
color = get_surface_color(rt, 80, 60);
|
||||
ok(color == 0x00ff0000, "Got unexpected colour 0x%08x.\n", color);
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice3_BeginScene(device);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE, tquad, 4, 0);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_EndScene(device);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 4; ++j)
|
||||
|
@ -18355,7 +18369,7 @@ START_TEST(ddraw4)
|
|||
run_for_each_device_type(test_depth_blit);
|
||||
test_texture_load_ckey();
|
||||
test_viewport_object();
|
||||
test_zenable();
|
||||
run_for_each_device_type(test_zenable);
|
||||
test_ck_rgba();
|
||||
test_ck_default();
|
||||
test_ck_complex();
|
||||
|
|
|
@ -1709,7 +1709,7 @@ static void test_texture_load_ckey(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_zenable(void)
|
||||
static void test_zenable(const GUID *device_guid)
|
||||
{
|
||||
static struct
|
||||
{
|
||||
|
@ -1732,7 +1732,7 @@ static void test_zenable(void)
|
|||
UINT i, j;
|
||||
|
||||
window = create_window();
|
||||
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||
if (!(device = create_device_ex(window, DDSCL_NORMAL, device_guid)))
|
||||
{
|
||||
skip("Failed to create a 3D device, skipping test.\n");
|
||||
DestroyWindow(window);
|
||||
|
@ -1740,19 +1740,33 @@ static void test_zenable(void)
|
|||
}
|
||||
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffff0000, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE, tquad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_GetRenderTarget(device, &rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
color = get_surface_color(rt, 80, 60);
|
||||
/* For some reason clears and colour fill blits randomly fail with software render target. */
|
||||
ok(color == 0x00ff0000 || broken(is_software_device_type(device_guid) && !color),
|
||||
"Got unexpected colour 0x%08x.\n", color);
|
||||
if (!color)
|
||||
{
|
||||
fill_surface(rt, 0xffff0000);
|
||||
|
||||
color = get_surface_color(rt, 80, 60);
|
||||
ok(color == 0x00ff0000, "Got unexpected colour 0x%08x.\n", color);
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice7_BeginScene(device);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZRHW | D3DFVF_DIFFUSE, tquad, 4, 0);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_EndScene(device);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 4; ++j)
|
||||
|
@ -18643,7 +18657,7 @@ START_TEST(ddraw7)
|
|||
test_coop_level_threaded();
|
||||
run_for_each_device_type(test_depth_blit);
|
||||
test_texture_load_ckey();
|
||||
test_zenable();
|
||||
run_for_each_device_type(test_zenable);
|
||||
test_ck_rgba();
|
||||
test_ck_default();
|
||||
test_ck_complex();
|
||||
|
|
Loading…
Reference in a new issue