[PATCH v3 2/2] wined3d: Also reset the device state to the default in wined3d_device_uninit_3d().

Zebediah Figura z.figura12 at gmail.com
Fri Nov 15 10:20:34 CST 2019


Fixes a regression introduced by 96547e622b04f403bc0c78d649275d1f844ed40e.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48072
Signed-off-by: Zebediah Figura <z.figura12 at 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);
-- 
2.23.0




More information about the wine-devel mailing list