tgsi: remove unused tgsi_shader_info.uses_derivatives
authorThomas H.P. Andersen <phomes@gmail.com>
Tue, 11 Jul 2023 16:22:29 +0000 (18:22 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 19 Jul 2023 12:41:27 +0000 (12:41 +0000)
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24100>

src/gallium/auxiliary/nir/nir_to_tgsi_info.c
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_scan.h

index ecc7f2b..83a3b5b 100644 (file)
@@ -164,22 +164,7 @@ static void scan_instruction(const struct nir_shader *nir,
 {
    info->num_instructions = 2;
 
-   if (instr->type == nir_instr_type_alu) {
-      const nir_alu_instr *alu = nir_instr_as_alu(instr);
-
-      switch (alu->op) {
-      case nir_op_fddx:
-      case nir_op_fddy:
-      case nir_op_fddx_fine:
-      case nir_op_fddy_fine:
-      case nir_op_fddx_coarse:
-      case nir_op_fddy_coarse:
-         info->uses_derivatives = true;
-         break;
-      default:
-         break;
-      }
-   } else if (instr->type == nir_instr_type_tex) {
+   if (instr->type == nir_instr_type_tex) {
       nir_tex_instr *tex = nir_instr_as_tex(instr);
       const nir_variable *texture = tex_get_texture_var(tex);
 
@@ -190,10 +175,6 @@ static void scan_instruction(const struct nir_shader *nir,
       case nir_texop_tex:
          info->opcode_count[TGSI_OPCODE_TEX]++;
          FALLTHROUGH;
-      case nir_texop_txb:
-      case nir_texop_lod:
-         info->uses_derivatives = true;
-         break;
       default:
          break;
       }
index 6629753..b793caf 100644 (file)
@@ -76,33 +76,6 @@ is_texture_inst(enum tgsi_opcode opcode)
 }
 
 
-/**
- * Is the opcode an instruction which computes a derivative explicitly or
- * implicitly?
- */
-static bool
-computes_derivative(enum tgsi_opcode opcode)
-{
-   if (tgsi_get_opcode_info(opcode)->is_tex) {
-      return opcode != TGSI_OPCODE_TG4 &&
-             opcode != TGSI_OPCODE_TXD &&
-             opcode != TGSI_OPCODE_TXF &&
-             opcode != TGSI_OPCODE_TXF_LZ &&
-             opcode != TGSI_OPCODE_TEX_LZ &&
-             opcode != TGSI_OPCODE_TXL &&
-             opcode != TGSI_OPCODE_TXL2 &&
-             opcode != TGSI_OPCODE_TXQ &&
-             opcode != TGSI_OPCODE_TXQS;
-   }
-
-   return opcode == TGSI_OPCODE_DDX || opcode == TGSI_OPCODE_DDX_FINE ||
-          opcode == TGSI_OPCODE_DDY || opcode == TGSI_OPCODE_DDY_FINE ||
-          opcode == TGSI_OPCODE_SAMPLE ||
-          opcode == TGSI_OPCODE_SAMPLE_B ||
-          opcode == TGSI_OPCODE_SAMPLE_C;
-}
-
-
 static void
 scan_src_operand(struct tgsi_shader_info *info,
                  const struct tgsi_full_instruction *fullinst,
@@ -464,9 +437,6 @@ scan_instruction(struct tgsi_shader_info *info,
       }
    }
 
-   if (computes_derivative(fullinst->Instruction.Opcode))
-      info->uses_derivatives = true;
-
    info->num_instructions++;
 }
      
index 80d67e4..83eed40 100644 (file)
@@ -104,7 +104,6 @@ struct tgsi_shader_info
    bool writes_viewport_index;
    bool writes_layer;
    bool writes_memory; /**< contains stores or atomics to buffers or images */
-   bool uses_derivatives;
    bool uses_bindless_samplers;
    bool uses_bindless_images;
    bool uses_fbfetch;