ac/nir: add an option to disable anisotropic filtering for single level images

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14171>
This commit is contained in:
Samuel Pitoiset 2021-12-13 17:39:01 +01:00 committed by Marge Bot
parent 1cb5c1775b
commit 8a327722d5
4 changed files with 8 additions and 1 deletions

View file

@ -4453,7 +4453,7 @@ static LLVMValueRef sici_fix_sampler_aniso(struct ac_nir_context *ctx, LLVMValue
LLVMBuilderRef builder = ctx->ac.builder;
LLVMValueRef img7, samp0;
if (ctx->ac.chip_class >= GFX8)
if (ctx->ac.chip_class >= GFX8 || !ctx->abi->disable_aniso_single_level)
return samp;
img7 = LLVMBuildExtractElement(builder, res, LLVMConstInt(ctx->ac.i32, 7, 0), "");

View file

@ -170,6 +170,11 @@ struct ac_shader_abi {
* some GFX10.3 chips.
*/
bool adjust_frag_coord_z;
/* Whether anisotropic filtering should be disabled for single level
* images.
*/
bool disable_aniso_single_level;
};
#endif /* AC_SHADER_ABI_H */

View file

@ -2399,6 +2399,7 @@ ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm,
ctx.abi.clamp_shadow_reference = false;
ctx.abi.adjust_frag_coord_z = options->adjust_frag_coord_z;
ctx.abi.robust_buffer_access = options->robust_buffer_access;
ctx.abi.disable_aniso_single_level = true;
bool is_ngg = is_pre_gs_stage(shaders[0]->info.stage) && info->is_ngg;
if (shader_count >= 2 || is_ngg)

View file

@ -520,6 +520,7 @@ static bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *
ctx->abi.convert_undef_to_zero = true;
ctx->abi.clamp_div_by_zero = ctx->screen->options.clamp_div_by_zero;
ctx->abi.adjust_frag_coord_z = false;
ctx->abi.disable_aniso_single_level = true;
const struct si_shader_info *info = &ctx->shader->selector->info;
for (unsigned i = 0; i < info->num_outputs; i++) {