From d2b010c4c1c08d71ed6e2e4257db236535c20deb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 2 Oct 2013 23:40:20 +0200
Subject: wined3d: Unload resources through the CS in device_reset.

---
 dlls/wined3d/device.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 28819af..2410547 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4228,21 +4228,23 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
     struct wined3d_context *context;
     struct wined3d_shader *shader;
 
-    context = context_acquire(device, NULL);
-    gl_info = context->gl_info;
-
     LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
     {
         TRACE("Unloading resource %p.\n", resource);
 
-        resource->resource_ops->resource_unload(resource);
+        wined3d_cs_emit_evict_resource(device->cs, resource);
     }
+    if (wined3d_settings.cs_multithreaded)
+        device->cs->ops->finish(device->cs);
 
     LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
     {
         device->shader_backend->shader_destroy(shader);
     }
 
+    context = context_acquire(device, NULL);
+    gl_info = context->gl_info;
+
     if (device->depth_blt_texture)
     {
         gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture);
-- 
2.1.3

