From 4b6d98a40cba82e91b11afe05d1625306660ed33 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 25 Feb 2023 23:03:58 -0500 Subject: [PATCH] ir3: Use lower_index_to_offset Instead of doing the add ourselves. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Faith Ekstrand Reviewed-by: Emma Anholt Part-of: --- src/freedreno/ir3/ir3_compiler_nir.c | 8 -------- src/freedreno/ir3/ir3_nir.c | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 6484a37f08a..cc95794dbd7 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -2879,10 +2879,6 @@ get_tex_samp_tex_src(struct ir3_context *ctx, nir_tex_instr *tex) if (texture_idx >= 0) { texture = ir3_get_src(ctx, &tex->src[texture_idx].src)[0]; texture = ir3_COV(ctx->block, texture, TYPE_U32, TYPE_U16); - if (tex->texture_index != 0) { - texture = ir3_ADD_U(b, texture, 0, create_immed_typed(b, tex->texture_index, TYPE_U16), 0); - texture->dsts[0]->flags |= IR3_REG_HALF; - } } else { /* TODO what to do for dynamic case? I guess we only need the * max index for astc srgb workaround so maybe not a problem @@ -2898,10 +2894,6 @@ get_tex_samp_tex_src(struct ir3_context *ctx, nir_tex_instr *tex) if (sampler_idx >= 0) { sampler = ir3_get_src(ctx, &tex->src[sampler_idx].src)[0]; sampler = ir3_COV(ctx->block, sampler, TYPE_U32, TYPE_U16); - if (tex->sampler_index != 0) { - sampler = ir3_ADD_U(b, sampler, 0, create_immed_typed(b, tex->sampler_index, TYPE_U16), 0); - sampler->dsts[0]->flags |= IR3_REG_HALF; - } } else { sampler = create_immed_typed(ctx->block, tex->sampler_index, TYPE_U16); info.samp_idx = tex->texture_index; diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 59389bf5247..45bdb6c2d25 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -329,6 +329,7 @@ ir3_finalize_nir(struct ir3_compiler *compiler, nir_shader *s) .lower_rect = 0, .lower_tg4_offsets = true, .lower_invalid_implicit_lod = true, + .lower_index_to_offset = true, }; if (compiler->gen >= 4) {