[Mesa-dev] [PATCH 38/75] st/nine: Used normed Vtx for reflectionvector

Axel Davy axel.davy at ens.fr
Wed Oct 5 20:09:11 UTC 2016


Fix deduced from the spec.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/nine_ff.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index c2ce352..2c237f4 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -651,11 +651,14 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
             break;
         case NINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR:
             tmp.WriteMask = TGSI_WRITEMASK_XYZ;
-            ureg_DP3(ureg, tmp_x, vs->aVtx, vs->aNrm);
+            aVtx_normed = ureg_DECL_temporary(ureg);
+            ureg_normalize3(ureg, aVtx_normed, vs->aVtx);
+            ureg_DP3(ureg, tmp_x, ureg_src(aVtx_normed), vs->aNrm);
             ureg_MUL(ureg, tmp, vs->aNrm, _X(tmp));
             ureg_ADD(ureg, tmp, ureg_src(tmp), ureg_src(tmp));
-            ureg_SUB(ureg, ureg_writemask(input_coord, TGSI_WRITEMASK_XYZ), vs->aVtx, ureg_src(tmp));
+            ureg_SUB(ureg, ureg_writemask(input_coord, TGSI_WRITEMASK_XYZ), ureg_src(aVtx_normed), ureg_src(tmp));
             ureg_MOV(ureg, ureg_writemask(input_coord, TGSI_WRITEMASK_W), ureg_imm1f(ureg, 1.0f));
+            ureg_release_temporary(ureg, aVtx_normed);
             dim_input = 4;
             tmp.WriteMask = TGSI_WRITEMASK_XYZW;
             break;
-- 
2.10.0



More information about the mesa-dev mailing list