Skip to content

Commit

Permalink
winevulkan: Use handle map for memory objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjacek authored and julliard committed Feb 29, 2024
1 parent 84e4620 commit 6491484
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dlls/winevulkan/vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,7 @@ VkResult wine_vkAllocateMemory(VkDevice handle, const VkMemoryAllocateInfo *allo
return result;
}

WINE_VK_ADD_NON_DISPATCHABLE_MAPPING(device->phys_dev->instance, memory, memory->host_memory, memory);
memory->vm_map = mapping;
*ret = (VkDeviceMemory)(uintptr_t)memory;
return VK_SUCCESS;
Expand All @@ -1717,6 +1718,7 @@ void wine_vkFreeMemory(VkDevice handle, VkDeviceMemory memory_handle, const VkAl
return;
memory = wine_device_memory_from_handle(memory_handle);

WINE_VK_REMOVE_HANDLE_MAPPING(device->phys_dev->instance, memory);
device->funcs.p_vkFreeMemory(device->host_device, memory->host_memory, NULL);

if (memory->vm_map)
Expand Down
2 changes: 2 additions & 0 deletions dlls/winevulkan/vulkan_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ struct wine_device_memory
{
VkDeviceMemory host_memory;
void *vm_map;

struct wine_vk_mapping mapping;
};

static inline struct wine_device_memory *wine_device_memory_from_handle(VkDeviceMemory handle)
Expand Down

0 comments on commit 6491484

Please sign in to comment.