Module: wine Branch: master Commit: 6e7779ace9aa3ca709e01d94339b2e4bc12fd10b URL: https://source.winehq.org/git/wine.git/?a=commit;h=6e7779ace9aa3ca709e01d943...
Author: Zebediah Figura zfigura@codeweavers.com Date: Thu Oct 14 23:44:18 2021 -0500
wined3d: Move the "map_ptr" field from struct wined3d_bo_vk to struct wined3d_bo.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wined3d/adapter_vk.c | 14 +++++++------- dlls/wined3d/context_gl.c | 1 + dlls/wined3d/context_vk.c | 8 ++++---- dlls/wined3d/wined3d_private.h | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index ffeffb4d145..c7005835d16 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -775,15 +775,15 @@ static void *wined3d_bo_vk_map(struct wined3d_bo_vk *bo, struct wined3d_context_ struct wined3d_bo_slab_vk *slab; VkResult vr;
- if (bo->map_ptr) - return bo->map_ptr; + if (bo->b.map_ptr) + return bo->b.map_ptr;
vk_info = context_vk->vk_info; device_vk = wined3d_device_vk(context_vk->c.device);
if ((slab = bo->slab)) { - if (!(bo->map_ptr = wined3d_bo_slab_vk_map(slab, context_vk))) + if (!(bo->b.map_ptr = wined3d_bo_slab_vk_map(slab, context_vk))) { ERR("Failed to map slab.\n"); return NULL; @@ -793,19 +793,19 @@ static void *wined3d_bo_vk_map(struct wined3d_bo_vk *bo, struct wined3d_context_ { struct wined3d_allocator_chunk_vk *chunk_vk = wined3d_allocator_chunk_vk(bo->memory->chunk);
- if (!(bo->map_ptr = wined3d_allocator_chunk_vk_map(chunk_vk, context_vk))) + if (!(bo->b.map_ptr = wined3d_allocator_chunk_vk_map(chunk_vk, context_vk))) { ERR("Failed to map chunk.\n"); return NULL; } } - else if ((vr = VK_CALL(vkMapMemory(device_vk->vk_device, bo->vk_memory, 0, VK_WHOLE_SIZE, 0, &bo->map_ptr))) < 0) + else if ((vr = VK_CALL(vkMapMemory(device_vk->vk_device, bo->vk_memory, 0, VK_WHOLE_SIZE, 0, &bo->b.map_ptr))) < 0) { ERR("Failed to map memory, vr %s.\n", wined3d_debug_vkresult(vr)); return NULL; }
- return bo->map_ptr; + return bo->b.map_ptr; }
static void wined3d_bo_vk_unmap(struct wined3d_bo_vk *bo, struct wined3d_context_vk *context_vk) @@ -817,7 +817,7 @@ static void wined3d_bo_vk_unmap(struct wined3d_bo_vk *bo, struct wined3d_context if (wined3d_map_persistent()) return;
- bo->map_ptr = NULL; + bo->b.map_ptr = NULL;
if ((slab = bo->slab)) { diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 2bc63464f7b..5cde971cd43 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2893,6 +2893,7 @@ bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizei list_init(&bo->b.users); bo->command_fence_id = 0; bo->b.memory_offset = 0; + bo->b.map_ptr = NULL;
return true; } diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 8e055202ec2..8bcd6d61eb3 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -487,7 +487,7 @@ BOOL wined3d_context_vk_create_bo(struct wined3d_context_vk *context_vk, VkDevic return FALSE; }
- bo->map_ptr = NULL; + bo->b.map_ptr = NULL; bo->buffer_offset = 0; bo->size = size; bo->usage = usage; @@ -907,7 +907,7 @@ void wined3d_context_vk_destroy_bo(struct wined3d_context_vk *context_vk, const
if ((slab_vk = bo->slab)) { - if (bo->map_ptr) + if (bo->b.map_ptr) wined3d_bo_slab_vk_unmap(slab_vk, context_vk); object_size = slab_vk->bo.size / 32; idx = bo->buffer_offset / object_size; @@ -918,13 +918,13 @@ void wined3d_context_vk_destroy_bo(struct wined3d_context_vk *context_vk, const wined3d_context_vk_destroy_vk_buffer(context_vk, bo->vk_buffer, bo->command_buffer_id); if (bo->memory) { - if (bo->map_ptr) + if (bo->b.map_ptr) wined3d_allocator_chunk_vk_unmap(wined3d_allocator_chunk_vk(bo->memory->chunk), context_vk); wined3d_context_vk_destroy_allocator_block(context_vk, bo->memory, bo->command_buffer_id); return; }
- if (bo->map_ptr) + if (bo->b.map_ptr) VK_CALL(vkUnmapMemory(device_vk->vk_device, bo->vk_memory)); wined3d_context_vk_destroy_vk_memory(context_vk, bo->vk_memory, bo->command_buffer_id); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 993d0b3c4e4..1f167c9e7dd 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1591,6 +1591,7 @@ do { \ struct wined3d_bo { struct list users; + void *map_ptr; size_t memory_offset; bool coherent; }; @@ -1628,7 +1629,6 @@ struct wined3d_bo_vk struct wined3d_bo_slab_vk *slab;
VkDeviceMemory vk_memory; - void *map_ptr;
VkDeviceSize buffer_offset; VkDeviceSize size;