From d628be082b8ab9dc9d96c71cf32a61663ea71cfd Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 24 Aug 2023 07:10:03 -0400 Subject: [PATCH] nir/gather_info: Use nir_op_is_derivative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alyssa Rosenzweig Reviewed-by: Daniel Schürmann Part-of: --- src/compiler/nir/nir_gather_info.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) 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++) {