{
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);
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;
}
}
-/**
- * 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,
}
}
- if (computes_derivative(fullinst->Instruction.Opcode))
- info->uses_derivatives = true;
-
info->num_instructions++;
}