panvk: use perf-trilinear when doing anisotropic sampling

This should be faster, and matches what the DDK does.

Reviewed-by: Marc Alcala Prieto <marc.alcalaprieto@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40869>
This commit is contained in:
Erik Faye-Lund 2026-04-09 14:02:05 +02:00 committed by Marge Bot
parent 779981a3f1
commit ebe4a56650

View file

@ -18,13 +18,15 @@
#include "vk_ycbcr_conversion.h"
static enum mali_mipmap_mode
panvk_translate_sampler_mipmap_mode(VkSamplerMipmapMode mode)
panvk_translate_sampler_mipmap_mode(VkSamplerMipmapMode mode,
bool use_perf_trilinear)
{
switch (mode) {
case VK_SAMPLER_MIPMAP_MODE_NEAREST:
return MALI_MIPMAP_MODE_NEAREST;
case VK_SAMPLER_MIPMAP_MODE_LINEAR:
return MALI_MIPMAP_MODE_TRILINEAR;
return use_perf_trilinear ? MALI_MIPMAP_MODE_PERFORMANCE_TRILINEAR :
MALI_MIPMAP_MODE_TRILINEAR;
default:
UNREACHABLE("Invalid mipmap mode");
}
@ -106,11 +108,12 @@ panvk_sampler_fill_desc(const struct VkSamplerCreateInfo *info,
VkSamplerReductionMode reduction_mode,
VkSamplerCreateFlags flags)
{
bool use_aniso = info->anisotropyEnable && info->maxAnisotropy > 1;
pan_pack(desc, SAMPLER, cfg) {
cfg.magnify_nearest = mag_filter == VK_FILTER_NEAREST;
cfg.minify_nearest = min_filter == VK_FILTER_NEAREST;
cfg.mipmap_mode =
panvk_translate_sampler_mipmap_mode(info->mipmapMode);
panvk_translate_sampler_mipmap_mode(info->mipmapMode, use_aniso);
cfg.normalized_coordinates = !info->unnormalizedCoordinates;
cfg.clamp_integer_array_indices = false;
@ -165,7 +168,7 @@ panvk_sampler_fill_desc(const struct VkSamplerCreateInfo *info,
cfg.border_color_b = border_color.uint32[2];
cfg.border_color_a = border_color.uint32[3];
if (info->anisotropyEnable && info->maxAnisotropy > 1) {
if (use_aniso) {
cfg.maximum_anisotropy = info->maxAnisotropy;
cfg.lod_algorithm = MALI_LOD_ALGORITHM_ANISOTROPIC;
}