Henri Verbeet : wined3d: Do not pin system memory in wined3d_buffer_load_location().
Module: wine Branch: master Commit: 15d53761a5fbfc12fc5f9974c029dace00eab33d URL: http://source.winehq.org/git/wine.git/?a=commit;h=15d53761a5fbfc12fc5f9974c0... Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Tue Jan 31 15:47:10 2017 +0100 wined3d: Do not pin system memory in wined3d_buffer_load_location(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/buffer.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 6b48d98..2f82469 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -604,7 +604,6 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, GL_EXTCALL(glGetBufferSubData(buffer->buffer_type_hint, 0, buffer->resource.size, buffer->resource.heap_memory)); checkGLcall("buffer download"); - buffer->flags |= WINED3D_BUFFER_PIN_SYSMEM; break; case WINED3D_LOCATION_BUFFER: @@ -623,7 +622,8 @@ BOOL wined3d_buffer_load_location(struct wined3d_buffer *buffer, /* Context activation is done by the caller. */ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_context *context) { - wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM); + if (wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM)) + buffer->flags |= WINED3D_BUFFER_PIN_SYSMEM; return buffer->resource.heap_memory; } @@ -655,7 +655,6 @@ DWORD wined3d_buffer_get_memory(struct wined3d_buffer *buffer, static void buffer_unload(struct wined3d_resource *resource) { struct wined3d_buffer *buffer = buffer_from_resource(resource); - DWORD flags = buffer->flags; TRACE("buffer %p.\n", buffer); @@ -665,11 +664,7 @@ static void buffer_unload(struct wined3d_resource *resource) context = context_acquire(resource->device, NULL); - /* Download the buffer, but don't permanently enable double buffering. */ wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM); - if (!(flags & WINED3D_BUFFER_PIN_SYSMEM)) - buffer->flags &= ~WINED3D_BUFFER_PIN_SYSMEM; - wined3d_buffer_invalidate_location(buffer, WINED3D_LOCATION_BUFFER); buffer_destroy_buffer_object(buffer, context); buffer_clear_dirty_areas(buffer); @@ -825,7 +820,12 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined unsigned int i, j, range_idx, start, end, vertex_count; BYTE *data; - wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM); + if (!wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM)) + { + ERR("Failed to load system memory.\n"); + return; + } + buffer->flags |= WINED3D_BUFFER_PIN_SYSMEM; /* Now for each vertex in the buffer that needs conversion. */ vertex_count = buffer->resource.size / buffer->stride; @@ -1106,6 +1106,7 @@ static HRESULT wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UI { TRACE("Falling back to doublebuffered operation.\n"); wined3d_buffer_load_location(buffer, context, WINED3D_LOCATION_SYSMEM); + buffer->flags |= WINED3D_BUFFER_PIN_SYSMEM; } TRACE("New pointer is %p.\n", buffer->resource.heap_memory); buffer->map_ptr = NULL;
participants (1)
-
Alexandre Julliard