[PATCH 3/3] wined3d: Handle unmappable buffers in wined3d_device_process_vertices() gracefully.
Józef Kucia
joseph.kucia at gmail.com
Tue Dec 25 06:24:36 CST 2018
From: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
This doesn't fix the process vertices regression, but at least it avoids
crashes in wined3d_device_process_vertices().
---
dlls/wined3d/device.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c90cbdbe10fe..d03a982e747e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3340,7 +3340,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
struct wined3d_resource *resource;
struct wined3d_box box = {0};
struct wined3d_shader *vs;
- unsigned int i;
+ unsigned int i, j;
HRESULT hr;
WORD map;
@@ -3375,7 +3375,20 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
box.left = src_start_idx * e->stride;
box.right = box.left + vertex_count * e->stride;
if (FAILED(wined3d_resource_map(resource, 0, &map_desc, &box, WINED3D_MAP_READ)))
+ {
ERR("Failed to map resource.\n");
+ for (j = 0, map = stream_info.use_map; map && j < i; map >>= 1, ++j)
+ {
+ if (!(map & 1))
+ continue;
+
+ e = &stream_info.elements[j];
+ resource = &state->streams[e->stream_idx].buffer->resource;
+ if (FAILED(wined3d_resource_unmap(resource, 0)))
+ ERR("Failed to unmap resource.\n");
+ }
+ return WINED3DERR_INVALIDCALL;
+ }
e->data.buffer_object = 0;
e->data.addr += (ULONG_PTR)map_desc.data;
}
--
2.20.1
More information about the wine-devel
mailing list