Mesa (main): vulkan/runtime: Add min_lod to vk_image_view

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 31 14:11:28 UTC 2022


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

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Dec  8 16:45:33 2021 -0600

vulkan/runtime: Add min_lod to vk_image_view

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14129>

---

 src/vulkan/runtime/vk_image.c | 14 ++++++++++++++
 src/vulkan/runtime/vk_image.h |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/src/vulkan/runtime/vk_image.c b/src/vulkan/runtime/vk_image.c
index e649618bd57..42bc307eec4 100644
--- a/src/vulkan/runtime/vk_image.c
+++ b/src/vulkan/runtime/vk_image.c
@@ -395,6 +395,20 @@ vk_image_view_init(struct vk_device *device,
    image_view->base_array_layer = range->baseArrayLayer;
    image_view->layer_count = vk_image_subresource_layer_count(image, range);
 
+   const VkImageViewMinLodCreateInfoEXT *min_lod_info =
+      vk_find_struct_const(pCreateInfo, IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT);
+   image_view->min_lod = min_lod_info ? min_lod_info->minLod : 0.0f;
+
+   /* From the Vulkan 1.3.215 spec:
+    *
+    *    VUID-VkImageViewMinLodCreateInfoEXT-minLod-06456
+    *
+    *    "minLod must be less or equal to the index of the last mipmap level
+    *    accessible to the view."
+    */
+   assert(image_view->min_lod <= image_view->base_mip_level +
+                                 image_view->level_count - 1);
+
    image_view->extent =
       vk_image_mip_level_extent(image, image_view->base_mip_level);
 
diff --git a/src/vulkan/runtime/vk_image.h b/src/vulkan/runtime/vk_image.h
index 58e32ad36e2..fe8ed1e493f 100644
--- a/src/vulkan/runtime/vk_image.h
+++ b/src/vulkan/runtime/vk_image.h
@@ -202,6 +202,9 @@ struct vk_image_view {
    uint32_t base_array_layer;
    uint32_t layer_count;
 
+   /* VK_EXT_image_view_min_lod */
+   float min_lod;
+
    /* Image extent at LOD 0 */
    VkExtent3D extent;
 



More information about the mesa-commit mailing list