v3dv: implement vkGetDeviceImageMemoryRequirementsKHR
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 25 Aug 2022 07:23:14 +0000 (09:23 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 30 Aug 2022 11:10:14 +0000 (11:10 +0000)
Added with KHR_maintenance4.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18246>

src/broadcom/vulkan/v3dv_device.c

index 017a128..f788be9 100644 (file)
@@ -2494,6 +2494,24 @@ v3dv_GetImageMemoryRequirements2(VkDevice device,
    get_image_memory_requirements(image, pMemoryRequirements);
 }
 
+VKAPI_ATTR void VKAPI_CALL
+v3dv_GetDeviceImageMemoryRequirementsKHR(
+    VkDevice _device,
+    const VkDeviceImageMemoryRequirements *pInfo,
+    VkMemoryRequirements2 *pMemoryRequirements)
+{
+   V3DV_FROM_HANDLE(v3dv_device, device, _device);
+
+   struct v3dv_image image = { 0 };
+   vk_image_init(&device->vk, &image.vk, pInfo->pCreateInfo);
+
+   ASSERTED VkResult result =
+      v3dv_image_init(device, pInfo->pCreateInfo, NULL, &image);
+   assert(result == VK_SUCCESS);
+
+   get_image_memory_requirements(&image, pMemoryRequirements);
+}
+
 static void
 bind_image_memory(const VkBindImageMemoryInfo *info)
 {