This will silently succeed, and incorrectly unmap chunks which are still in use.
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 2131123bf44..a3c725136dd 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1185,7 +1185,8 @@ void wined3d_buffer_update_sub_resource(struct wined3d_buffer *buffer, struct wi */ range.offset = offset; range.size = size; - wined3d_context_unmap_bo_address(context, (const struct wined3d_bo_address *)&upload_bo->addr, 1, &range); + if (upload_bo->addr.buffer_object->map_ptr) + wined3d_context_unmap_bo_address(context, (const struct wined3d_bo_address *)&upload_bo->addr, 1, &range); } else {
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/texture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 50049f96d71..39ef6376203 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -4737,7 +4737,8 @@ void wined3d_texture_update_sub_resource(struct wined3d_texture *texture, unsign wined3d_texture_validate_location(texture, sub_resource_idx, WINED3D_LOCATION_BUFFER); wined3d_texture_invalidate_location(texture, sub_resource_idx, ~WINED3D_LOCATION_BUFFER); /* Try to free address space if we are not mapping persistently. */ - wined3d_context_unmap_bo_address(context, (const struct wined3d_bo_address *)&upload_bo->addr, 0, NULL); + if (upload_bo->addr.buffer_object->map_ptr) + wined3d_context_unmap_bo_address(context, (const struct wined3d_bo_address *)&upload_bo->addr, 0, NULL); }
/* Only load the sub-resource for partial updates. */
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/adapter_vk.c | 2 ++ dlls/wined3d/context_gl.c | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 81248d40f46..58671cfb5f9 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -1064,6 +1064,8 @@ static void adapter_vk_unmap_bo_address(struct wined3d_context *context, return; bo = wined3d_bo_vk(data->buffer_object);
+ assert(bo->b.map_ptr); + if (!bo->b.coherent) { for (i = 0; i < range_count; ++i) diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 7679a0ffb20..7f7324c8b91 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -3039,6 +3039,8 @@ void wined3d_context_gl_unmap_bo_address(struct wined3d_context_gl *context_gl, return; bo = wined3d_bo_gl(data->buffer_object);
+ assert(bo->b.map_ptr); + flush_bo_ranges(context_gl, wined3d_const_bo_address(data), range_count, ranges); wined3d_bo_gl_unmap(bo, context_gl); }