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.
This commit is contained in:
Henri Verbeet 2011-08-23 20:08:05 +02:00 committed by Alexandre Julliard
parent 1ad1474be5
commit 4b1ba0e02d
1 changed files with 10 additions and 6 deletions

View File

@ -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);
}