summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-02-06 19:55:54 +0100
committerAxel Davy <[email protected]>2016-02-12 23:26:36 +0100
commit6b43f5b1d4efca53f246296f98db00ff8f7544b6 (patch)
tree26cb6a2370957b7974f54c2dddc55809755ca836 /src/gallium/state_trackers/nine
parent17078d92ea524c9f0e9dff8d17f8b2df752d24cc (diff)
st/nine: Remove usage of SQRT in ff code
SQRT is not supported everywhere, so replace it by RSQ + MUL and handle case <= 0. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine')
-rw-r--r--src/gallium/state_trackers/nine/nine_ff.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index a5466a7bdd4..e79d0b4f881 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -563,7 +563,9 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
struct ureg_src cPsz2 = ureg_DECL_constant(ureg, 27);
ureg_DP3(ureg, tmp_x, ureg_src(r[1]), ureg_src(r[1]));
- ureg_SQRT(ureg, tmp_y, _X(tmp));
+ ureg_RSQ(ureg, tmp_y, _X(tmp));
+ ureg_MUL(ureg, tmp_y, _Y(tmp), _X(tmp));
+ ureg_CMP(ureg, tmp_y, ureg_negate(_Y(tmp)), _Y(tmp), ureg_imm1f(ureg, 0.0f));
ureg_MAD(ureg, tmp_x, _Y(tmp), _YYYY(cPsz2), _XXXX(cPsz2));
ureg_MAD(ureg, tmp_x, _Y(tmp), _X(tmp), _WWWW(cPsz1));
ureg_RCP(ureg, tmp_x, ureg_src(tmp));