wined3d: Evict system memory for dynamic buffers on the first WINED3D_MAP_DISCARD map.

Mostly to avoid making things worse for applications that map dynamic buffers
without WINED3D_MAP_DISCARD/WINED3D_MAP_NOOVERWRITE.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2017-01-30 13:04:39 +01:00 committed by Alexandre Julliard
parent a5f7aff3bb
commit efdb898bef
1 changed files with 5 additions and 1 deletions

View File

@ -994,8 +994,9 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *
}
wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER);
if (buffer->resource.heap_memory)
if (buffer->resource.heap_memory && !(buffer->resource.usage & WINED3DUSAGE_DYNAMIC))
wined3d_buffer_evict_sysmem(buffer);
}
struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
@ -1055,6 +1056,9 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI
if (!(flags & WINED3D_MAP_READONLY))
buffer_invalidate_bo_range(buffer, dirty_offset, dirty_size);
if ((flags & WINED3D_MAP_DISCARD) && buffer->resource.heap_memory)
wined3d_buffer_evict_sysmem(buffer);
if (count == 1)
{
const struct wined3d_gl_info *gl_info;