nir/lower_tex: remove lower_array_layer_round_even
authorRhys Perry <pendingchaos02@gmail.com>
Tue, 25 Apr 2023 14:37:32 +0000 (15:37 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 25 May 2023 16:29:16 +0000 (16:29 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22636>

src/compiler/nir/nir.h
src/compiler/nir/nir_lower_tex.c

index d006a9e..877fb1f 100644 (file)
@@ -5471,11 +5471,6 @@ typedef struct nir_lower_tex_options {
     */
    bool lower_invalid_implicit_lod;
 
-   /* If true, round the layer component of the coordinates source to the nearest
-    * integer for all array ops.
-    */
-   bool lower_array_layer_round_even;
-
    /* If true, texture_index (sampler_index) will be zero if a texture_offset
     * (sampler_offset) source is present. This is convenient for backends that
     * support indirect indexing of textures (samplers) but not offsetting it.
index 3522c52..18cb5bc 100644 (file)
@@ -1103,27 +1103,6 @@ lower_tex_packing(nir_builder *b, nir_tex_instr *tex,
 }
 
 static bool
-lower_array_layer_round_even(nir_builder *b, nir_tex_instr *tex)
-{
-   int coord_index = nir_tex_instr_src_index(tex, nir_tex_src_coord);
-   if (coord_index < 0 || nir_tex_instr_src_type(tex, coord_index) != nir_type_float)
-      return false;
-
-   assert(tex->src[coord_index].src.is_ssa);
-   nir_ssa_def *coord = tex->src[coord_index].src.ssa;
-
-   b->cursor = nir_before_instr(&tex->instr);
-
-   unsigned layer = tex->coord_components - 1;
-   nir_ssa_def *rounded_layer = nir_fround_even(b, nir_channel(b, coord, layer));
-   nir_ssa_def *new_coord = nir_vector_insert_imm(b, coord, rounded_layer, layer);
-
-   nir_instr_rewrite_src_ssa(&tex->instr, &tex->src[coord_index].src, new_coord);
-
-   return true;
-}
-
-static bool
 sampler_index_lt(nir_tex_instr *tex, unsigned max)
 {
    assert(nir_tex_instr_src_index(tex, nir_tex_src_sampler_deref) == -1);
@@ -1561,11 +1540,6 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
          progress = true;
       }
 
-      if (options->lower_array_layer_round_even && tex->is_array &&
-          tex->op != nir_texop_lod) {
-         progress |= lower_array_layer_round_even(b, tex);
-      }
-
       if (tex->op == nir_texop_txd &&
           (options->lower_txd ||
            (options->lower_txd_shadow && tex->is_shadow) ||