From 38f3d59ed694afba7913b4992d13cb044a09126c Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 8 Jul 2016 10:59:01 +0200 Subject: [PATCH] wined3d: Send resource destruction through the command stream. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/device.c | 2 -- dlls/wined3d/resource.c | 11 +++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index b52970fb18e..32e7092d144 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4993,8 +4993,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); - context_resource_released(device, resource, type); - for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { if ((rtv = device->fb.render_targets[i]) && rtv->resource == resource) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index be7dfb47781..a475dc0a5dc 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -233,6 +233,14 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * return WINED3D_OK; } +static void wined3d_resource_destroy_object(void *object) +{ + struct wined3d_resource *resource = object; + + wined3d_resource_free_sysmem(resource); + context_resource_released(resource->device, resource, resource->type); +} + void resource_cleanup(struct wined3d_resource *resource) { const struct wined3d *d3d = resource->device->wined3d; @@ -245,9 +253,8 @@ void resource_cleanup(struct wined3d_resource *resource) adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size); } - wined3d_resource_free_sysmem(resource); - device_resource_released(resource->device, resource); + wined3d_cs_emit_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource); } void resource_unload(struct wined3d_resource *resource)