wined3d: Simplify context_resource_released().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-22 14:22:44 +04:30 committed by Alexandre Julliard
parent 70f017ac4d
commit e5ab987d60
3 changed files with 11 additions and 24 deletions

View File

@ -1055,35 +1055,23 @@ static void context_queue_fbo_entry_destruction(struct wined3d_context *context,
list_add_head(&context->fbo_destroy_list, &entry->entry); list_add_head(&context->fbo_destroy_list, &entry->entry);
} }
void context_resource_released(const struct wined3d_device *device, void context_resource_released(const struct wined3d_device *device, struct wined3d_resource *resource)
struct wined3d_resource *resource, enum wined3d_resource_type type)
{ {
struct wined3d_texture *texture; unsigned int i;
UINT i;
if (!device->d3d_initialized) if (!device->d3d_initialized)
return; return;
switch (type)
{
case WINED3D_RTYPE_TEXTURE_2D:
case WINED3D_RTYPE_TEXTURE_3D:
texture = texture_from_resource(resource);
for (i = 0; i < device->context_count; ++i) for (i = 0; i < device->context_count; ++i)
{ {
struct wined3d_context *context = device->contexts[i]; struct wined3d_context *context = device->contexts[i];
if (context->current_rt.texture == texture)
if (&context->current_rt.texture->resource == resource)
{ {
context->current_rt.texture = NULL; context->current_rt.texture = NULL;
context->current_rt.sub_resource_idx = 0; context->current_rt.sub_resource_idx = 0;
} }
} }
break;
default:
break;
}
} }
void context_gl_resource_released(struct wined3d_device *device, void context_gl_resource_released(struct wined3d_device *device,

View File

@ -222,7 +222,7 @@ static void wined3d_resource_destroy_object(void *object)
struct wined3d_resource *resource = object; struct wined3d_resource *resource = object;
wined3d_resource_free_sysmem(resource); wined3d_resource_free_sysmem(resource);
context_resource_released(resource->device, resource, resource->type); context_resource_released(resource->device, resource);
wined3d_resource_release(resource); wined3d_resource_release(resource);
} }

View File

@ -2171,8 +2171,7 @@ void *context_map_bo_address(struct wined3d_context *context, const struct wined
struct wined3d_context *context_reacquire(const struct wined3d_device *device, struct wined3d_context *context_reacquire(const struct wined3d_device *device,
struct wined3d_context *context) DECLSPEC_HIDDEN; struct wined3d_context *context) DECLSPEC_HIDDEN;
void context_release(struct wined3d_context *context) DECLSPEC_HIDDEN; void context_release(struct wined3d_context *context) DECLSPEC_HIDDEN;
void context_resource_released(const struct wined3d_device *device, void context_resource_released(const struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
struct wined3d_resource *resource, enum wined3d_resource_type type) DECLSPEC_HIDDEN;
void context_restore(struct wined3d_context *context, struct wined3d_texture *texture, void context_restore(struct wined3d_context *context, struct wined3d_texture *texture,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN; unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
BOOL context_set_current(struct wined3d_context *ctx) DECLSPEC_HIDDEN; BOOL context_set_current(struct wined3d_context *ctx) DECLSPEC_HIDDEN;