Module: wine Branch: master Commit: 4b1ba0e02d62399298fcad276b7c6d9377937b1f URL: http://source.winehq.org/git/wine.git/?a=commit;h=4b1ba0e02d62399298fcad276b...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Aug 23 20:08:05 2011 +0200
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.
---
dlls/wined3d/surface.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 1cafe03..17edbdc 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -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); }