diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 836e58be647..af138de62bb 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -835,22 +835,15 @@ gather_tex_info(nir_tex_instr *instr, nir_shader *shader) static void gather_alu_info(nir_alu_instr *instr, nir_shader *shader) { - switch (instr->op) { - case nir_op_fddx: - case nir_op_fddy: - shader->info.uses_fddx_fddy = true; - FALLTHROUGH; - case nir_op_fddx_fine: - case nir_op_fddy_fine: - case nir_op_fddx_coarse: - case nir_op_fddy_coarse: - if (shader->info.stage == MESA_SHADER_FRAGMENT) - shader->info.fs.needs_quad_helper_invocations = true; - break; - default: - break; + if (nir_op_is_derivative(instr->op) && + shader->info.stage == MESA_SHADER_FRAGMENT) { + + shader->info.fs.needs_quad_helper_invocations = true; } + if (instr->op == nir_op_fddx || instr->op == nir_op_fddy) + shader->info.uses_fddx_fddy = true; + const nir_op_info *info = &nir_op_infos[instr->op]; for (unsigned i = 0; i < info->num_inputs; i++) {