Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/buffer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 639a145f881b..f381b2efb941 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1379,9 +1379,6 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer->bind_flags = bind_flags; buffer->locations = data ? WINED3D_LOCATION_DISCARDED : WINED3D_LOCATION_SYSMEM;
- if (!wined3d_resource_allocate_sysmem(&buffer->resource)) - return E_OUTOFMEMORY; - TRACE("buffer %p, size %#x, usage %#x, format %s, memory @ %p.\n", buffer, buffer->resource.size, buffer->resource.usage, debug_d3dformat(buffer->resource.format->id), buffer->resource.heap_memory); @@ -1394,6 +1391,7 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device * the buffer to provide the same behavior to the application. */ TRACE("Pinning system memory.\n"); buffer->flags |= WINED3D_BUFFER_PIN_SYSMEM; + buffer->locations = WINED3D_LOCATION_SYSMEM; }
/* Observations show that draw_primitive_immediate_mode() is faster on @@ -1418,6 +1416,12 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device buffer->flags |= WINED3D_BUFFER_USE_BO; }
+ if (buffer->locations & WINED3D_LOCATION_SYSMEM || !(buffer->flags & WINED3D_BUFFER_USE_BO)) + { + if (!wined3d_resource_allocate_sysmem(&buffer->resource)) + return E_OUTOFMEMORY; + } + if (!(buffer->maps = heap_alloc(sizeof(*buffer->maps)))) { ERR("Out of memory.\n");