[PATCH 2/5] wined3d: Simplify context_resource_released().
Henri Verbeet
hverbeet at codeweavers.com
Thu Mar 22 04:52:44 CDT 2018
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
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 db32f1dc978..04756be09d0 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 8968c164ed5..a95d6f50b68 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 5e8734e7a97..506f7dbf308 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;
--
2.11.0
More information about the wine-devel
mailing list