Commit 9992d710 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Unmap the chunk if needed in wined3d_context_vk_destroy_bo().

parent 4e7be889
......@@ -762,7 +762,6 @@ static void *wined3d_bo_vk_map(struct wined3d_bo_vk *bo, struct wined3d_context_
const struct wined3d_vk_info *vk_info;
struct wined3d_device_vk *device_vk;
struct wined3d_bo_slab_vk *slab;
void *map_ptr;
VkResult vr;
if (bo->map_ptr)
......@@ -773,7 +772,7 @@ static void *wined3d_bo_vk_map(struct wined3d_bo_vk *bo, struct wined3d_context_
if ((slab = bo->slab))
{
if (!(map_ptr = slab->map_ptr) && !(map_ptr = wined3d_bo_vk_map(&slab->bo, context_vk)))
if (!(bo->map_ptr = slab->map_ptr) && !(bo->map_ptr = wined3d_bo_vk_map(&slab->bo, context_vk)))
{
ERR("Failed to map slab.\n");
return NULL;
......@@ -784,22 +783,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 (!(map_ptr = wined3d_allocator_chunk_vk_map(chunk_vk, context_vk)))
if (!(bo->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, &map_ptr))) < 0)
else if ((vr = VK_CALL(vkMapMemory(device_vk->vk_device, bo->vk_memory, 0, VK_WHOLE_SIZE, 0, &bo->map_ptr))) < 0)
{
ERR("Failed to map memory, vr %s.\n", wined3d_debug_vkresult(vr));
return NULL;
}
if (sizeof(map_ptr) >= sizeof(uint64_t))
bo->map_ptr = map_ptr;
return map_ptr;
return bo->map_ptr;
}
static void wined3d_bo_vk_unmap(struct wined3d_bo_vk *bo, struct wined3d_context_vk *context_vk)
......@@ -808,9 +804,11 @@ static void wined3d_bo_vk_unmap(struct wined3d_bo_vk *bo, struct wined3d_context
struct wined3d_device_vk *device_vk;
struct wined3d_bo_slab_vk *slab;
if (bo->map_ptr)
if (wined3d_map_persistent())
return;
bo->map_ptr = NULL;
if ((slab = bo->slab))
{
if (--slab->map_count)
......
......@@ -812,6 +812,8 @@ void wined3d_context_vk_destroy_bo(struct wined3d_context_vk *context_vk, const
wined3d_context_vk_destroy_buffer(context_vk, bo->vk_buffer, bo->command_buffer_id);
if (bo->memory)
{
if (bo->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;
}
......
......@@ -6367,6 +6367,11 @@ static inline void wined3d_context_gl_reference_bo(struct wined3d_context_gl *co
bo_gl->command_fence_id = device_gl->current_fence_id;
}
static inline bool wined3d_map_persistent(void)
{
return sizeof(void *) >= sizeof(uint64_t);
}
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment