hk: only enable image view min LOD for dx12

I don't really want random Vulkan apps using this. fixes Steam shading
precaching via fossilize.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36399>
This commit is contained in:
Alyssa Rosenzweig 2025-07-30 14:21:27 -04:00
parent a0a18c084e
commit 7f2a6cdd26
6 changed files with 25 additions and 11 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -1308,6 +1308,12 @@ TODO: document the other workarounds.
conformance rather than be limited to FL11.
-->
<option name="hk_fake_minmax" value="true" />
<!---
We need this for FL12_0, but we only implement it for vkd3d
because it's not the speediest thing.
-->
<option name="hk_image_view_min_lod" value="true" />
</engine>
</device>
<device driver="panvk">

View file

@ -651,6 +651,10 @@
DRI_CONF_OPT_B(hk_fake_minmax, def, \
"Fake support for min/max filtering")
#define DRI_CONF_HK_IMAGE_VIEW_MIN_LOD(def) \
DRI_CONF_OPT_B(hk_image_view_min_lod, def, \
"Emulate VK_EXT_image_view_min_lod (conformant but slower)")
/**
* \brief venus specific configuration options
*/