Henri Verbeet : wined3d: Unbind framebuffer state in state_unbind_resources().

Alexandre Julliard julliard at winehq.org
Tue Feb 23 15:54:47 CST 2021


Module: wine
Branch: master
Commit: 57119a1c1f4992ebf81e6fe10c78a537ee8d0ba6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=57119a1c1f4992ebf81e6fe10c78a537ee8d0ba6

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Feb 23 19:50:44 2021 +0100

wined3d: Unbind framebuffer state in state_unbind_resources().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 792263ca7d8..c9df09b5348 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 46588fa4246..52124583c90 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)




More information about the wine-cvs mailing list