wined3d: Unload resources in wined3d_device_uninit_3d().

Instead of in wined3d_device_delete_opengl_contexts_cs(), which is specific to
the GL backend.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-12-06 22:53:48 +03:30 committed by Alexandre Julliard
parent ca0c3f770a
commit ac24504034

View file

@ -939,7 +939,6 @@ static void device_init_swapchain_state(struct wined3d_device *device, struct wi
void wined3d_device_delete_opengl_contexts_cs(void *object)
{
struct wined3d_resource *resource, *cursor;
struct wined3d_swapchain_gl *swapchain_gl;
struct wined3d_device *device = object;
struct wined3d_context_gl *context_gl;
@ -949,12 +948,6 @@ void wined3d_device_delete_opengl_contexts_cs(void *object)
device_gl = wined3d_device_gl(device);
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
TRACE("Unloading resource %p.\n", resource);
wined3d_cs_emit_unload_resource(device->cs, resource);
}
LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
{
device->shader_backend->shader_destroy(shader);
@ -1106,6 +1099,7 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context)
void wined3d_device_uninit_3d(struct wined3d_device *device)
{
BOOL no3d = device->wined3d->flags & WINED3D_NO3D;
struct wined3d_resource *resource, *cursor;
struct wined3d_rendertarget_view *view;
struct wined3d_texture *texture;
unsigned int i;
@ -1145,6 +1139,12 @@ void wined3d_device_uninit_3d(struct wined3d_device *device)
wine_rb_clear(&device->samplers, device_free_sampler, NULL);
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
TRACE("Unloading resource %p.\n", resource);
wined3d_cs_emit_unload_resource(device->cs, resource);
}
device->adapter->adapter_ops->adapter_uninit_3d(device);
device->d3d_initialized = FALSE;
@ -5298,6 +5298,12 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
wined3d_cs_emit_reset_state(device->cs);
state_cleanup(&device->state);
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
TRACE("Unloading resource %p.\n", resource);
wined3d_cs_emit_unload_resource(device->cs, resource);
}
if (device->d3d_initialized)
device->adapter->adapter_ops->adapter_uninit_3d(device);