Commit e5ab987d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Simplify context_resource_released().

parent 70f017ac
...@@ -1055,34 +1055,22 @@ static void context_queue_fbo_entry_destruction(struct wined3d_context *context, ...@@ -1055,34 +1055,22 @@ 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) for (i = 0; i < device->context_count; ++i)
{ {
case WINED3D_RTYPE_TEXTURE_2D: struct wined3d_context *context = device->contexts[i];
case WINED3D_RTYPE_TEXTURE_3D:
texture = texture_from_resource(resource);
for (i = 0; i < device->context_count; ++i)
{
struct wined3d_context *context = device->contexts[i];
if (context->current_rt.texture == texture)
{
context->current_rt.texture = NULL;
context->current_rt.sub_resource_idx = 0;
}
}
break;
default: if (&context->current_rt.texture->resource == resource)
break; {
context->current_rt.texture = NULL;
context->current_rt.sub_resource_idx = 0;
}
} }
} }
......
...@@ -222,7 +222,7 @@ static void wined3d_resource_destroy_object(void *object) ...@@ -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);
} }
......
...@@ -2171,8 +2171,7 @@ void *context_map_bo_address(struct wined3d_context *context, const struct wined ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment