From 98b62434bd99ab962d4a7c3d23ec142154ee5cf7 Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Sun, 4 Feb 2024 16:13:20 -0800 Subject: [PATCH] intel/compiler: Lower texture operation to combine LOD and AI We have to push the lowering of texture operations a bit further in pipeline since nir_lower_tex gets invoked twice and if there is no LOD source present, nir_lower_tex adds that as a source. Once that's all done we can easily combine the LOD and array index into a single 32-bit value. Signed-off-by: Sagar Ghuge Reviewed-by: Ian Romanick Part-of: --- src/intel/compiler/brw_nir.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index a3bb7d666e2..7f91b411a7a 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -1886,6 +1886,11 @@ brw_nir_apply_key(nir_shader *nir, OPT(brw_nir_apply_sampler_key, compiler, &key->tex); + const struct brw_nir_lower_texture_opts tex_opts = { + .combined_lod_and_array_index = compiler->devinfo->ver >= 20, + }; + OPT(brw_nir_lower_texture, &tex_opts); + const nir_lower_subgroups_options subgroups_options = { .subgroup_size = get_subgroup_size(&nir->info, max_subgroup_size), .ballot_bit_size = 32,