From e500faebc259a4db8ae689a09c0396cd1a9eeaa3 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 23 Mar 2022 17:52:55 -0500 Subject: [PATCH] vulkan: Add a vk_image_view_subresource_range helper Reviewed-By: Mike Blumenkrantz Part-of: --- src/vulkan/runtime/vk_image.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vulkan/runtime/vk_image.h b/src/vulkan/runtime/vk_image.h index fb58cbf1783..af141fc4eea 100644 --- a/src/vulkan/runtime/vk_image.h +++ b/src/vulkan/runtime/vk_image.h @@ -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);