Henri Verbeet : wined3d: Simplify context_resource_released().
Alexandre Julliard
julliard at winehq.org
Thu Mar 22 17:08:15 CDT 2018
Module: wine
Branch: master
Commit: e5ab987d601ed23e63d22d33580af404ae3879ce
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e5ab987d601ed23e63d22d33580af404ae3879ce
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Thu Mar 22 14:40:44 2018 +0430
wined3d: Simplify context_resource_released().
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/context.c | 30 +++++++++---------------------
dlls/wined3d/resource.c | 2 +-
dlls/wined3d/wined3d_private.h | 3 +--
3 files changed, 11 insertions(+), 24 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index db32f1d..04756be 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1055,34 +1055,22 @@ static void context_queue_fbo_entry_destruction(struct wined3d_context *context,
list_add_head(&context->fbo_destroy_list, &entry->entry);
}
-void context_resource_released(const struct wined3d_device *device,
- struct wined3d_resource *resource, enum wined3d_resource_type type)
+void context_resource_released(const struct wined3d_device *device, struct wined3d_resource *resource)
{
- struct wined3d_texture *texture;
- UINT i;
+ unsigned int i;
if (!device->d3d_initialized)
return;
- switch (type)
+ for (i = 0; i < device->context_count; ++i)
{
- case WINED3D_RTYPE_TEXTURE_2D:
- 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;
+ struct wined3d_context *context = device->contexts[i];
- default:
- break;
+ if (&context->current_rt.texture->resource == resource)
+ {
+ context->current_rt.texture = NULL;
+ context->current_rt.sub_resource_idx = 0;
+ }
}
}
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 8968c16..a95d6f5 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -222,7 +222,7 @@ 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);
+ context_resource_released(resource->device, resource);
wined3d_resource_release(resource);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 5e8734e..506f7db 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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) DECLSPEC_HIDDEN;
void context_release(struct wined3d_context *context) DECLSPEC_HIDDEN;
-void context_resource_released(const struct wined3d_device *device,
- struct wined3d_resource *resource, enum wined3d_resource_type type) DECLSPEC_HIDDEN;
+void context_resource_released(const struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void context_restore(struct wined3d_context *context, struct wined3d_texture *texture,
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
BOOL context_set_current(struct wined3d_context *ctx) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list