Mesa (main): anv: implement vkGetDeviceImageMemoryRequirementsKHR

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 6 02:41:06 UTC 2021


Module: Mesa
Branch: main
Commit: 4075dd16ab8ceb1abd852e685118e88a8c4cd749
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4075dd16ab8ceb1abd852e685118e88a8c4cd749

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Wed Jul 28 14:36:45 2021 +0300

anv: implement vkGetDeviceImageMemoryRequirementsKHR

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

---

 src/intel/vulkan/anv_image.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 7f152fe085e..273f79f3926 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -53,8 +53,8 @@ memory_range_end(struct anv_image_memory_range memory_range)
 }
 
 /**
- * Get binding for VkImagePlaneMemoryRequirementsInfo and
- * VkBindImagePlaneMemoryInfo.
+ * Get binding for VkImagePlaneMemoryRequirementsInfo,
+ * VkBindImagePlaneMemoryInfo and VkDeviceImageMemoryRequirementsKHR.
  */
 static struct anv_image_binding *
 image_aspect_to_binding(struct anv_image *image, VkImageAspectFlags aspect)
@@ -1687,6 +1687,25 @@ void anv_GetImageMemoryRequirements2(
                                      pMemoryRequirements);
 }
 
+void anv_GetDeviceImageMemoryRequirementsKHR(
+    VkDevice                                    _device,
+    const VkDeviceImageMemoryRequirementsKHR*   pInfo,
+    VkMemoryRequirements2*                      pMemoryRequirements)
+{
+   ANV_FROM_HANDLE(anv_device, device, _device);
+   struct anv_image image = { 0 };
+
+   ASSERTED VkResult result =
+      anv_image_init_from_create_info(device, &image, pInfo->pCreateInfo);
+   assert(result == VK_SUCCESS);
+
+   VkImageAspectFlags aspects =
+      image.disjoint ? pInfo->planeAspect : image.vk.aspects;
+
+   anv_image_get_memory_requirements(device, &image, aspects,
+                                     pMemoryRequirements);
+}
+
 void anv_GetImageSparseMemoryRequirements(
     VkDevice                                    device,
     VkImage                                     image,



More information about the mesa-commit mailing list