From 7a18b2473f923f22f2038bb273b5bcc52735c1a6 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 27 Jan 2017 11:36:34 +0100 Subject: [PATCH] wined3d: Introduce wined3d_buffer_evict_sysmem(). For consistency with the texture code. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/buffer.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 2d0303f8ce6..5303d0917c5 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -40,6 +40,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); #define VB_MAXFULLCONVERSIONS 5 /* Number of full conversions before we stop converting */ #define VB_RESETFULLCONVS 20 /* Reset full conversion counts after that number of draws */ +static void wined3d_buffer_evict_sysmem(struct wined3d_buffer *buffer) +{ + if (buffer->flags & WINED3D_BUFFER_PIN_SYSMEM) + { + TRACE("Not evicting system memory for buffer %p.\n", buffer); + return; + } + + TRACE("Evicting system memory for buffer %p.\n", buffer); + wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_SYSMEM); + wined3d_resource_free_sysmem(&buffer->resource); +} + static void buffer_invalidate_bo_range(struct wined3d_buffer *buffer, unsigned int offset, unsigned int size) { if (!offset && (!size || size == buffer->resource.size)) @@ -250,15 +263,11 @@ static BOOL buffer_create_buffer_object(struct wined3d_buffer *buffer, struct wi buffer->buffer_object_usage = gl_usage; if (buffer->flags & WINED3D_BUFFER_PIN_SYSMEM) - { buffer_invalidate_bo_range(buffer, 0, 0); - } else - { - wined3d_resource_free_sysmem(&buffer->resource); wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER); - wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_SYSMEM); - } + + wined3d_buffer_evict_sysmem(buffer); return TRUE; -- 2.11.4.GIT