From fb8ba9d3b9bc8595e4b94146c71ba96147b609cc Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 2 May 2023 13:34:44 +0200 Subject: [PATCH] vulkan/runtime: add common implementation for GetImageSubresourceLayout() Signed-off-by: Samuel Pitoiset Reviewed-by: Faith Ekstrand Reviewed-by: Lionel Landwerlin Part-of: --- src/vulkan/runtime/vk_image.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/vulkan/runtime/vk_image.c b/src/vulkan/runtime/vk_image.c index e15d8d4..48e00dc 100644 --- a/src/vulkan/runtime/vk_image.c +++ b/src/vulkan/runtime/vk_image.c @@ -162,6 +162,28 @@ vk_common_GetImageDrmFormatModifierPropertiesEXT(UNUSED VkDevice device, } #endif +VKAPI_ATTR void VKAPI_CALL +vk_common_GetImageSubresourceLayout(VkDevice _device, VkImage _image, + const VkImageSubresource *pSubresource, + VkSubresourceLayout *pLayout) +{ + VK_FROM_HANDLE(vk_device, device, _device); + + const VkImageSubresource2KHR subresource = { + .sType = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR, + .imageSubresource = *pSubresource, + }; + + VkSubresourceLayout2KHR layout = { + .sType = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR + }; + + device->dispatch_table.GetImageSubresourceLayout2KHR(_device, _image, + &subresource, &layout); + + *pLayout = layout.subresourceLayout; +} + void vk_image_set_format(struct vk_image *image, VkFormat format) { -- 2.7.4