wined3d: Do not call wined3d_buffer_map() before "buffer->maps" is initialized.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-05-27 11:03:54 +02:00 committed by Alexandre Julliard
parent d39560f33f
commit 0dcf255b51
1 changed files with 9 additions and 11 deletions

View File

@ -1331,17 +1331,6 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
buffer->flags |= WINED3D_BUFFER_CREATEBO;
}
if (data)
{
if (FAILED(hr = wined3d_buffer_upload_data(buffer, NULL, data->data)))
{
ERR("Failed to upload data, hr %#x.\n", hr);
buffer_unload(&buffer->resource);
resource_cleanup(&buffer->resource);
return hr;
}
}
if (!(buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps))))
{
ERR("Out of memory.\n");
@ -1351,6 +1340,15 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
}
buffer->maps_size = 1;
if (data && FAILED(hr = wined3d_buffer_upload_data(buffer, NULL, data->data)))
{
ERR("Failed to upload data, hr %#x.\n", hr);
buffer_unload(&buffer->resource);
resource_cleanup(&buffer->resource);
HeapFree(GetProcessHeap(), 0, buffer->maps);
return hr;
}
return WINED3D_OK;
}