panvk: implement VK_EXT_image_view_min_lod

Pass the per-image-view minimum LOD clamp from the Vulkan runtime
(vk_image_view::min_lod) through pan_image_view into the Mali texture
descriptor's Minimum LOD field.

Mali v6+ hardware has per-texture-descriptor LOD clamp fields that
operate independently from the sampler's LOD clamps, so no shader
lowering or descriptor merging is needed.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39938>
This commit is contained in:
Christian Gmeiner 2026-02-17 12:39:48 +01:00
parent 0e32fbc305
commit 594b1c18bf
6 changed files with 9 additions and 5 deletions

View file

@ -646,7 +646,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_image_compression_control DONE (anv/gfx12-, radv)
VK_EXT_image_drm_format_modifier DONE (anv, hasvk, hk, lvp, nvk, panvk, pvr, radv/gfx9+, tu, v3dv, vn)
VK_EXT_image_sliced_view_of_3d DONE (anv, hk, lvp, nvk, radv/gfx10+, vn)
VK_EXT_image_view_min_lod DONE (anv, hasvk, hk, nvk, radv, tu, vn)
VK_EXT_image_view_min_lod DONE (anv, hasvk, hk, nvk, panvk, radv, tu, vn)
VK_EXT_index_type_uint8 DONE (anv, hasvk, hk, nvk, lvp, panvk, pvr, radv/gfx8+, tu, v3dv, vn)
VK_EXT_legacy_vertex_attributes DONE (anv, lvp, nvk, radv, tu, vn)
VK_EXT_line_rasterization DONE (anv, hasvk, hk, nvk, panvk, pvr, lvp, radv, tu, v3dv, vn)

View file

@ -16,3 +16,4 @@ VK_KHR_swapchain_mutable_format on panvk
VK_EXT_astc_decode_mode on panvk
VK_KHR_copy_memory_indirect on nvk
VK_EXT_color_write_enable on panvk
VK_EXT_image_view_min_lod on panvk

View file

@ -52,6 +52,7 @@ struct pan_image_view {
enum mali_texture_dimension dim;
unsigned first_level, last_level;
unsigned first_layer, last_layer;
float min_lod;
unsigned char swizzle[4];
/* planes 1 and 2 are NULL for single plane formats */

View file

@ -1258,10 +1258,7 @@ GENX(pan_sampled_texture_emit)(const struct pan_image_view *iview,
#if PAN_ARCH >= 6
cfg.surfaces = payload->gpu;
/* We specify API-level LOD clamps in the sampler descriptor
* and use these clamps simply for bounds checking.
*/
cfg.minimum_lod = 0;
cfg.minimum_lod = MAX2(0.0f, iview->min_lod - iview->first_level);
cfg.maximum_lod = cfg.levels - 1;
#endif
}

View file

@ -360,6 +360,7 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
: view->vk.base_mip_level + view->vk.level_count - 1,
.first_layer = view->vk.base_array_layer,
.last_layer = view->vk.base_array_layer + view->vk.layer_count - 1,
.min_lod = view->vk.min_lod,
};
panvk_convert_swizzle(&view->vk.swizzle, view->pview.swizzle);

View file

@ -158,6 +158,7 @@ panvk_per_arch(get_physical_device_extensions)(
/* EXT_image_drm_format_modifier depends on KHR_sampler_ycbcr_conversion */
.EXT_image_drm_format_modifier = true,
.EXT_image_robustness = true,
.EXT_image_view_min_lod = true,
.EXT_index_type_uint8 = true,
.EXT_line_rasterization = true,
.EXT_load_store_op_none = true,
@ -488,6 +489,9 @@ panvk_per_arch(get_physical_device_features)(
.image2DViewOf3D = true,
.sampler2DViewOf3D = true,
/* VK_EXT_image_view_min_lod */
.minLod = true,
/* VK_EXT_primitive_topology_list_restart */
.primitiveTopologyListRestart = true,
.primitiveTopologyPatchListRestart = false,