From 9cba104e11d9e900b641f3c85e67534b7c84e7da Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Wed, 25 Mar 2026 14:38:42 +0100 Subject: [PATCH] nir/opt_fp_math_ctrl: use ddx/ddy fp_math_ctrl No Foz-DB changes. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_opt_fp_math_ctrl.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_opt_fp_math_ctrl.c b/src/compiler/nir/nir_opt_fp_math_ctrl.c index fed39ff52af..0d24b5b202d 100644 --- a/src/compiler/nir/nir_opt_fp_math_ctrl.c +++ b/src/compiler/nir/nir_opt_fp_math_ctrl.c @@ -225,10 +225,20 @@ opt_intrin_fp_math_ctrl(nir_intrinsic_instr *intrin) case nir_intrinsic_ddx_fine: case nir_intrinsic_ddy: case nir_intrinsic_ddy_coarse: - case nir_intrinsic_ddy_fine: - if (intrin->instr.pass_flags) + case nir_intrinsic_ddy_fine: { + unsigned fp_math_ctrl = nir_intrinsic_fp_math_ctrl(intrin); + if ((fp_math_ctrl & nir_fp_preserve_signed_zero) == 0) + return false; + + if (intrin->instr.pass_flags) { src_mark_preserve_sz(&intrin->src[0], NULL); - return false; + return false; + } else { + fp_math_ctrl &= ~nir_fp_preserve_signed_zero; + nir_intrinsic_set_fp_math_ctrl(intrin, fp_math_ctrl); + return true; + } + } default: break; }