[PATCH 2/5] wined3d: Unbind framebuffer state in state_unbind_resources().

Henri Verbeet hverbeet at codeweavers.com
Tue Feb 23 12:50:44 CST 2021


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/device.c     | 13 -------------
 dlls/wined3d/stateblock.c | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 792263ca7d8b..c9df09b53483 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1196,7 +1196,6 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
     struct wined3d_resource *resource, *cursor;
     struct wined3d_rendertarget_view *view;
     struct wined3d_texture *texture;
-    unsigned int i;
 
     TRACE("device %p.\n", device);
 
@@ -1224,10 +1223,6 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
 
     wined3d_cs_emit_reset_state(device->cs);
     state_cleanup(state);
-    for (i = 0; i < device->adapter->d3d_info.limits.max_rt_count; ++i)
-    {
-        wined3d_device_set_rendertarget_view(device, i, NULL, FALSE);
-    }
 
     wine_rb_clear(&device->samplers, device_free_sampler, NULL);
     wine_rb_clear(&device->rasterizer_states, device_free_rasterizer_state, NULL);
@@ -1243,14 +1238,6 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
     device->adapter->adapter_ops->adapter_uninit_3d(device);
     device->d3d_initialized = FALSE;
 
-    if ((view = state->fb.depth_stencil))
-    {
-        TRACE("Releasing depth/stencil view %p.\n", view);
-
-        state->fb.depth_stencil = NULL;
-        wined3d_rendertarget_view_decref(view);
-    }
-
     if ((view = device->auto_depth_stencil_view))
     {
         device->auto_depth_stencil_view = NULL;
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 46588fa4246c..52124583c90c 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -374,6 +374,7 @@ void state_unbind_resources(struct wined3d_state *state)
     struct wined3d_shader_resource_view *srv;
     struct wined3d_vertex_declaration *decl;
     struct wined3d_blend_state *blend_state;
+    struct wined3d_rendertarget_view *rtv;
     struct wined3d_sampler *sampler;
     struct wined3d_texture *texture;
     struct wined3d_buffer *buffer;
@@ -473,6 +474,21 @@ void state_unbind_resources(struct wined3d_state *state)
         state->blend_state = NULL;
         wined3d_blend_state_decref(blend_state);
     }
+
+    for (i = 0; i < ARRAY_SIZE(state->fb.render_targets); ++i)
+    {
+        if ((rtv = state->fb.render_targets[i]))
+        {
+            state->fb.render_targets[i] = NULL;
+            wined3d_rendertarget_view_decref(rtv);
+        }
+    }
+
+    if ((rtv = state->fb.depth_stencil))
+    {
+        state->fb.depth_stencil = NULL;
+        wined3d_rendertarget_view_decref(rtv);
+    }
 }
 
 void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state)
-- 
2.20.1




More information about the wine-devel mailing list