wined3d: Map Vulkan adapter bo's persistently on 64-bit architectures.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Henri Verbeet 2020-05-29 20:33:33 +04:30 committed by Alexandre Julliard
parent d777b9492d
commit 859514a684
3 changed files with 15 additions and 0 deletions

View File

@ -844,6 +844,9 @@ static void *wined3d_bo_vk_map(struct wined3d_bo_vk *bo, struct wined3d_context_
void *map_ptr; void *map_ptr;
VkResult vr; VkResult vr;
if (bo->map_ptr)
return bo->map_ptr;
vk_info = context_vk->vk_info; vk_info = context_vk->vk_info;
device_vk = wined3d_device_vk(context_vk->c.device); device_vk = wined3d_device_vk(context_vk->c.device);
@ -872,6 +875,9 @@ static void *wined3d_bo_vk_map(struct wined3d_bo_vk *bo, struct wined3d_context_
return NULL; return NULL;
} }
if (sizeof(map_ptr) >= sizeof(uint64_t))
bo->map_ptr = map_ptr;
return map_ptr; return map_ptr;
} }
@ -881,6 +887,9 @@ static void wined3d_bo_vk_unmap(struct wined3d_bo_vk *bo, struct wined3d_context
struct wined3d_device_vk *device_vk; struct wined3d_device_vk *device_vk;
struct wined3d_bo_slab_vk *slab; struct wined3d_bo_slab_vk *slab;
if (bo->map_ptr)
return;
if ((slab = bo->slab)) if ((slab = bo->slab))
{ {
if (--slab->map_count) if (--slab->map_count)

View File

@ -483,6 +483,7 @@ BOOL wined3d_context_vk_create_bo(struct wined3d_context_vk *context_vk, VkDevic
return FALSE; return FALSE;
} }
bo->map_ptr = NULL;
bo->buffer_offset = 0; bo->buffer_offset = 0;
bo->size = size; bo->size = size;
bo->usage = usage; bo->usage = usage;
@ -791,6 +792,8 @@ void wined3d_context_vk_destroy_sampler(struct wined3d_context_vk *context_vk,
void wined3d_context_vk_destroy_bo(struct wined3d_context_vk *context_vk, const struct wined3d_bo_vk *bo) void wined3d_context_vk_destroy_bo(struct wined3d_context_vk *context_vk, const struct wined3d_bo_vk *bo)
{ {
struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device);
const struct wined3d_vk_info *vk_info = context_vk->vk_info;
size_t object_size, idx; size_t object_size, idx;
TRACE("context_vk %p, bo %p.\n", context_vk, bo); TRACE("context_vk %p, bo %p.\n", context_vk, bo);
@ -810,6 +813,8 @@ void wined3d_context_vk_destroy_bo(struct wined3d_context_vk *context_vk, const
return; return;
} }
if (bo->map_ptr)
VK_CALL(vkUnmapMemory(device_vk->vk_device, bo->vk_memory));
wined3d_context_vk_destroy_memory(context_vk, bo->vk_memory, bo->command_buffer_id); wined3d_context_vk_destroy_memory(context_vk, bo->vk_memory, bo->command_buffer_id);
} }

View File

@ -1554,6 +1554,7 @@ struct wined3d_bo_vk
struct wined3d_bo_slab_vk *slab; struct wined3d_bo_slab_vk *slab;
VkDeviceMemory vk_memory; VkDeviceMemory vk_memory;
void *map_ptr;
VkDeviceSize buffer_offset; VkDeviceSize buffer_offset;
VkDeviceSize memory_offset; VkDeviceSize memory_offset;