=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Call wined3d_cs_emit_update_sub_resource() directly in buffer_init().
Alexandre Julliard
julliard at winehq.org
Wed Jun 20 17:13:13 CDT 2018
Module: wine
Branch: master
Commit: bb535b1a2d5a9164353d7d89db18f05526050043
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bb535b1a2d5a9164353d7d89db18f05526050043
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Tue Jun 19 17:15:01 2018 +0200
wined3d: Call wined3d_cs_emit_update_sub_resource() directly in buffer_init().
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/buffer.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 4b14d68..181be6b 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1325,6 +1325,8 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id, usage);
+ struct wined3d_resource *resource = &buffer->resource;
+ struct wined3d_box box;
BOOL dynamic_buffer_ok;
HRESULT hr;
@@ -1346,7 +1348,7 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
return E_INVALIDARG;
}
- if (FAILED(hr = resource_init(&buffer->resource, device, WINED3D_RTYPE_BUFFER, format, WINED3D_MULTISAMPLE_NONE,
+ if (FAILED(hr = resource_init(resource, device, WINED3D_RTYPE_BUFFER, format, WINED3D_MULTISAMPLE_NONE,
0, usage, access, size, 1, 1, size, parent, parent_ops, &buffer_resource_ops)))
{
WARN("Failed to initialize resource, hr %#x.\n", hr);
@@ -1386,7 +1388,7 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
{
TRACE("Not creating a BO because the buffer is not GPU accessible.\n");
}
- else if (!dynamic_buffer_ok && (buffer->resource.usage & WINED3DUSAGE_DYNAMIC))
+ else if (!dynamic_buffer_ok && (resource->usage & WINED3DUSAGE_DYNAMIC))
{
TRACE("Not creating a BO because the buffer has dynamic usage and no GL support.\n");
}
@@ -1398,16 +1400,19 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
if (!(buffer->maps = heap_alloc(sizeof(*buffer->maps))))
{
ERR("Out of memory.\n");
- buffer_unload(&buffer->resource);
- resource_cleanup(&buffer->resource);
- wined3d_resource_wait_idle(&buffer->resource);
+ buffer_unload(resource);
+ resource_cleanup(resource);
+ wined3d_resource_wait_idle(resource);
return E_OUTOFMEMORY;
}
buffer->maps_size = 1;
if (data)
- wined3d_device_update_sub_resource(device, &buffer->resource,
- 0, NULL, data->data, data->row_pitch, data->slice_pitch, 0);
+ {
+ wined3d_box_set(&box, 0, 0, resource->size, 1, 0, 1);
+ wined3d_cs_emit_update_sub_resource(device->cs, resource,
+ 0, &box, data->data, data->row_pitch, data->slice_pitch);
+ }
return WINED3D_OK;
}
More information about the wine-cvs
mailing list