As a regression test for bug 48072.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ddraw/tests/ddraw2.c | 26 +++++++++++++++++++++++++- dlls/ddraw/tests/ddraw4.c | 32 +++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw7.c | 32 +++++++++++++++++++++++++++++++- 3 files changed, 87 insertions(+), 3 deletions(-)
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);
Fixes a regression introduced by 96547e622b04f403bc0c78d649275d1f844ed40e.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48072 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ddraw/tests/ddraw2.c | 2 +- dlls/ddraw/tests/ddraw4.c | 2 +- dlls/ddraw/tests/ddraw7.c | 2 +- dlls/wined3d/device.c | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index cc48c2ae356..77c8e32e6bd 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -1012,7 +1012,7 @@ static void test_coop_level_d3d_state(void) 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); + ok(compare_color(color, 0x0000ff80, 1), "Got unexpected color 0x%08x.\n", color);
destroy_viewport(device, viewport); destroy_material(background); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 5cdc74e50f9..df20ccb09d3 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -1197,7 +1197,7 @@ static void test_coop_level_d3d_state(void) 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); + ok(compare_color(color, 0x0000ff80, 1), "Got unexpected color 0x%08x.\n", color);
destroy_viewport(device, viewport); IDirectDrawSurface4_Release(surface); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 5f4d1a166dd..7c46f33cb7a 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -1099,7 +1099,7 @@ static void test_coop_level_d3d_state(void) 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); + ok(compare_color(color, 0x0000ff80, 1), "Got unexpected color 0x%08x.\n", color);
IDirectDrawSurface7_Release(surface); IDirectDrawSurface7_Release(rt); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 2a4d3778486..baf9f25e98d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1142,6 +1142,8 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
wined3d_cs_emit_reset_state(device->cs); state_cleanup(&device->state); + memset(&device->state, 0, sizeof(device->state)); + state_init(&device->state, &device->fb, &device->adapter->d3d_info, WINED3D_STATE_INIT_DEFAULT); for (i = 0; i < device->adapter->d3d_info.limits.max_rt_count; ++i) { wined3d_device_set_rendertarget_view(device, i, NULL, FALSE);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=60251
Your paranoid android.
=== w8 (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000080.
=== w8adm (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000080.
=== w864 (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000080.
=== w1064v1507 (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000080.
=== w1064v1809 (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_2scr (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_ar (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_he (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_ja (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_zh_CN (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809 (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_2scr (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_ar (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_he (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_ja (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_zh_CN (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809 (32 bit report) ===
ddraw: 1970:ddraw7: unhandled exception c0000005 at 738140F8
=== w1064v1809_2scr (32 bit report) ===
ddraw: 1a8c:ddraw7: unhandled exception c0000005 at 736340F8
=== w1064v1809_ar (32 bit report) ===
ddraw: 1820:ddraw7: unhandled exception c0000005 at 72CE40F8
=== w1064v1809_he (32 bit report) ===
ddraw: 1aac:ddraw7: unhandled exception c0000005 at 731A40F8
=== w1064v1809_ja (32 bit report) ===
ddraw: 1990:ddraw7: unhandled exception c0000005 at 71D840F8
=== w1064v1809_zh_CN (32 bit report) ===
ddraw: 13b4:ddraw7: unhandled exception c0000005 at 72DE40F8
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=60250
Your paranoid android.
=== w8 (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000080. ddraw2.c:3239: Test failed: Failed to create surface, hr 0x887601c2. 0e90:ddraw2: unhandled exception c0000005 at 0047EF1B
=== w8adm (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000080.
=== w864 (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000080.
=== w1064v1507 (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000080.
=== w1064v1809 (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_2scr (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_ar (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_he (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_ja (32 bit report) ===
ddraw: ddraw2.c:1013: Test failed: Got unexpected hr 0x887601c2. ddraw2.c:1015: Test failed: Got unexpected color 0x00000000.
=== w1064v1809_zh_CN (task log) ===
Task errors: channel 2: open failed: connect failed: No route to host channel 2: open failed: connect failed: No route to host channel 2: open failed: connect failed: No route to host channel 2: open failed: connect failed: No route to host channel 2: open failed: connect failed: No route to host BotError: The test VM is powered off! Did the test shut it down?
=== w1064v1809 (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_2scr (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_ar (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_he (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_ja (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w1064v1809_zh_CN (32 bit report) ===
ddraw: ddraw4.c:1200: Test failed: Got unexpected color 0x0000ff00.
=== w8 (32 bit report) ===
ddraw: ddraw7.c:3923: Test failed: Lit quad without normals has color 0x00ffffff, expected 0x00000000. ddraw7.c:3936: Test failed: Lit quad with normals has color 0x00ffffff, expected 0x00000000. ddraw7.c:3981: Test failed: Lit quad with light has color 0x00ffffff. ddraw7.c:3981: Test failed: Lit quad with singular world matrix has color 0x00ffffff. ddraw7.c:3981: Test failed: Lit quad with transformation matrix has color 0x00ffffff. ddraw7.c:3981: Test failed: Lit quad with non-affine matrix has color 0x00ffffff.
=== w8adm (32 bit report) ===
ddraw: ddraw7.c:3066: Test failed: Failed to create surface, hr 0x887601c2. 0d2c:ddraw7: unhandled exception c0000005 at 005113F5
=== w1064v1809 (32 bit report) ===
ddraw: 19f4:ddraw7: unhandled exception c0000005 at 73BC40F8
=== w1064v1809_2scr (32 bit report) ===
ddraw: 1bbc:ddraw7: unhandled exception c0000005 at 74CB40F8
=== w1064v1809_ar (32 bit report) ===
ddraw: 1700:ddraw7: unhandled exception c0000005 at 726540F8
=== w1064v1809_he (32 bit report) ===
ddraw: 0ccc:ddraw7: unhandled exception c0000005 at 737D40F8
=== w1064v1809_ja (32 bit report) ===
ddraw: 11c0:ddraw7: unhandled exception c0000005 at 721440F8
=== w1064v1809_zh_CN (32 bit report) ===
ddraw: 1b94:ddraw7: unhandled exception c0000005 at 734140F8