From 780b814354b74d28d863325cfa2fe90fc5681913 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 3 Feb 2025 15:56:22 -0500 Subject: [PATCH] nir: add lod_bias_min_agx tex src this lets nir_opt_preamble Just Do The Right thing, so model in NIR Signed-off-by: Alyssa Rosenzweig Acked-by: Konstantin Seurer Part-of: --- src/compiler/nir/nir.c | 1 + src/compiler/nir/nir.h | 8 ++++++++ src/compiler/nir/nir_print.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 5d308de3f86..9306ab8fdee 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -3338,6 +3338,7 @@ nir_tex_instr_src_type(const nir_tex_instr *instr, unsigned src) case nir_tex_src_sampler_deref_intrinsic: case nir_tex_src_texture_deref_intrinsic: case nir_tex_src_ms_mcs_intel: + case nir_tex_src_lod_bias_min_agx: case nir_tex_src_texture_deref: case nir_tex_src_sampler_deref: case nir_tex_src_texture_offset: diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index adb72904e29..af9dcdd33b5 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2233,6 +2233,14 @@ typedef enum nir_tex_src_type { */ nir_tex_src_min_lod, + /** LOD bias + min LOD packed together into 32-bits. This is the common case + * for texturing on Honeykrisp with DX12, where both LOD bias and min LOD are + * emulated and passed in a single hardware source together. So it's + * important to optimize so e.g. nir_opt_preamble can make good decisions + * that avoid extra moves. + */ + nir_tex_src_lod_bias_min_agx, + /** MSAA sample index */ nir_tex_src_ms_index, diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 188211cf9b6..8030199bf2f 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -1835,6 +1835,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state) case nir_tex_src_ms_mcs_intel: fprintf(fp, "(ms_mcs_intel)"); break; + case nir_tex_src_lod_bias_min_agx: + fprintf(fp, "(lod_bias_min_agx)"); + break; case nir_tex_src_ddx: fprintf(fp, "(ddx)"); break;