[PATCH 3/5] wined3d: Unbind resources inside wined3d_device_reset().

Henri Verbeet hverbeet at codeweavers.com
Mon Jul 25 13:45:08 CDT 2011


---
 dlls/d3d8/device.c    |   10 ----------
 dlls/d3d9/device.c    |   10 ----------
 dlls/wined3d/device.c |   11 +++++++++++
 3 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 074b1ac..5c4568d 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -564,20 +564,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(IDirect3DDevice8 *iface,
     IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
     WINED3DPRESENT_PARAMETERS localParameters;
     HRESULT hr;
-    UINT i;
 
     TRACE("iface %p, present_parameters %p.\n", iface, pPresentationParameters);
 
     wined3d_mutex_lock();
-    wined3d_device_set_index_buffer(This->wined3d_device, NULL, WINED3DFMT_UNKNOWN);
-    for (i = 0; i < 16; ++i)
-    {
-        wined3d_device_set_stream_source(This->wined3d_device, i, NULL, 0, 0);
-    }
-    for (i = 0; i < 16; ++i)
-    {
-        wined3d_device_set_texture(This->wined3d_device, i, NULL);
-    }
 
     localParameters.BackBufferWidth                             = pPresentationParameters->BackBufferWidth;
     localParameters.BackBufferHeight                            = pPresentationParameters->BackBufferHeight;
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index bdfa85e..74d8383 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -552,7 +552,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(IDirect3DDevi
     IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
     WINED3DPRESENT_PARAMETERS localParameters;
     HRESULT hr;
-    UINT i;
 
     TRACE("iface %p, present_parameters %p.\n", iface, pPresentationParameters);
 
@@ -565,15 +564,6 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(IDirect3DDevi
      * below fails, the device is considered "lost", and _Reset and _Release are the only allowed calls
      */
     wined3d_mutex_lock();
-    wined3d_device_set_index_buffer(This->wined3d_device, NULL, WINED3DFMT_UNKNOWN);
-    for (i = 0; i < 16; ++i)
-    {
-        wined3d_device_set_stream_source(This->wined3d_device, i, NULL, 0, 0);
-    }
-    for (i = 0; i < 16; ++i)
-    {
-        wined3d_device_set_texture(This->wined3d_device, i, NULL);
-    }
 
     localParameters.BackBufferWidth                     = pPresentationParameters->BackBufferWidth;
     localParameters.BackBufferHeight                    = pPresentationParameters->BackBufferHeight;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e411cea..9fd82b5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5624,10 +5624,21 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
     struct wined3d_swapchain *swapchain;
     BOOL DisplayModeChanged = FALSE;
     WINED3DDISPLAYMODE mode;
+    unsigned int i;
     HRESULT hr;
 
     TRACE("device %p, present_parameters %p.\n", device, present_parameters);
 
+    wined3d_device_set_index_buffer(device, NULL, WINED3DFMT_UNKNOWN);
+    for (i = 0; i < MAX_STREAMS; ++i)
+    {
+        wined3d_device_set_stream_source(device, i, NULL, 0, 0);
+    }
+    for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
+    {
+        wined3d_device_set_texture(device, i, NULL);
+    }
+
     LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
     {
         TRACE("Enumerating resource %p.\n", resource);
-- 
1.7.3.4




More information about the wine-patches mailing list