vulkan/runtime: Add min_lod to vk_image_view

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14129>
This commit is contained in:
Jason Ekstrand 2021-12-08 16:45:33 -06:00 committed by Marge Bot
parent dad36b5f12
commit 56b66abc0b
2 changed files with 17 additions and 0 deletions

View File

@ -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);

View File

@ -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;