vulkan: Add a vk_image_view_subresource_range helper
authorJason Ekstrand <jason.ekstrand@collabora.com>
Wed, 23 Mar 2022 22:52:55 +0000 (17:52 -0500)
committerMarge Bot <emma+marge@anholt.net>
Thu, 24 Mar 2022 21:21:10 +0000 (21:21 +0000)
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15535>

src/vulkan/runtime/vk_image.h

index fb58cbf..af141fc 100644 (file)
@@ -224,6 +224,18 @@ void vk_image_view_destroy(struct vk_device *device,
                            const VkAllocationCallbacks *alloc,
                            struct vk_image_view *image_view);
 
+static inline VkImageSubresourceRange
+vk_image_view_subresource_range(const struct vk_image_view *view)
+{
+   return (VkImageSubresourceRange) {
+      .aspectMask = view->aspects,
+      .baseMipLevel = view->base_mip_level,
+      .levelCount = view->level_count,
+      .baseArrayLayer = view->base_array_layer,
+      .layerCount = view->layer_count,
+   };
+}
+
 bool vk_image_layout_is_read_only(VkImageLayout layout,
                                   VkImageAspectFlagBits aspect);
 bool vk_image_layout_is_depth_only(VkImageLayout layout);