Commit eec2f1db authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Try to avoid allocating sysmem for GPU buffers with initial data.

parent 8abb76f4
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment