Henri Verbeet : wined3d: Simplify wined3d_context_destroy().
Alexandre Julliard
julliard at winehq.org
Fri May 3 15:46:17 CDT 2019
Module: wine
Branch: master
Commit: 817f915bb3afb1c52afb7cac7276d63091a12d9e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=817f915bb3afb1c52afb7cac7276d63091a12d9e
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Fri May 3 15:43:58 2019 +0430
wined3d: Simplify wined3d_context_destroy().
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/context.c | 34 ++++++++++++++++------------------
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 223e6b2..5978627 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2302,7 +2302,6 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
void wined3d_context_destroy(struct wined3d_context *context)
{
struct wined3d_device *device = context->device;
- BOOL destroy;
TRACE("Destroying ctx %p\n", context);
@@ -2320,29 +2319,28 @@ void wined3d_context_destroy(struct wined3d_context *context)
return;
}
- if (context->tid == GetCurrentThreadId() || !context->current)
- {
- context_destroy_gl_resources(context);
- TlsSetValue(wined3d_context_tls_idx, NULL);
- destroy = TRUE;
- }
- else
+ device->shader_backend->shader_free_context_data(context);
+ device->adapter->fragment_pipe->free_context_data(context);
+ heap_free(context->texture_type);
+ device_context_remove(device, context);
+
+ if (context->current && context->tid != GetCurrentThreadId())
{
- /* Make a copy of gl_info for context_destroy_gl_resources use, the one
- in wined3d_adapter may go away in the meantime */
- struct wined3d_gl_info *gl_info = heap_alloc(sizeof(*gl_info));
+ struct wined3d_gl_info *gl_info;
+
+ /* Make a copy of gl_info for context_destroy_gl_resources() use, the
+ * one in wined3d_adapter may go away in the meantime. */
+ gl_info = heap_alloc(sizeof(*gl_info));
*gl_info = *context->gl_info;
context->gl_info = gl_info;
context->destroyed = 1;
- destroy = FALSE;
+
+ return;
}
- device->shader_backend->shader_free_context_data(context);
- device->adapter->fragment_pipe->free_context_data(context);
- heap_free(context->texture_type);
- device_context_remove(device, context);
- if (destroy)
- heap_free(context);
+ context_destroy_gl_resources(context);
+ TlsSetValue(wined3d_context_tls_idx, NULL);
+ heap_free(context);
}
const DWORD *context_get_tex_unit_mapping(const struct wined3d_context *context,
More information about the wine-cvs
mailing list