From adecf52a3bc01ccf34e61493b4a9cf8e0b89b34f Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Fri, 16 Sep 2022 19:41:02 +0800 Subject: [PATCH] ac/llvm: add disable_aniso_single_level abi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RADV use dri option to enabled this for some apps, but it's done in nir lower currently. I'm afraid it still needs this option to handle the non-uniform case as desc is loaded in llvm. radeonsi always enable this for bind-textures. radeonsi will lower all bind-textures to bindless-textures, and only bind-textures use desc index, so add this abi for bindless desc index path. Reviewed-by: Marek Olšák Signed-off-by: Qiang Yu Part-of: --- src/amd/llvm/ac_nir_to_llvm.c | 7 ++++++- src/amd/llvm/ac_shader_abi.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 5b82a509d54..c807a4bbe4e 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -4682,9 +4682,14 @@ static void tex_fetch_ptrs(struct ac_nir_context *ctx, nir_tex_instr *instr, *res_ptr = ctx->abi->load_sampler_desc(ctx->abi, 0, 0, 0, texture_dynamic_handle, main_descriptor, false, false, true); - if (samp_ptr && sampler_dynamic_handle) + if (samp_ptr && sampler_dynamic_handle) { *samp_ptr = ctx->abi->load_sampler_desc(ctx->abi, 0, 0, 0, sampler_dynamic_handle, AC_DESC_SAMPLER, false, false, true); + + if (ctx->abi->disable_aniso_single_level && + instr->sampler_dim < GLSL_SAMPLER_DIM_RECT) + *samp_ptr = sici_fix_sampler_aniso(ctx, *res_ptr, *samp_ptr); + } return; } diff --git a/src/amd/llvm/ac_shader_abi.h b/src/amd/llvm/ac_shader_abi.h index 67eb2af5a97..2e10d57ab0d 100644 --- a/src/amd/llvm/ac_shader_abi.h +++ b/src/amd/llvm/ac_shader_abi.h @@ -135,6 +135,9 @@ struct ac_shader_abi { * waterfall to avoid incorrect rendering. */ bool use_waterfall_for_divergent_tex_samplers; + /* Whether to disable anisotropic filtering. */ + bool disable_aniso_single_level; + /* Number of all interpolated inputs */ unsigned num_interp; };