tu: Implement VK_KHR_map_memory2

Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28080>
This commit is contained in:
Valentine Burley
2024-03-08 09:42:00 +00:00
committed by Marge Bot
parent e7de9ab62a
commit 355dd782c5
2 changed files with 8 additions and 11 deletions

View File

@@ -659,7 +659,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_swapchain_colorspace DONE (radv, anv, tu)
VK_EXT_depth_clamp_zero_one DONE (anv, radv)
VK_INTEL_shader_integer_functions2 DONE (anv, hasvk, radv)
VK_KHR_map_memory2 DONE (anv, nvk, radv)
VK_KHR_map_memory2 DONE (anv, nvk, radv, tu)

View File

@@ -172,6 +172,7 @@ get_device_extensions(const struct tu_physical_device *device,
.KHR_maintenance3 = true,
.KHR_maintenance4 = true,
.KHR_maintenance5 = true,
.KHR_map_memory2 = true,
.KHR_multiview = TU_DEBUG(NOCONFORM) ? true : device->info->a6xx.has_hw_multiview,
.KHR_performance_query = TU_DEBUG(PERFC),
.KHR_pipeline_executable_properties = true,
@@ -2857,15 +2858,10 @@ tu_FreeMemory(VkDevice _device,
}
VKAPI_ATTR VkResult VKAPI_CALL
tu_MapMemory(VkDevice _device,
VkDeviceMemory _memory,
VkDeviceSize offset,
VkDeviceSize size,
VkMemoryMapFlags flags,
void **ppData)
tu_MapMemory2KHR(VkDevice _device, const VkMemoryMapInfoKHR *pMemoryMapInfo, void **ppData)
{
TU_FROM_HANDLE(tu_device, device, _device);
TU_FROM_HANDLE(tu_device_memory, mem, _memory);
TU_FROM_HANDLE(tu_device_memory, mem, pMemoryMapInfo->memory);
VkResult result;
if (mem == NULL) {
@@ -2879,14 +2875,15 @@ tu_MapMemory(VkDevice _device,
return result;
}
*ppData = (char *) mem->bo->map + offset;
*ppData = (char *) mem->bo->map + pMemoryMapInfo->offset;
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL
tu_UnmapMemory(VkDevice _device, VkDeviceMemory _memory)
VKAPI_ATTR VkResult VKAPI_CALL
tu_UnmapMemory2KHR(VkDevice _device, const VkMemoryUnmapInfoKHR *pMemoryUnmapInfo)
{
/* TODO: unmap here instead of waiting for FreeMemory */
return VK_SUCCESS;
}
static void