diff --git a/src/asahi/vulkan/hk_instance.c b/src/asahi/vulkan/hk_instance.c index 69e315ff979..0feab5abb12 100644 --- a/src/asahi/vulkan/hk_instance.c +++ b/src/asahi/vulkan/hk_instance.c @@ -96,6 +96,7 @@ static const driOptionDescription hk_dri_options[] = { DRI_CONF_SECTION_MISCELLANEOUS DRI_CONF_HK_DISABLE_BORDER_EMULATION(false) DRI_CONF_HK_FAKE_MINMAX(false) + DRI_CONF_HK_IMAGE_VIEW_MIN_LOD(false) DRI_CONF_SECTION_END }; /* clang-format on */ @@ -118,6 +119,9 @@ hk_init_dri_options(struct hk_instance *instance) instance->fake_minmax = driQueryOptionb(&instance->dri_options, "hk_fake_minmax"); + + instance->image_view_min_lod = + driQueryOptionb(&instance->dri_options, "hk_image_view_min_lod"); } VKAPI_ATTR VkResult VKAPI_CALL diff --git a/src/asahi/vulkan/hk_instance.h b/src/asahi/vulkan/hk_instance.h index 34442ddfaa0..f5d05b556a9 100644 --- a/src/asahi/vulkan/hk_instance.h +++ b/src/asahi/vulkan/hk_instance.h @@ -22,6 +22,7 @@ struct hk_instance { bool no_border; bool fake_minmax; + bool image_view_min_lod; }; VK_DEFINE_HANDLE_CASTS(hk_instance, vk.base, VkInstance, diff --git a/src/asahi/vulkan/hk_physical_device.c b/src/asahi/vulkan/hk_physical_device.c index 85a64f0fdcb..1b83e5d48a9 100644 --- a/src/asahi/vulkan/hk_physical_device.c +++ b/src/asahi/vulkan/hk_physical_device.c @@ -158,7 +158,7 @@ hk_get_device_extensions(const struct hk_instance *instance, .EXT_image_drm_format_modifier = true, .EXT_image_robustness = true, .EXT_image_sliced_view_of_3d = false, - .EXT_image_view_min_lod = true, + .EXT_image_view_min_lod = instance->image_view_min_lod, .EXT_index_type_uint8 = true, .EXT_inline_uniform_block = true, .EXT_line_rasterization = true, @@ -532,7 +532,7 @@ hk_get_device_features( #endif /* VK_EXT_image_view_min_lod */ - .minLod = true, + .minLod = instance->image_view_min_lod, /* VK_EXT_map_memory_placed */ .memoryMapPlaced = true, diff --git a/src/asahi/vulkan/hk_shader.c b/src/asahi/vulkan/hk_shader.c index e94de581a8e..30537f30940 100644 --- a/src/asahi/vulkan/hk_shader.c +++ b/src/asahi/vulkan/hk_shader.c @@ -14,6 +14,7 @@ #include "agx_nir_lower_gs.h" #include "agx_nir_lower_vbo.h" #include "glsl_types.h" +#include "hk_instance.h" #include "libagx.h" #include "nir.h" #include "nir_builder.h" @@ -254,18 +255,13 @@ hk_populate_fs_key(struct hk_fs_key *key, } enum hk_feature_key { - HK_FEAT_MIN_LOD = BITFIELD_BIT(0), - HK_FEAT_CUSTOM_BORDER = BITFIELD_BIT(1), + HK_FEAT_CUSTOM_BORDER = BITFIELD_BIT(0), }; static enum hk_feature_key -hk_make_feature_key(const struct vk_features *features) +hk_make_feature_key(const struct vk_features *feats) { - if (!features) - return ~0U; - - return (features->minLod ? HK_FEAT_MIN_LOD : 0) | - (features->customBorderColors ? HK_FEAT_CUSTOM_BORDER : 0); + return (!feats || feats->customBorderColors) ? HK_FEAT_CUSTOM_BORDER : 0; } static void @@ -842,7 +838,10 @@ hk_lower_nir(struct hk_device *dev, nir_shader *nir, */ NIR_PASS(_, nir, agx_nir_lower_texture_early, true /* support_lod_bias */); - if (features & HK_FEAT_MIN_LOD) { + struct hk_instance *instance = hk_physical_device_instance( + (struct hk_physical_device *)dev->vk.physical); + + if (instance->image_view_min_lod) { NIR_PASS(_, nir, agx_nir_lower_image_view_min_lod); } diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index d42526732fa..86f01376740 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -1308,6 +1308,12 @@ TODO: document the other workarounds. conformance rather than be limited to FL11. -->