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

wined3d: Send buffer destruction through the command stream.

parent 11842376
......@@ -556,28 +556,35 @@ static void wined3d_buffer_drop_bo(struct wined3d_buffer *buffer)
device_invalidate_state(device, STATE_STREAMSRC);
}
static void wined3d_buffer_destroy_object(void *object)
{
struct wined3d_buffer *buffer = object;
struct wined3d_context *context;
if (buffer->buffer_object)
{
context = context_acquire(buffer->resource.device, NULL);
delete_gl_buffer(buffer, context->gl_info);
context_release(context);
HeapFree(GetProcessHeap(), 0, buffer->conversion_map);
}
HeapFree(GetProcessHeap(), 0, buffer->maps);
HeapFree(GetProcessHeap(), 0, buffer);
}
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
{
ULONG refcount = InterlockedDecrement(&buffer->resource.ref);
struct wined3d_context *context;
TRACE("%p decreasing refcount to %u.\n", buffer, refcount);
if (!refcount)
{
if (buffer->buffer_object)
{
context = context_acquire(buffer->resource.device, NULL);
delete_gl_buffer(buffer, context->gl_info);
context_release(context);
HeapFree(GetProcessHeap(), 0, buffer->conversion_map);
}
resource_cleanup(&buffer->resource);
buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent);
HeapFree(GetProcessHeap(), 0, buffer->maps);
HeapFree(GetProcessHeap(), 0, buffer);
resource_cleanup(&buffer->resource);
wined3d_cs_emit_destroy_object(buffer->resource.device->cs, wined3d_buffer_destroy_object, buffer);
}
return refcount;
......
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