tgsi_exec: Fix NaN behavior of min and max
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 23 Apr 2021 00:46:39 +0000 (17:46 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 23 Apr 2021 22:01:45 +0000 (22:01 +0000)
commit939bf7a4198cecff57510b7fe5d38ef9b5dd22be
tree464f33b3e4374d5cb3095a78db195b0a722d0d73
parentd1c0f62b4296799014a0a7ad09b8baae8961c974
tgsi_exec: Fix NaN behavior of min and max

Modern shader APIs, like DX10 and GLSL 1.30, want min() and max() to
"cleanse" NaN.  If one source is NaN, the other value should be chosen.
If both sources are NaN, the result may be either.

There are many cases where TGSI is generate from NIR, and many
optimizations in NIR expect this behavior.  Not meeting these
expectations can lead to unexpected results.

Reviewed-by: Eric Anholt <eric@anholt.net>
Fixes: ffe58739da9 ("Softpipe: import TGSI tree. Not hooked-up yet.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10419>
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/drivers/softpipe/ci/softpipe-quick.txt