st/nine: Use FLT_MAX/2 for RCP clamping
authorAxel Davy <davyaxel0@gmail.com>
Fri, 22 Feb 2019 19:41:00 +0000 (20:41 +0100)
committerAxel Davy <davyaxel0@gmail.com>
Tue, 30 Apr 2019 17:18:49 +0000 (19:18 +0200)
This seems to fix Rayman (which adds things
to the RCP result, and thus gets an Inf),
while not having regressions.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
src/gallium/state_trackers/nine/nine_shader.c

index 145647bc3f82c1507eedf229775057d97c8890f8..49e7c9407bb1c2d4bb5343fdfd9887c8095d7b94 100644 (file)
@@ -2333,8 +2333,9 @@ DECL_SPECIAL(RCP)
     struct ureg_dst tmp = tx->mul_zero_wins ? dst : tx_scratch(tx);
     ureg_RCP(ureg, tmp, src);
     if (!tx->mul_zero_wins) {
-        ureg_MIN(ureg, tmp, ureg_imm1f(ureg, FLT_MAX), ureg_src(tmp));
-        ureg_MAX(ureg, dst, ureg_imm1f(ureg, -FLT_MAX), ureg_src(tmp));
+        /* FLT_MAX has issues with Rayman */
+        ureg_MIN(ureg, tmp, ureg_imm1f(ureg, FLT_MAX/2.f), ureg_src(tmp));
+        ureg_MAX(ureg, dst, ureg_imm1f(ureg, -FLT_MAX/2.f), ureg_src(tmp));
     }
     return D3D_OK;
 }