diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index bf0cfef0b1a..cc48c2ae356 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -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); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index e3146ca45d0..5cdc74e50f9 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -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); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 2cd3b516f14..5f4d1a166dd 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -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);