From 9e477555c5030ec8a19f4f1e45fcd6798ac37b1d Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Sat, 27 Sep 2025 00:14:16 -0400 Subject: [PATCH] glsl/float64: Fix fmax with NaNs We have to invert the condition to select the non-NaN source, instead of just swapping a and b. The equivalent float32 function was failing dEQP-VK.spirv_assembly.instruction.graphics.float_controls.fp32.input_args.denorm_nmax_nan_preserve_frag without this fix. Part-of: --- src/compiler/glsl/float64.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl index 6381d392d6d..d9dbd86b18d 100644 --- a/src/compiler/glsl/float64.glsl +++ b/src/compiler/glsl/float64.glsl @@ -1733,7 +1733,7 @@ __fmax64(uint64_t a, uint64_t b) bool a_lt_b = __flt64_nonnan_minmax(a, b); bool a_nan = __is_nan(a); - return (b_nan || a_lt_b) && !a_nan ? b : a; + return (!b_nan && a_lt_b) || a_nan ? b : a; } uint64_t