Commit 4b1ba0e0 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Don't get rid of the user memory unless we're actually called with NULL…

wined3d: Don't get rid of the user memory unless we're actually called with NULL in surface_set_mem(). In particular, some applications will call surface_set_mem() with the same pointer to notify us the contents have changed.
parent 1ad1474b
......@@ -1783,17 +1783,21 @@ static HRESULT surface_set_mem(struct wined3d_surface *surface, void *mem)
}
else if (surface->flags & SFLAG_USERPTR)
{
/* Map and GetDC will re-create the dib section and allocated memory. */
surface->resource.allocatedMemory = NULL;
/* HeapMemory should be NULL already. */
if (surface->resource.heapMemory)
ERR("User pointer surface has heap memory allocated.\n");
surface->flags &= ~(SFLAG_USERPTR | SFLAG_INSYSMEM);
if (surface->flags & SFLAG_CLIENT)
surface_release_client_storage(surface);
if (!mem)
{
surface->resource.allocatedMemory = NULL;
surface->flags &= ~(SFLAG_USERPTR | SFLAG_INSYSMEM);
if (surface->flags & SFLAG_CLIENT)
surface_release_client_storage(surface);
surface_prepare_system_memory(surface);
}
surface_prepare_system_memory(surface);
surface_modify_location(surface, SFLAG_INSYSMEM, TRUE);
}
......
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