[PATCH 9/9] d3dx9: Fix NAN handling in 'cmp' preshader opcode.
Paul Gofman
gofmanp at gmail.com
Mon May 8 10:39:43 CDT 2017
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
dlls/d3dx9_36/preshader.c | 2 +-
dlls/d3dx9_36/tests/effect.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx9_36/preshader.c b/dlls/d3dx9_36/preshader.c
index c9088c4..3de43ac 100644
--- a/dlls/d3dx9_36/preshader.c
+++ b/dlls/d3dx9_36/preshader.c
@@ -109,7 +109,7 @@ static double pres_ge(double *args, int n) {return args[0] >= args[1] ? 1.0 : 0
static double pres_frc(double *args, int n) {return args[0] - floor(args[0]);}
static double pres_min(double *args, int n) {return fmin(args[0], args[1]);}
static double pres_max(double *args, int n) {return fmax(args[0], args[1]);}
-static double pres_cmp(double *args, int n) {return args[0] < 0.0 ? args[2] : args[1];}
+static double pres_cmp(double *args, int n) {return pres_is_nan(args[0]) || args[0] < 0.0 ? args[2] : args[1];}
static double pres_sin(double *args, int n) {return sin(args[0]);}
static double pres_cos(double *args, int n) {return cos(args[0]);}
static double pres_rsq(double *args, int n)
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index dfc3f5b..8d8a8bb 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -4592,7 +4592,7 @@ static void test_effect_preshader_ops(IDirect3DDevice9 *device)
{"div", 0x20800004, 2, {0, 0, 0, 0},
{-0.3f, 0.0f, -2.2f, NAN}, {0.0f, -0.0f, -3.0f, 1.0f}},
{"cmp", 0x30000004, 3, {0x3f800000, 0, 0x400ccccd, 0x40800000},
- {-0.3f, 0.0f, 2.2f, NAN}, {1.0f, 2.0f, 3.0f, 4.0f}, 0, {FALSE, FALSE, FALSE, TRUE}},
+ {-0.3f, 0.0f, 2.2f, NAN}, {1.0f, 2.0f, 3.0f, 4.0f}},
{"0 * INF", 0x20500004, 2, {0xffc00000, 0xffc00000, 0xc0d33334, 0x7f800000},
{0.0f, -0.0f, -2.2f, 3.402823466e+38f}, {INFINITY, INFINITY, 3.0f, 4.0f}},
};
--
2.9.3
More information about the wine-patches
mailing list