ddraw/tests: Expand test_coop_level_d3d_state().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48072
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-11-15 10:20:33 -06:00 committed by Alexandre Julliard
parent 236b033c39
commit bfb901c60c
3 changed files with 87 additions and 3 deletions

View File

@ -929,6 +929,14 @@ static void test_coop_level_d3d_state(void)
HWND window;
HRESULT hr;
static D3DLVERTEX quad[] =
{
{{-1.0f}, {-1.0f}, {0.0f}, 0, {0x800000ff}},
{{-1.0f}, { 1.0f}, {0.0f}, 0, {0x800000ff}},
{{ 1.0f}, {-1.0f}, {0.0f}, 0, {0x800000ff}},
{{ 1.0f}, { 1.0f}, {0.0f}, 0, {0x800000ff}},
};
window = create_window();
ddraw = create_ddraw();
ok(!!ddraw, "Failed to create a ddraw object.\n");
@ -944,6 +952,11 @@ static void test_coop_level_d3d_state(void)
viewport = create_viewport(device, 0, 0, 640, 480);
viewport_set_background(device, viewport, background);
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_DESTBLEND, D3DBLEND_DESTALPHA);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice2_GetRenderTarget(device, &rt);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
hr = IDirect3DDevice2_GetRenderState(device, D3DRENDERSTATE_ZENABLE, &value);
@ -984,12 +997,23 @@ static void test_coop_level_d3d_state(void)
hr = IDirect3DDevice2_GetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, &value);
ok(SUCCEEDED(hr), "Failed to get render state, hr %#x.\n", hr);
ok(!!value, "Got unexpected alpha blend enable state %#x.\n", value);
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER);
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
color = get_surface_color(rt, 320, 240);
ok(compare_color(color, 0x0000ff00, 1) || broken(compare_color(color, 0x00000000, 1)),
"Got unexpected color 0x%08x.\n", color);
hr = IDirect3DDevice2_SetCurrentViewport(device, viewport);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice2_BeginScene(device);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, quad, ARRAY_SIZE(quad), 0);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice2_EndScene(device);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
color = get_surface_color(rt, 320, 240);
todo_wine ok(compare_color(color, 0x0000ff80, 1), "Got unexpected color 0x%08x.\n", color);
destroy_viewport(device, viewport);
destroy_material(background);
IDirectDrawSurface_Release(surface);

View File

@ -1117,6 +1117,19 @@ static void test_coop_level_d3d_state(void)
HWND window;
HRESULT hr;
static struct
{
struct vec3 position;
DWORD diffuse;
}
quad[] =
{
{{-1.0f, -1.0f, 0.0f}, 0x800000ff},
{{-1.0f, 1.0f, 0.0f}, 0x800000ff},
{{ 1.0f, -1.0f, 0.0f}, 0x800000ff},
{{ 1.0f, 1.0f, 0.0f}, 0x800000ff},
};
window = create_window();
if (!(device = create_device(window, DDSCL_NORMAL)))
{
@ -1127,6 +1140,11 @@ static void test_coop_level_d3d_state(void)
viewport = create_viewport(device, 0, 0, 640, 480);
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_DESTBLEND, D3DBLEND_DESTALPHA);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_GetRenderTarget(device, &rt);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
hr = IDirect3DDevice3_GetRenderState(device, D3DRENDERSTATE_ZENABLE, &value);
@ -1164,11 +1182,23 @@ static void test_coop_level_d3d_state(void)
hr = IDirect3DDevice3_GetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, &value);
ok(SUCCEEDED(hr), "Failed to get render state, hr %#x.\n", hr);
ok(!!value, "Got unexpected alpha blend enable state %#x.\n", value);
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xff00ff00, 0.0f, 0);
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ff00, 1.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
color = get_surface_color(rt, 320, 240);
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirect3DDevice3_SetCurrentViewport(device, viewport);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_BeginScene(device);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP,
D3DFVF_XYZ | D3DFVF_DIFFUSE, quad, ARRAY_SIZE(quad), 0);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_EndScene(device);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
color = get_surface_color(rt, 320, 240);
todo_wine ok(compare_color(color, 0x0000ff80, 1), "Got unexpected color 0x%08x.\n", color);
destroy_viewport(device, viewport);
IDirectDrawSurface4_Release(surface);
IDirectDrawSurface4_Release(rt);

View File

@ -1002,6 +1002,19 @@ static void test_coop_level_d3d_state(void)
HWND window;
HRESULT hr;
static struct
{
struct vec3 position;
DWORD diffuse;
}
quad[] =
{
{{-1.0f, -1.0f, 0.1f}, 0x800000ff},
{{-1.0f, 1.0f, 0.1f}, 0x800000ff},
{{ 1.0f, -1.0f, 0.1f}, 0x800000ff},
{{ 1.0f, 1.0f, 0.1f}, 0x800000ff},
};
window = create_window();
if (!(device = create_device(window, DDSCL_NORMAL)))
{
@ -1010,6 +1023,13 @@ static void test_coop_level_d3d_state(void)
return;
}
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_DESTBLEND, D3DBLEND_DESTALPHA);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_GetRenderTarget(device, &rt);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_ZENABLE, &value);
@ -1066,11 +1086,21 @@ static void test_coop_level_d3d_state(void)
hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, &value);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
ok(!!value, "Got unexpected alpha blend enable state %#x.\n", value);
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ff00, 0.0f, 0);
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ff00, 1.0f, 0);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
color = get_surface_color(rt, 320, 240);
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirect3DDevice7_BeginScene(device);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP,
D3DFVF_XYZ | D3DFVF_DIFFUSE, quad, ARRAY_SIZE(quad), 0);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_EndScene(device);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
color = get_surface_color(rt, 320, 240);
todo_wine ok(compare_color(color, 0x0000ff80, 1), "Got unexpected color 0x%08x.\n", color);
IDirectDrawSurface7_Release(surface);
IDirectDrawSurface7_Release(rt);
IDirect3DDevice7_Release(device);