Commit 817f915b authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Simplify wined3d_context_destroy().

parent e5e79bb7
...@@ -2302,7 +2302,6 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context, ...@@ -2302,7 +2302,6 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
void wined3d_context_destroy(struct wined3d_context *context) void wined3d_context_destroy(struct wined3d_context *context)
{ {
struct wined3d_device *device = context->device; struct wined3d_device *device = context->device;
BOOL destroy;
TRACE("Destroying ctx %p\n", context); TRACE("Destroying ctx %p\n", context);
...@@ -2320,29 +2319,28 @@ void wined3d_context_destroy(struct wined3d_context *context) ...@@ -2320,29 +2319,28 @@ void wined3d_context_destroy(struct wined3d_context *context)
return; return;
} }
if (context->tid == GetCurrentThreadId() || !context->current) device->shader_backend->shader_free_context_data(context);
{ device->adapter->fragment_pipe->free_context_data(context);
context_destroy_gl_resources(context); heap_free(context->texture_type);
TlsSetValue(wined3d_context_tls_idx, NULL); device_context_remove(device, context);
destroy = TRUE;
} if (context->current && context->tid != GetCurrentThreadId())
else
{ {
/* Make a copy of gl_info for context_destroy_gl_resources use, the one struct wined3d_gl_info *gl_info;
in wined3d_adapter may go away in the meantime */
struct wined3d_gl_info *gl_info = heap_alloc(sizeof(*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; *gl_info = *context->gl_info;
context->gl_info = gl_info; context->gl_info = gl_info;
context->destroyed = 1; context->destroyed = 1;
destroy = FALSE;
return;
} }
device->shader_backend->shader_free_context_data(context); context_destroy_gl_resources(context);
device->adapter->fragment_pipe->free_context_data(context); TlsSetValue(wined3d_context_tls_idx, NULL);
heap_free(context->texture_type); heap_free(context);
device_context_remove(device, context);
if (destroy)
heap_free(context);
} }
const DWORD *context_get_tex_unit_mapping(const struct wined3d_context *context, const DWORD *context_get_tex_unit_mapping(const struct wined3d_context *context,
......
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